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

Highlight candidate application edits on manage (with activity log fix) #8706

Conversation

inulty-dfe
Copy link
Collaborator

@inulty-dfe inulty-dfe commented Oct 19, 2023

Context

Un reverts #8695

Additional changes can be inspected from b0b2e61

ActivityLog in the provider interface collates all audits on applications for the current provider. This query requires access to the application choice. Audits that are created because an application form changes do not have a direct relationship to an application choice so the view logic has no way of generating a link to the relevant application choice.

Screenshots

Activity Log Timeline
Screenshot from 2023-10-23 13-48-56 Screenshot from 2023-10-23 13-49-10

Changes proposed in this pull request

Here we update the ActivityLog query to return the application_choice_id column. We can access this when the Audit#auditable or Audit#associated is not an ApplicationChoice

Also added is ApplicationForm::ColumnSectionMapping.
This provides a simple API for getting the columns belonging to a section, and getting the section that a column belongs to.

Guidance to review

Have I collected all the correct columns corresponding to the sections?

Link to Trello card

Trello Ticket

@inulty-dfe inulty-dfe changed the title 33 ca highlight candidate application edits on manage (with activity log fix) Highlight candidate application edits on manage (with activity log fix) Oct 19, 2023
@inulty-dfe inulty-dfe added the deploy_v2 Deploy the review app to AKS label Oct 20, 2023
@github-actions github-actions bot temporarily deployed to review_aks-8706 October 20, 2023 07:23 Destroyed
@inulty-dfe inulty-dfe temporarily deployed to review_aks October 20, 2023 07:23 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to review_aks-8706 October 20, 2023 12:19 Destroyed
@inulty-dfe inulty-dfe temporarily deployed to review_aks October 20, 2023 12:20 — with GitHub Actions Inactive
@inulty-dfe inulty-dfe force-pushed the 33-ca-highlight-candidate-application-edits-on-manage-with-activity-log-fix branch from 4a71de2 to 5af3a24 Compare October 20, 2023 12:28
@github-actions github-actions bot temporarily deployed to review_aks-8706 October 20, 2023 12:39 Destroyed
@inulty-dfe inulty-dfe temporarily deployed to review_aks October 20, 2023 12:40 — with GitHub Actions Inactive
@inulty-dfe inulty-dfe force-pushed the 33-ca-highlight-candidate-application-edits-on-manage-with-activity-log-fix branch from 5af3a24 to 359cc44 Compare October 20, 2023 15:31
@github-actions github-actions bot temporarily deployed to review_aks-8706 October 20, 2023 15:36 Destroyed
@inulty-dfe inulty-dfe temporarily deployed to review_aks October 20, 2023 15:36 — with GitHub Actions Inactive
@inulty-dfe inulty-dfe force-pushed the 33-ca-highlight-candidate-application-edits-on-manage-with-activity-log-fix branch from 359cc44 to 9a1b9f8 Compare October 23, 2023 09:04
@inulty-dfe inulty-dfe temporarily deployed to review_aks October 23, 2023 09:09 — with GitHub Actions Inactive
@inulty-dfe
Copy link
Collaborator Author

@github-actions github-actions bot temporarily deployed to review_aks-8706 October 23, 2023 09:13 Destroyed
@inulty-dfe inulty-dfe force-pushed the 33-ca-highlight-candidate-application-edits-on-manage-with-activity-log-fix branch from 9a1b9f8 to 2bbb8b7 Compare October 23, 2023 09:16
@github-actions github-actions bot temporarily deployed to review_aks-8706 October 23, 2023 09:24 Destroyed
@inulty-dfe inulty-dfe temporarily deployed to review_aks October 23, 2023 09:24 — with GitHub Actions Inactive
@inulty-dfe inulty-dfe force-pushed the 33-ca-highlight-candidate-application-edits-on-manage-with-activity-log-fix branch from 2bbb8b7 to 680aaff Compare October 23, 2023 10:47
@inulty-dfe inulty-dfe temporarily deployed to review_aks October 23, 2023 10:53 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to review_aks-8706 October 23, 2023 11:00 Destroyed
@inulty-dfe inulty-dfe marked this pull request as ready for review October 23, 2023 11:03
@github-actions github-actions bot temporarily deployed to review_aks-8706 October 23, 2023 11:20 Destroyed
@inulty-dfe inulty-dfe temporarily deployed to review_aks October 23, 2023 11:20 — with GitHub Actions Inactive
@inulty-dfe inulty-dfe force-pushed the 33-ca-highlight-candidate-application-edits-on-manage-with-activity-log-fix branch from f03248f to b0c0d30 Compare October 23, 2023 12:34
@inulty-dfe inulty-dfe requested review from a team and removed request for a team October 23, 2023 12:35
@github-actions github-actions bot temporarily deployed to review_aks-8706 October 23, 2023 12:38 Destroyed
Copy link
Collaborator

@tomas-stefano tomas-stefano left a comment

Choose a reason for hiding this comment

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

Excellent work. ✌️ Let me know your thoughts ✌️

user = event.user_full_name
candidate = event.candidate_full_name

case event.application_status_at_event
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we do something similar like:

    t("provider_interface.activity_log.application_choice.#{event_name}")

And then on event_name we could do:

def event_name
  return event.application_status_at_event if event.application_status_at_event.in?(application_status_list)

  # changes attribute ...
end

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure I've implemented it the way you described but I've made it less painful to look at and hopefully easier to understand. Translations included

app/models/application_form.rb Show resolved Hide resolved
@MaeveRoseveare MaeveRoseveare self-requested a review October 23, 2023 14:38
Copy link
Contributor

@MaeveRoseveare MaeveRoseveare left a comment

Choose a reason for hiding this comment

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

This looks great! Those anchor links to the right section are pure class! :)

  Mapping accepts a list of sections and returns the relevant database
  columns for `.by_section'

  Mapping accepts a list of database columns and returns a list of
  corresponding sections for `.by_columns`
  Some Audits cannot store a reference to an application choice. We must
  return the application choice id from the join when we query.

  When the query returns Audits for ApplicationForm, we only want to
  return those Audits whose audit_changes are a subset of a whitelist of
  columns. The app is only tracking audits where personal_information,
  contact_information, disability_disclosure and interview_preferences
  are changed.
  Polymorphise `ActivityLog#event_description` to handle all possible
  Autids
@inulty-dfe inulty-dfe force-pushed the 33-ca-highlight-candidate-application-edits-on-manage-with-activity-log-fix branch from b0c0d30 to c96e21d Compare October 24, 2023 08:45
@inulty-dfe inulty-dfe temporarily deployed to review_aks October 24, 2023 08:52 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to review_aks-8706 October 24, 2023 08:55 Destroyed
@inulty-dfe inulty-dfe force-pushed the 33-ca-highlight-candidate-application-edits-on-manage-with-activity-log-fix branch from c96e21d to b741cbe Compare October 24, 2023 09:13
@inulty-dfe inulty-dfe temporarily deployed to review_aks October 24, 2023 09:29 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to review_aks-8706 October 24, 2023 09:41 Destroyed
@github-actions github-actions bot temporarily deployed to review_aks-8706 October 24, 2023 10:14 Destroyed
@inulty-dfe inulty-dfe temporarily deployed to review_aks October 24, 2023 10:14 — with GitHub Actions Inactive
@inulty-dfe inulty-dfe force-pushed the 33-ca-highlight-candidate-application-edits-on-manage-with-activity-log-fix branch from 42f441d to 134465a Compare October 24, 2023 10:25
@github-actions github-actions bot temporarily deployed to review_aks-8706 October 24, 2023 10:33 Destroyed
@inulty-dfe inulty-dfe temporarily deployed to review_aks October 24, 2023 10:33 — with GitHub Actions Inactive
Copy link
Collaborator

@tomas-stefano tomas-stefano left a comment

Choose a reason for hiding this comment

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

✌️ 🚀

@inulty-dfe inulty-dfe merged commit ab9cc64 into main Oct 25, 2023
60 checks passed
@inulty-dfe inulty-dfe deleted the 33-ca-highlight-candidate-application-edits-on-manage-with-activity-log-fix branch October 25, 2023 08:14
@inulty-dfe inulty-dfe temporarily deployed to review_aks October 25, 2023 08:14 — with GitHub Actions Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy_v2 Deploy the review app to AKS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants