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

Add activity log timeline #1261

Merged
merged 3 commits into from
Dec 24, 2024
Merged

Add activity log timeline #1261

merged 3 commits into from
Dec 24, 2024

Conversation

Nitemaeric
Copy link
Contributor

@Nitemaeric Nitemaeric commented Dec 23, 2024

Context

We need to show the timeline of activities support users have performed on sets of claims, such as processing payments, samplings, and clawbacks.

We encapsulate these events in Claims::ClaimActivity records.

Changes proposed in this pull request

  • Rename Claims::ActivityLogsController to Claims::ClaimActivitiesController to align with the Claims::ClaimActivity class.
  • Add some example activities to be displayed in the Claims timeline.

Guidance to review

  • The Sampling record is to show the example of how an activity associated with multiple files would look like. This code is intended to be updated in further PRs.

Screenshots

Claim Activities

CleanShot 2024-12-23 at 17 43 04@2x

Payments - Claims sent to ESFA example

CleanShot 2024-12-23 at 17 37 10@2x

Sampling - Claims sent to Providers example

CleanShot 2024-12-23 at 17 38 58@2x

@Nitemaeric Nitemaeric added the deploy A Review App will be created for PRs with this label label Dec 23, 2024
@Nitemaeric Nitemaeric self-assigned this Dec 23, 2024
@Nitemaeric Nitemaeric force-pushed the dd/add-activity-log-timeline branch from 7c7e7a2 to b919576 Compare December 23, 2024 16:34
Copy link

github-actions bot commented Dec 23, 2024

Review app track and pay deployed to https://track-and-pay-1261.test.teacherservices.cloud was deleted
Review app school placements deployed to https://manage-school-placements-1261.test.teacherservices.cloud was deleted

@Nitemaeric Nitemaeric force-pushed the dd/add-activity-log-timeline branch from b919576 to 6e7eeba Compare December 23, 2024 17:49
@Nitemaeric Nitemaeric force-pushed the dd/add-activity-log-timeline branch from 6e7eeba to 7285409 Compare December 23, 2024 21:43
@Nitemaeric Nitemaeric force-pushed the dd/add-activity-log-timeline branch from 7285409 to eada890 Compare December 23, 2024 22:12
@Nitemaeric Nitemaeric marked this pull request as ready for review December 23, 2024 22:28
@Nitemaeric Nitemaeric requested review from a team as code owners December 23, 2024 22:28
@claim_activity = Claims::ClaimActivity.find(params[:id])

if @claim_activity.sampling_uploaded?
@pagy, @provider_samplings = pagy(@claim_activity.record.provider_samplings.joins(:provider).order(providers: { name: :asc }))
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth moving some of this to a scope

Copy link
Contributor Author

@Nitemaeric Nitemaeric Dec 24, 2024

Choose a reason for hiding this comment

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

Good idea - resolved here: fixup! Show Claim Activities as a timeline

…imActivitiesController

This is to match the resource to the controller.

Previously, when the placeholder was introduced, the naming convention for ClaimActivity records was generalised as ActivityLog records for all kinds of activity. This was premature.
@Nitemaeric Nitemaeric force-pushed the dd/add-activity-log-timeline branch from 58254a9 to 0bd1bb8 Compare December 24, 2024 11:50
}

delegate :full_name, to: :user, prefix: true, allow_nil: true
>>>>>>> eada890e (Show Claim Activities as a timeline)
Copy link
Contributor

Choose a reason for hiding this comment

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

rebase issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@Nitemaeric Nitemaeric force-pushed the dd/add-activity-log-timeline branch from 0bd1bb8 to 9e30545 Compare December 24, 2024 11:52
<%= govuk_list type: :bullet do %>
<% case @claim_activity.action %>
<% when "payment_request_delivered", "clawback_request_delivered" %>
<li><%= govuk_link_to "Claims sent to ESFA", @claim_activity.record.csv_file %></li>
Copy link
Contributor

Choose a reason for hiding this comment

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

Do these links need to be no_visited_state: true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think they should, no. It is valuable to know if a file has been downloaded or not.

<li><%= govuk_link_to "Claims sent to ESFA", @claim_activity.record.csv_file %></li>
<% when "sampling_uploaded" %>
<% @provider_samplings.each do |provider_sampling| %>
<li><%= govuk_link_to provider_sampling.provider.name, provider_sampling.csv_file %></li>
Copy link
Contributor

Choose a reason for hiding this comment

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

Do these links need to be no_visited_state: true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think they should, no. It is valuable to know if a file has been downloaded or not.

<% if provider_samplings.offset(5).any? %>
<p class="govuk-body"><%= t(".showing", count: provider_samplings.limit(5).length, total_count: provider_samplings.count) %></p>

<%= govuk_link_to t(".view_all_files"), claims_support_claims_claim_activity_path(claim_activity) %>
Copy link
Contributor

Choose a reason for hiding this comment

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

Do these links need to be no_visited_state: true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is also valuable to know if the details page has been visited or not. It's not like an index page.

<ul class="app-timeline__documents">
<% provider_samplings.limit(5).each do |provider_sampling| %>
<li class="app-timeline__document-item">
<%= govuk_link_to provider_sampling.csv_file, class: "app-timeline__document-link" do %>
Copy link
Contributor

Choose a reason for hiding this comment

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

Do these links need to be no_visited_state: true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same here. I don't think they should. It is valuable to know if a file has been downloaded or not.

<% when "payment_request_delivered", "clawback_request_delivered" %>
<ul class="app-timeline__documents">
<li class="app-timeline__document-item">
<%= govuk_link_to claim_activity.record.csv_file, class: "app-timeline__document-link" do %>
Copy link
Contributor

Choose a reason for hiding this comment

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

Do these links need to be no_visited_state: true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same again here.

@Nitemaeric Nitemaeric force-pushed the dd/add-activity-log-timeline branch from 9e30545 to 6858458 Compare December 24, 2024 12:19
@Nitemaeric
Copy link
Contributor Author

provider_samplings { build_list(:provider_sampling, 7, sampling: nil) }
sets sampling to nil. This prevents an infinite loop when creating a provider_sampling or claims_sampling. The sampling on provider_sampling is set once the provider_sampling or sampling is saved.

@Nitemaeric Nitemaeric merged commit 27ec46b into main Dec 24, 2024
8 checks passed
@Nitemaeric Nitemaeric deleted the dd/add-activity-log-timeline branch December 24, 2024 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy A Review App will be created for PRs with this label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants