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

i_900: add support for multiple groups per team #909

Merged
merged 28 commits into from
Feb 9, 2024

Conversation

johnbrvc
Copy link
Collaborator

@johnbrvc johnbrvc commented Jan 7, 2024

Description of what the PR does

This PR provides built-in support for an account to belong to multiple groups, instead of just one. The allows per-group display of standings, scoreboard generation and report generation.

The following changes were made to support multiple groups:

  1. Add HashSet<ElementId> groupIds to Account object - this is a hash table containing all groups the account is a member of
  2. Rename the old group id to primaryGroupId which is now the single CMS supplied group ID. These is currently used by several unit tests, and the DSA/NSA for group ranking. (Note: Group ranking has to be fixed so it ranks the team for each group the team is a member of. This is a non-trivial change).
  3. Add methods to Account to support adding a group to an account, fetching the groups for an account, clearing the groups.
  4. Change PC2 API ITeam, ITeamImplementation to support multiple groups for the PC2 api (WTI) interface.
  5. Change NSA to add all groups to generated XML for standings
  6. PacketFormatter shows all groups for an account.
  7. In ContestXML, when generating contest xml, add all groups for each account
  8. In ExportAccounts, include all groups for each account
  9. Change ICPCAccount to support multiple groups, although currently, only one is ever present in an ICPC "tab" file. Change made for consistency.
  10. Change ICPCImportData to pass all groups when creating an ICPCAccount
  11. Fix Account report generation to include all groups the team is a member of in the report
  12. Add support in ScoreboardUtilities to support multiple groups for routines that previously only checked one group per account.
  13. Add method getGroupFilteredRuns() to ScoreboardUtilities to return runs appropriate for selected groups only. (used by DSA/NSA)
  14. Change JSONTool to generate multiple groups per account
  15. In PacketHandler, change the routine that calculates which problems a team can see (it's now based on multiple groups, not just one)
  16. Change LoadAccounts to accept a CSV list of groups on importing accounts instead of just a single group.
  17. In CLICSAwardUtilities, change getGroupForTeam to getGroupsForTeam
  18. In InternalContest, change addProblem to account for all groups the team belongs to
  19. ProblemGroupAssignmentReport was changed to check all groups for a team.
  20. In EventFeedXML, EventFeedXML2013 and ResolverEventFeedXML add all groups a team is a member of to XML feed as separate group tags
  21. In TeamData, use renamed primaryGroupId - it's ok to only support one group here since this is a legacy feed object
  22. In ICPCTSVLoader, when processing teams.tsv, teams2.tsv, accept CSV list of groups in the group field.
  23. Many copyright date changes to 2024
  24. Modified AccountsPane and AccountsTablePane to show all groups a team is a member of in the Groups column.
  25. Add support to EditAccountPane to allow the selection of multiple groups for an account using checkboxes (still dome code that is commented out that needs to be deleted before approval)
  26. Change ReviewAccountLoad to show multiple groups correctly, and to detect changes properly in groups.
  27. Many JUnit tests changed to support and test multiple group support
  28. In DSA and NSA, allow standings to be calculated for a given set of groups. For now, maintain divisionNumber as well for WTI.
  29. Update StandingsTablePane and StandingsHTMLPane to allow selection of which groups to show the standings for on thick client standings panes.
  30. Update ScoreboardView, ScoreboardModule and related classes to deal with multiple groups. Scoreboards are genereated for every group marked as "show on scoreboard". Files are created with the group name embedded in the file name.
  31. Added report filtering by group (useful for generating event feeds for specific groups)
  32. Added event feed filtering by group as well (as a result of 31.)
  33. Added streaming event feed filtering by queryparam: groupids=cmsid1,cmsid2,...
  34. CI: added cacerts.pc2 to .gitignore
  35. CI: Various modules had extra spaces removed at ends of lines
  36. CI: Various modules had @overrides added on inherited methods
  37. CI: Eclipse removed dunsel typecasts in NSA module, EventFeedXML
  38. CI: optimizations made - hash tables instead of linear searches
  39. CI: Spelling errors in member variable names and method names fixed.

TODO:

  1. Testing
  2. Testing
  3. Testing
  4. Testing
  5. Testing

Issue which the PR addresses

Partial implementation #900

Environment in which the PR was developed (OS,IDE, Java version, etc.)

Windows 11
Java 1.8.0_321

Precise steps for testing the PR (i.e., how to demonstrate that it works correctly)

Where to start?
Everything that deals with accounts has to be tested: AccountTablePane, Standings, HTML Standings, Editing accounts, Editing groups, scoreboards, reports, problems, ...
More to come on this once complete.

@johnbrvc johnbrvc added enhancement New feature or request high priority Bugs that are high priority (to fix) CI - Continuous Improvement Continuously improve pc2 code quality, features and testing Comments/Analysis Requested Soliciting comments and feedback from the Team about how to implement issue In PR code review NEXT Contest Consider fixing for next contet labels Jan 7, 2024
@johnbrvc johnbrvc added this to the 9.10.0 milestone Jan 7, 2024
@johnbrvc johnbrvc requested review from troy2914 and clevengr January 7, 2024 03:32
@johnbrvc johnbrvc self-assigned this Jan 7, 2024
Copy link
Contributor

@troy2914 troy2914 left a comment

Choose a reason for hiding this comment

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

Generally code looks good, the whole file source formatting is a pain to review.

@johnbrvc johnbrvc requested a review from troy2914 January 7, 2024 23:11
Copy link
Contributor

@troy2914 troy2914 left a comment

Choose a reason for hiding this comment

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

What's here so far seems okay. And build is succeeding now.

Copy link
Contributor

@troy2914 troy2914 left a comment

Choose a reason for hiding this comment

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

These changes look good to me.

@johnbrvc johnbrvc force-pushed the i_900_multiple_groups_per_team branch from 48cb057 to cc2542f Compare January 15, 2024 18:24
Copy link
Contributor

@troy2914 troy2914 left a comment

Choose a reason for hiding this comment

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

getting closer.

Copy link
Contributor

@troy2914 troy2914 left a comment

Choose a reason for hiding this comment

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

These changes seem reasonable, but did not address any of my complaints about the previous commits.

Copy link
Contributor

@troy2914 troy2914 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 to me.

@troy2914
Copy link
Contributor

just lookin at the results_D1.xml, I think we need to add a attribute to the standingsHeader to show what the xml is showing.. like group_D1 or something.

Adding support for teams in multiple groups.
The CMS currently allows only 1 group (site) to be defined per use.  We remember which group was the one provided by the CMS.  This is used for display format substitution for team names that want to include the group.
TODO: When the CMS supports multiple groups (sites) per user, the display format substitution routine will have to be modified, or, the ability to add a group to the display name will have to be removed.
Huge commit finishing off implementing multiple groups / team.
Fixed several spelling errors in Unit Tests.
Fixed bug in InternalContestTest.java (wrong variable string2 used)
A couple of efficiency CI's: HashSet's instead of Vectors.
First round of test - viewing, editing and saving account groups from GUI. Works.
The self-signed API certificate should not be in the repo.
Still needs a bit of cleanup on the gui, but nominally works.  Need to fix HTML standings as well.
Fixed some copyright comments.
Removed extra spaces at ends of lines
Removed dunsel code
Consolidated some scoring methods to ScoreboardUtilities

Note: in DSA and NSA, groupRank is only computed for the primary group (CMS group).  This should be changed to compute the rank for each group the team is a member and save it in the standingsRecord.  Then, in the XML create a groupinfo element for each group the team is in contain it's group rank for that group.  See addGroupRow in NSA.
Allow showing standings on StandingsHTMLPane based on group (checkboxes).
Code cleaup on StandingsTablePane.
During the PR workflow, a couple of junit errors were found as a result of the new group code.  These have been fixed.
Update copyright date notices.
Delete unused code.
Delete $Id strings
… groups

Generate scoreboards for all groups that are marked for "show on scoreboard" by appending "_GROUP" to the base name.  eg.  index.html -> index_D1.html.
Groupnames were not generated properly if used in a substitute var.
Allow all group names to be used as substitute vars even if not explicitly shown on scoreboard.
Unit testing generates lots of files that should  not be included by git.  Add these exceptions to .gitignore.
Add canView(gouprlist) to Problem class.  Checks if the problem is visibil3 by any group in the list.
In scoring algorithms, call canView(grouplist) using wanted groups for the scoreboard.  Note that null for wanted groups means "everything" is shown (all problems).
Fix ambiguity with using 'null' as argument to Problem.canView(obj).
Add unit tests for test testing problem visibility for a List<> of groups.
Add group filtering to the Filter class.  This allows reports to be filtered by group.  Particularly useful on the event feed json report (for resolver).
Note that if a Filter has group filtering enabled, this will apply group filtering to accounts and problems, even if the filter is not explicitly filtering by account or problem.  This is logical.
There was a longstanding bug where if a team was not a member of a group that ended in D#, the scoreboard (DSA) would cause a NPE and never generate a scoreboard.  This was because a null is returned as the 'div' if the group (or now groups) the team is in is not a "Division" group (*D1, *D2, ...)
Fixed bug with wrong variable check in loop for groupname.
Update some copyright dates.
Fix some cut&paste comment errors.
Previously, only the since group in the filter for the event feed was included in the event feed "groups".  In reality, any groups that the filtered teams belong to should also be included in the event feed.  Consider a team that is a member of groups D1, Oregon, Oregon-D1 and we filter the Eventfeed by group D1.  There were no entries in the eventfeed for Oregon nor Oregon-D1, even thought the team was a member of these.   This fix includes those "groups" entries in the eventfeed.
@johnbrvc johnbrvc force-pushed the i_900_multiple_groups_per_team branch from 75cc40b to 6a85192 Compare January 27, 2024 21:24
… in standings xml

There needed to be a way to indicate which group(s) a particular standings XML tree was generated for.
The dumpGroupList() method now adds an attribute, included, indicating if the particular group is included in the XML standings.
@troy2914
Copy link
Contributor

just lookin at the results_D1.xml, I think we need to add a attribute to the standingsHeader to show what the xml is showing.. like group_D1 or something.

we discussed this and opted the included=1 on the grouplist/group

Adding multiple group support necessitates added support for a remote client requesting the event feed to specify which group(s) they want the feed for.  Added support in the (already existing) EventFeedFilter to support multiple group filtering, in addition to the already existing starting event id (token) and record types.
Added query param to event-feed caleld "groupids" which is a comma-separated list of cms group id's to filter the EF by.
CI: Change System.out.println's to 'info()' calls which also logs the messages.
CI: print more descriptive message when a client connects (like who they are)
CI: improved efficiency of filtering the event feed by avoiding (as much as possible Regular Expression usage.
CI; Fixed spelling error for a unit test (testgetEventFeedEequence->testgetEventFeedSequence
Unit tests found some oversights (ie bugs) in the code.
Fixed what it found so far.
Copy link
Contributor

@troy2914 troy2914 left a comment

Choose a reason for hiding this comment

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

new changes seem reasonable to me.

Incorrect clarifications were being returned on the EventFeed since the test for clars from specific teams was backwards.
@johnbrvc
Copy link
Collaborator Author

johnbrvc commented Feb 9, 2024

From @SamanwaySadhu on slack:

9:50 PM
I've already gone through the code changes for the i900 branch and it looks good to me

@johnbrvc johnbrvc merged commit 11aa59a into pc2ccs:develop Feb 9, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI - Continuous Improvement Continuously improve pc2 code quality, features and testing Comments/Analysis Requested Soliciting comments and feedback from the Team about how to implement issue enhancement New feature or request high priority Bugs that are high priority (to fix) In PR code review NEXT Contest Consider fixing for next contet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants