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

#4013 - Legacy Restriction Mapping - Student Changes #4049

Conversation

andrewsignori-aot
Copy link
Collaborator

@andrewsignori-aot andrewsignori-aot commented Dec 7, 2024

  • Prevent API from retuning 'No effect' notifications since they are not supposed to be notified to the student.
  • Consolidated LGCY_* restrictions into a single LGCY restriction code to be returned to the student. The error code returned will be the highest one present in the list of the LGCY_* being returned.
  • Create few LGCY_* in the DB seed to allow the E2E to use them.
    • Fixed the db:seed:test:clean that was not removing the create_history_entry function leading to an error when the DB was populated again.
    • Close Nestjs app (app.close()) to avoid the db:seed:test:clean and db:seed:test to be hanging and waiting.

Ministry visualization for the new legacy map

image

SQL to be manually added during release

INSERT INTO
    sims.sfas_restriction_maps (legacy_code, code, is_legacy_only)
VALUES
    ('TD', 'LGCY_TD', TRUE),
    ('B5', 'LGCY_B5', TRUE),
    ('B5A', 'LGCY_B5A', TRUE),
    ('B7', 'LGCY_B7', TRUE),
    ('SSD', 'LGCY_SSD', TRUE),
    ('Z2', 'LGCY_Z2', TRUE),
    ('M1', 'LGCY_M1', TRUE),
    ('SSRN', 'LGCY_SSRN', TRUE),
    ('B4', 'LGCY_B4', TRUE),
    ('Z1', 'LGCY_Z1', TRUE)

Verified

This commit was signed with the committer’s verified signature.
ViBiOh Vincent Boutour
@andrewsignori-aot andrewsignori-aot added SIMS-Api SIMS-Api Hotfix PR created for hotfix Web portal labels Dec 7, 2024
@andrewsignori-aot andrewsignori-aot self-assigned this Dec 7, 2024
@andrewsignori-aot andrewsignori-aot marked this pull request as ready for review December 9, 2024 21:14
@guru-aot guru-aot self-requested a review December 9, 2024 22:00
@dheepak-aot dheepak-aot self-requested a review December 9, 2024 22:18
Comment on lines +117 to +119
"LGCYAAAA",
"LGCYBBBB",
"LGCYCCCC",
Copy link
Collaborator

Choose a reason for hiding this comment

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

😂

code: studentRestriction.restriction.restrictionCode,
type: studentRestriction.restriction.notificationType,
}));
if (legacyRestrictions.length) {
const notificationOrder = Object.values(RestrictionNotificationType);
Copy link
Collaborator

@dheepak-aot dheepak-aot Dec 9, 2024

Choose a reason for hiding this comment

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

Suggestion. Will it be better to use a map instead of the order how enums are declared?

 const notificationOrderMap = {
        [RestrictionNotificationType.Warning]: 1,
        [RestrictionNotificationType.Error]: 2,
        [RestrictionNotificationType.NoEffect]: 3,
      };
      // If any legacy restriction is present, create a generic LGCY restriction
      // with the highest notification type.
      studentRestrictions.sort(
        (a, b) =>
          notificationOrderMap[b.restriction.notificationType] -
          notificationOrderMap[a.restriction.notificationType],
      );

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can see benefits in both ways.
Now that we do not have NoEffect anymore, maybe I can add a priority only to Error and Warning and the suggested code would be better and clear.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Adjusting as below.

/**
 * Restriction notifications priority order.
 * Priority 1 indicates the most important notification.
 */
const NOTIFICATION_PRIORITY_ORDER_MAP = {
  [RestrictionNotificationType.Error]: 1,
  [RestrictionNotificationType.Warning]: 2,
};
studentRestrictions.sort(
    (a, b) =>
      NOTIFICATION_PRIORITY_ORDER_MAP[a.restriction.notificationType] -
      NOTIFICATION_PRIORITY_ORDER_MAP[b.restriction.notificationType],
  );

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Code update, please take a look.

Copy link

sonarqubecloud bot commented Dec 9, 2024

Copy link

github-actions bot commented Dec 9, 2024

Backend Unit Tests Coverage Report

Totals Coverage
Statements: 22.02% ( 3728 / 16931 )
Methods: 10.13% ( 214 / 2112 )
Lines: 25.35% ( 3236 / 12766 )
Branches: 13.54% ( 278 / 2053 )

Copy link

github-actions bot commented Dec 9, 2024

E2E Workflow Workers Coverage Report

Totals Coverage
Statements: 65.43% ( 583 / 891 )
Methods: 59.26% ( 64 / 108 )
Lines: 68.54% ( 464 / 677 )
Branches: 51.89% ( 55 / 106 )

Copy link

github-actions bot commented Dec 9, 2024

E2E Queue Consumers Coverage Report

Totals Coverage
Statements: 84.39% ( 1238 / 1467 )
Methods: 84.51% ( 120 / 142 )
Lines: 85.61% ( 1053 / 1230 )
Branches: 68.42% ( 65 / 95 )

Copy link

github-actions bot commented Dec 9, 2024

E2E SIMS API Coverage Report

Totals Coverage
Statements: 67.09% ( 5799 / 8644 )
Methods: 65.05% ( 722 / 1110 )
Lines: 70.98% ( 4548 / 6407 )
Branches: 46.94% ( 529 / 1127 )

Copy link
Collaborator

@dheepak-aot dheepak-aot left a comment

Choose a reason for hiding this comment

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

Great Job. Thanks for catch to filter no effect restrictions. Looks good 👍

Copy link
Collaborator

@guru-aot guru-aot left a comment

Choose a reason for hiding this comment

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

LGTM, nice work @andrewsignori-aot

@andrewsignori-aot andrewsignori-aot merged commit fafd502 into hotfix/v2.1.1 Dec 9, 2024
21 checks passed
@andrewsignori-aot andrewsignori-aot deleted the feature/#4013-legacy-restriction-student-changes branch December 10, 2024 00:13
github-merge-queue bot pushed a commit that referenced this pull request Dec 11, 2024
Merge Hotfix V2.1.1 to Main

## What's Changed
* #4013 - Legacy Restriction Mapping - Migrations and SQL Changes by
@andrewsignori-aot in #4037
* #4041 - Ignore Cancelled Legacy Applications on SIMS Validations and
Calculations by @dheepak-aot in #4042
* #4013 - Legacy Restriction Mapping - Student Changes by
@andrewsignori-aot in #4049
* #4052 - Fix the legacy program year totals for program year limits by
@dheepak-aot in #4058

---------

Co-authored-by: Andrew Boni Signori <61259237+andrewsignori-aot@users.noreply.github.com>
Co-authored-by: Dheepak Ramanathan <54600590+dheepak-aot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants