Skip to content

Commit

Permalink
FS-4001: Minor fixes
Browse files Browse the repository at this point in the history
The details of the assigned to you section are now hidden if there haven't been any assignments. The assign assessments button on the assignments overview page now redirects back to the correct page, assessment dashboard or assessment overview depending on where the user started the assignment journey.
  • Loading branch information
suegarner committed Oct 17, 2024
1 parent 90fe0d5 commit de61bec
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 31 deletions.
29 changes: 19 additions & 10 deletions app/blueprints/assessments/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1114,13 +1114,18 @@ def assignment_overview(fund_short_name: str, round_short_name: str):
f"Could not create assignment for user {user_id} and application {application_id}"
)

return redirect(
url_for(
if from_form == 'True':
return redirect(url_for(
"assessment_bp.application",
application_id=application_id,
))
else:
return redirect(url_for(
"assessment_bp.fund_dashboard",
fund_short_name=fund_short_name,
round_short_name=round_short_name,
)
)
))


thread_executor.executor.shutdown()

Expand Down Expand Up @@ -1677,10 +1682,14 @@ def application(application_id):

thread_executor.executor.shutdown()

assigner_account = get_bulk_accounts_dict(
[existing_assignments[-1]["assigner_id"]],
state.fund_short_name,
)
assigner_account, assignment_date, assigner_name = None, None, None
if len(existing_assignments) > 0:
assigner_account = get_bulk_accounts_dict(
[existing_assignments[-1]["assigner_id"]],
state.fund_short_name,
)
assigner_name=(next(iter(assigner_account.values()))["full_name"])
assignment_date=existing_assignments[-1]["created_at"]

return render_template(
"assessor_tasklist.html",
Expand Down Expand Up @@ -1709,8 +1718,8 @@ def application(application_id):
comments=theme_matched_comments,
assigned_lead_assessors=assigned_lead_assessors,
assigned_assessors=assigned_assessors,
assignment_date=existing_assignments[-1]["created_at"],
assigner_name=next(iter(assigner_account.values()))["full_name"],
assignment_date=assignment_date,
assigner_name=assigner_name,
round_short_name=fund_round.short_name,
fund_short_name=state.fund_short_name,
)
Expand Down
14 changes: 4 additions & 10 deletions app/blueprints/assessments/templates/assignment_overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,9 @@ <h1 class="govuk-heading-l">Assign assessments to {{ "lead" if assessor_role ==
{% endif %}
</p>
{% endif %}

<form method="post" action="
{% if from_form == 'True' %}
{{ url_for('assessment_bp.application', application_id=selected_assessments[0]) }}
{% else %}
{{ url_for('assessment_bp.assignment_overview',
fund_short_name=round_details.fund_short_name,
round_short_name=round_details.round_short_name) }}
{% endif %}
">
<form method="post" action="{{ url_for('assessment_bp.assignment_overview',
fund_short_name=round_details.fund_short_name,
round_short_name=round_details.round_short_name) }}">
{{ form.csrf_token }}
{% if form.form_errors %}
<ul class="errors">
Expand All @@ -79,6 +72,7 @@ <h1 class="govuk-heading-l">Assign assessments to {{ "lead" if assessor_role ==
{% for key, value in assessor_messages.items() %}
<input type="hidden" name="{{ key }}" value="{{ value }}">
{% endfor %}
<input type="hidden" name="from_form" value="{{ from_form }}">
<p class="govuk-body">
<button type="submit" class="govuk-link btn-link" name="change_roles" value="change_roles">Change roles</button> or
<button type="submit" class="govuk-link btn-link" name="change_users" value="change_users">Change users</button>
Expand Down
24 changes: 13 additions & 11 deletions app/blueprints/assessments/templates/macros/assigned_to.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
<h3 class="govuk-heading-m">Assigned to you</h3>
<hr class="govuk-section-break govuk-section-break--m govuk-section-break--visible section_break_blue">

<p class="govuk-body">
<strong>{{ assigner_name}}</strong> assigned the assessors:
</p>
<ul class="govuk-list">
{%for assessor in assigned_assessors%}
<li>{{ assessor.full_name }}</li>
{%endfor%}
</ul>
<p class="govuk-body">
{{ assignment_date | utc_to_bst }}
</p>
{% if assigner_name is not none %}
<p class="govuk-body">
<strong>{{ assigner_name }}</strong> assigned the assessors:
</p>
<ul class="govuk-list">
{%for assessor in assigned_assessors%}
<li>{{ assessor.full_name }}</li>
{%endfor%}
</ul>
<p class="govuk-body">
{{ assignment_date | utc_to_bst }}
</p>
{% endif %}

{% if g.user.highest_role_map[fund_short_name] == 'LEAD_ASSESSOR' %}
<form method="post" action="{{ url_for('assessment_bp.assign_assessments', fund_short_name=fund_short_name, round_short_name=round_short_name) }}">
Expand Down

0 comments on commit de61bec

Please sign in to comment.