Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/ucd 36 custom application history page #279

Merged
merged 5 commits into from
Sep 11, 2024

Conversation

dhvander
Copy link
Contributor

Customise the review history so that it shows the summary of application status changes along with the changes done in the review.

To provide this, we had to override the /simple_history/object_history.html so we keep the default behaviour for all other types.

In the status summary table, we filter out similar records and only display the latest record of the similar group. For detailed information, the user can view the relevant application's history under Applications.

Remove the history records from Person (and derived classes) and Registrant as it is not used by the admins.
Check if we are on local environment before trying to send the emails. This will enable us to test the model updates without any interruptions on local testing.
Customise the review history so that it shows the summary of application status changes along with the changes done in the review.

To provide this, we had to override the /simple_history/object_history.html so we keep the default behaviour for all other types.

In the status summary table, we filter out similar records and only display the latest record of the similar group. For detailed information, the user can view the relevant application's history under Applications.
Disable change on the following entities
1. Registrar
2. Registrant
3. RegistryPublishedPerson
4. RegistrantPerson
5. RegistrarPerson
<th scope="col">{% trans 'Date/time' %}</th>
<th scope="col">{% trans 'Event' %}</th>
<th scope="col">{% trans 'Changed by' %}</th>
<th scope="col">{% trans 'Change fields' %}</th>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Changed Fields" is better I think

{% endif %}
</td>
<td>
<i>{{ action | changed_fields }}</i>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why <i>? I don't think it's needed. It actually makes the text harder to read. Maybe you could also use something to join using commas as opposed to displaying the raw string. Better abc, def than ['abc', 'def']


{% block content %}
<div id="content-main">
<h2>{% blocktrans %} Status change history{% endblocktrans %}</h2>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why blocktrans?

request_a_govuk_domain/request/admin/views.py Show resolved Hide resolved
@@ -58,25 +64,23 @@ <h2>Full event history</h2>
<thead>
<tr>
<th scope="col">{% trans 'Date/time' %}</th>
<th scope="col">{% trans 'Event' %}</th>
<th scope="col">{% trans 'Changed by' %}</th>
<th scope="col">{% trans 'User' %}</th>
<th scope="col">{% trans 'Change fields' %}</th>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Changed fields" is better I think

@@ -15,22 +17,49 @@ def changed_fields(obj):
if obj.prev_record:
delta = obj.diff_against(obj.prev_record)
changes = list(filter(lambda x: x != "last_updated_by", delta.changed_fields))
return changes if changes else "Updated through review"
return changes if changes else "--"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put something more explicit than -- ? What does it mean for the user when there are no changes? Why show entries in the history if there are no changes?

@@ -25,7 +25,7 @@ <h2>Full event history</h2>
<tr>
<th scope="col">{% trans 'Date/time' %}</th>
<th scope="col">{% trans 'User' %}</th>
<th scope="col">{% trans 'Change fields' %}</th>
<th scope="col">{% trans 'Change Fields' %}</th>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Changed fields"

@@ -65,7 +65,7 @@ <h2>Full event history</h2>
<tr>
<th scope="col">{% trans 'Date/time' %}</th>
<th scope="col">{% trans 'User' %}</th>
<th scope="col">{% trans 'Change fields' %}</th>
<th scope="col">{% trans 'Change Fields' %}</th>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Changed fields"

@@ -17,8 +17,8 @@ def changed_fields(obj):
if obj.prev_record:
delta = obj.diff_against(obj.prev_record)
changes = list(filter(lambda x: x != "last_updated_by", delta.changed_fields))
return changes if changes else "--"
return "-"
return ", ".join(changes) if changes else "No Changes"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"No changes" (lower case c)

@dhvander dhvander force-pushed the feature/UCD_36-custom-application-history-page branch from e7cfc72 to fba6e57 Compare September 11, 2024 09:18
Updated the UI to make it more user-friendly.
@dhvander dhvander force-pushed the feature/UCD_36-custom-application-history-page branch from fba6e57 to f94ad84 Compare September 11, 2024 09:36
@maxf maxf self-requested a review September 11, 2024 09:39
@dhvander dhvander merged commit bf9539b into main Sep 11, 2024
1 check passed
@dhvander dhvander deleted the feature/UCD_36-custom-application-history-page branch September 11, 2024 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants