Commit b6286ca2ae0078825f553d6d27ed9d7ada5c022f
1 parent
565f50f5
Exists in
master
Visualização do perfil escolhido na página da conta do usuário.
Showing
5 changed files
with
11 additions
and
5 deletions
Show diff stats
pybossa/cache/users.py
| ... | ... | @@ -106,15 +106,18 @@ def get_leaderboard(n, user_id=None): |
| 106 | 106 | def get_user_summary(name): |
| 107 | 107 | """Return user summary.""" |
| 108 | 108 | sql = text(''' |
| 109 | - SELECT "user".id, "user".name, "user".fullname, "user".created, | |
| 109 | + WITH user_summary AS (SELECT "user".id, "user".name, "user".fullname, "user".created, | |
| 110 | 110 | "user".api_key, "user".twitter_user_id, "user".facebook_user_id, |
| 111 | 111 | "user".google_user_id, "user".info, |
| 112 | 112 | "user".email_addr, COUNT(task_run.user_id) AS n_answers, |
| 113 | - "user".valid_email, "user".confirmation_email_sent | |
| 113 | + "user".valid_email, "user".confirmation_email_sent, "user".profile_id | |
| 114 | 114 | FROM "user" |
| 115 | 115 | LEFT OUTER JOIN task_run ON "user".id=task_run.user_id |
| 116 | 116 | WHERE "user".name=:name |
| 117 | - GROUP BY "user".id; | |
| 117 | + GROUP BY "user".id), | |
| 118 | + profile_summary AS (SELECT profile.name AS profile_name | |
| 119 | + FROM user_summary, profile WHERE user_summary.profile_id=profile.id) | |
| 120 | + SELECT * FROM user_summary, profile_summary; | |
| 118 | 121 | ''') |
| 119 | 122 | results = session.execute(sql, dict(name=name)) |
| 120 | 123 | user = dict() |
| ... | ... | @@ -128,7 +131,8 @@ def get_user_summary(name): |
| 128 | 131 | email_addr=row.email_addr, n_answers=row.n_answers, |
| 129 | 132 | valid_email=row.valid_email, |
| 130 | 133 | confirmation_email_sent=row.confirmation_email_sent, |
| 131 | - registered_ago=pretty_date(row.created)) | |
| 134 | + registered_ago=pretty_date(row.created), | |
| 135 | + profile=dict(name=row.profile_name)) | |
| 132 | 136 | if user: |
| 133 | 137 | rank_score = rank_and_score(user['id']) |
| 134 | 138 | user['rank'] = rank_score['rank'] | ... | ... |
pybossa/themes/default/templates/account/_helpers.html
| ... | ... | @@ -42,6 +42,7 @@ |
| 42 | 42 | <div class="col-md-9"> |
| 43 | 43 | <ul class="list-unstyled"> |
| 44 | 44 | <li><i class="glyphicon glyphicon-user"></i> <strong>{{ _('Nick')}}</strong>: {{ user.name }}</li> |
| 45 | + <li><i class="glyphicon glyphicon-certificate"></i> <strong>{{ _('Profile')}}</strong>: {{ user.profile.name }}</li> | |
| 45 | 46 | {% if private %} |
| 46 | 47 | <li><i class="glyphicon glyphicon-envelope"></i> <strong>{{_('E-mail')}}</strong>: {{ |
| 47 | 48 | user.email_addr }} | ... | ... |
pybossa/themes/default/translations/pt_BR/LC_MESSAGES/messages.mo
No preview for this file type
pybossa/themes/default/translations/pt_BR/LC_MESSAGES/messages.po
| ... | ... | @@ -2404,7 +2404,7 @@ msgstr "Voluntários Anônimos" |
| 2404 | 2404 | |
| 2405 | 2405 | #: themes/pybossa-contribua-theme/templates/stats/index.html:13 |
| 2406 | 2406 | msgid "Community Leaderboard" |
| 2407 | -msgstr "Ranking da Comunudade" | |
| 2407 | +msgstr "Ranking da Comunidade" | |
| 2408 | 2408 | |
| 2409 | 2409 | #: themes/pybossa-contribua-theme/templates/stats/index.html:19 |
| 2410 | 2410 | msgid "Score" | ... | ... |
pybossa/view/account.py
| ... | ... | @@ -343,6 +343,7 @@ def _show_own_profile(user): |
| 343 | 343 | projects_contributed = cached_users.projects_contributed_cached(user.id) |
| 344 | 344 | projects_published, projects_draft = _get_user_projects(user.id) |
| 345 | 345 | cached_users.get_user_summary(user.name) |
| 346 | + user.profile = name=user_repo.get_profile_by(id=user.profile_id) | |
| 346 | 347 | |
| 347 | 348 | return render_template('account/profile.html', title=gettext("Profile"), |
| 348 | 349 | projects_contrib=projects_contributed, | ... | ... |