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

Match progress report - support for duplicates program names #894

Open
wants to merge 5 commits into
base: release-71
Choose a base branch
from

Conversation

eanders
Copy link
Contributor

@eanders eanders commented Dec 23, 2024

Merging this PR

  • use the squash-merge strategy for PRs targeting a release-X branch

Description

  • Fixes an issue where programs and sub-programs with exactly the same names were prevented from showing up in the match progress report

Type of change

  • Bug fix

Checklist before requesting review

  • I have performed a self-review of my code
  • I have run the code that is being changed under ideal conditions, and it doesn't fail
  • I have updated the documentation (or not applicable)
  • I have added spec tests (or not applicable)
  • I have provided testing instructions in this PR or the related issue (or not applicable)

@eanders eanders changed the base branch from stable to release-71 December 23, 2024 20:11
@eanders eanders requested a review from ttoomey December 23, 2024 20:11
Copy link
Contributor

@ttoomey ttoomey left a comment

Choose a reason for hiding this comment

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

looks good!

@@ -19,7 +19,7 @@ def index
respond_to do |format|
format.html {}
format.xlsx do
@included_sub_programs = sub_program_list.invert.slice(*report_params[:sub_programs])
@included_sub_programs = sub_program_list.select { |sp| sp.last.in?(report_params[:sub_programs]) }
Copy link
Contributor

Choose a reason for hiding this comment

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

Just checking: we're confident that the sub_program_list ids are of the same type as report_params[:sub_programs] (strings / ints)?

This is totally fine as is; might be a little clearer to use filter instead of select and name the filtered vars.

Suggested change
@included_sub_programs = sub_program_list.select { |sp| sp.last.in?(report_params[:sub_programs]) }
@included_sub_programs = sub_program_list.filter { |_name, sp_id| sp_id.in?(report_params[:sub_programs]) }

Copy link
Contributor Author

@eanders eanders Dec 23, 2024

Choose a reason for hiding this comment

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

Thanks, I definitely like that syntax better.

And yes, double checked, ints all the way down.

[
[project_name, sub_project_name].join('|'),
id,
[sp[:program], sp[:sub_program], sp[:route]].compact_blank.join('|'),
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like using compact here introduces ambiguity around which names are for which type of entity. Maybe that doesn't matter unless something is parsing them out (for example this would be incorrect program, sub_program, route = name.split('|'))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just used for display, I'd rather turn this into a sentence or more descriptive text, but didn't want to mess with the wording too much until we confirm this works.

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