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

Dylans concentration update 512 #627

Merged
merged 4 commits into from
Oct 12, 2023
Merged

Conversation

dkd2101
Copy link
Contributor

@dkd2101 dkd2101 commented Oct 1, 2023

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Closes #512

Type of change

Please tick the boxes that best match your changes.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • This requires a run of yarn install
  • This has migration changes and requires a run of yarn dev:migration:run

How Has This Been Tested?

  • Using Postman
  • Manually tested

Postman Tests are described below.
This purpose of this bug fix is to ensure that users cannot create a plan with a concentration, and then switch majors without updating the concentration information. For example, let us say that there is a BSCS plan with AI concentration. Let us say that this person updates the plan to a CS & Business Admin, but does not update the concentration from AI. (CS & BA doesn't have AI concentration, but it has different concentrations).

Hit the Create Plan endpoint:
Request Body:

{
    "name": "Plan 2",
    "catalogYear": 2021,
    "major": "Computer Science, BSCS",
    "concentration": "Artificial Intelligence",
    "schedule": {
        "years": [
            {
                "year": 1,
                "fall": {
                    "season": "FL",
                    "status": "CLASSES",
                    "classes": [],
                    "id": null
                },
                "spring": {
                    "season": "SP",
                    "status": "CLASSES",
                    "classes": [],
                    "id": null
                },
                "summer1": {
                    "season": "S1",
                    "status": "INACTIVE",
                    "classes": [],
                    "id": null
                },
                "summer2": {
                    "season": "S2",
                    "status": "INACTIVE",
                    "classes": [],
                    "id": null
                },
                "isSummerFull": false
            },
            {
                "year": 2,
                "fall": {
                    "season": "FL",
                    "status": "CLASSES",
                    "classes": [],
                    "id": null
                },
                "spring": {
                    "season": "SP",
                    "status": "CLASSES",
                    "classes": [],
                    "id": null
                },
                "summer1": {
                    "season": "S1",
                    "status": "INACTIVE",
                    "classes": [],
                    "id": null
                },
                "summer2": {
                    "season": "S2",
                    "status": "INACTIVE",
                    "classes": [],
                    "id": null
                },
                "isSummerFull": false
            },
            {
                "year": 3,
                "fall": {
                    "season": "FL",
                    "status": "CLASSES",
                    "classes": [],
                    "id": null
                },
                "spring": {
                    "season": "SP",
                    "status": "CLASSES",
                    "classes": [],
                    "id": null
                },
                "summer1": {
                    "season": "S1",
                    "status": "INACTIVE",
                    "classes": [],
                    "id": null
                },
                "summer2": {
                    "season": "S2",
                    "status": "INACTIVE",
                    "classes": [],
                    "id": null
                },
                "isSummerFull": false
            },
            {
                "year": 4,
                "fall": {
                    "season": "FL",
                    "status": "CLASSES",
                    "classes": [],
                    "id": null
                },
                "spring": {
                    "season": "SP",
                    "status": "CLASSES",
                    "classes": [],
                    "id": null
                },
                "summer1": {
                    "season": "S1",
                    "status": "INACTIVE",
                    "classes": [],
                    "id": null
                },
                "summer2": {
                    "season": "S2",
                    "status": "INACTIVE",
                    "classes": [],
                    "id": null
                },
                "isSummerFull": false
            }
        ]
    }
}

Response body:

{
    "name": "Plan 2",
    "schedule": {
        "years": [
            {
                "year": 1,
                "fall": {
                    "season": "FL",
                    "status": "CLASSES",
                    "classes": [],
                    "id": null
                },
                "spring": {
                    "season": "SP",
                    "status": "CLASSES",
                    "classes": [],
                    "id": null
                },
                "summer1": {
                    "season": "S1",
                    "status": "INACTIVE",
                    "classes": [],
                    "id": null
                },
                "summer2": {
                    "season": "S2",
                    "status": "INACTIVE",
                    "classes": [],
                    "id": null
                },
                "isSummerFull": false
            },
            {
                "year": 2,
                "fall": {
                    "season": "FL",
                    "status": "CLASSES",
                    "classes": [],
                    "id": null
                },
                "spring": {
                    "season": "SP",
                    "status": "CLASSES",
                    "classes": [],
                    "id": null
                },
                "summer1": {
                    "season": "S1",
                    "status": "INACTIVE",
                    "classes": [],
                    "id": null
                },
                "summer2": {
                    "season": "S2",
                    "status": "INACTIVE",
                    "classes": [],
                    "id": null
                },
                "isSummerFull": false
            },
            {
                "year": 3,
                "fall": {
                    "season": "FL",
                    "status": "CLASSES",
                    "classes": [],
                    "id": null
                },
                "spring": {
                    "season": "SP",
                    "status": "CLASSES",
                    "classes": [],
                    "id": null
                },
                "summer1": {
                    "season": "S1",
                    "status": "INACTIVE",
                    "classes": [],
                    "id": null
                },
                "summer2": {
                    "season": "S2",
                    "status": "INACTIVE",
                    "classes": [],
                    "id": null
                },
                "isSummerFull": false
            },
            {
                "year": 4,
                "fall": {
                    "season": "FL",
                    "status": "CLASSES",
                    "classes": [],
                    "id": null
                },
                "spring": {
                    "season": "SP",
                    "status": "CLASSES",
                    "classes": [],
                    "id": null
                },
                "summer1": {
                    "season": "S1",
                    "status": "INACTIVE",
                    "classes": [],
                    "id": null
                },
                "summer2": {
                    "season": "S2",
                    "status": "INACTIVE",
                    "classes": [],
                    "id": null
                },
                "isSummerFull": false
            }
        ]
    },
    "major": "Computer Science, BSCS",
    "concentration": "Artificial Intelligence",
    "catalogYear": 2021,
    "student": {
        "uuid": "7db521be-a4f1-48aa-aa96-7f33d250d1be",
        "nuid": null,
        "fullName": null,
        "isOnboarded": false,
        "email": "aryan101@gmail.com",
        "isEmailConfirmed": false,
        "academicYear": null,
        "graduateYear": null,
        "catalogYear": null,
        "major": null,
        "coopCycle": null,
        "coursesCompleted": null,
        "coursesTransfered": null,
        "primaryPlanId": null,
        "concentration": null,
        "createdAt": "2023-09-24T23:50:52.257Z",
        "updatedAt": "2023-09-24T23:50:52.257Z"
    },
    "id": 13,
    "createdAt": "2023-10-01T23:31:02.372Z",
    "updatedAt": "2023-10-01T23:31:02.372Z"
}

Update Plan:
{{API_URL}}/{{PLANS}}/13
Request body:
{
    "name": "plan 2",
    "catalogYear": 2021,
    "major": "Computer Science and Business Administration, BS"
}

Response body:
{
    "statusCode": 500,
    "message": "Internal server error"
}

Checklist:

  • I have run the production builds in docker for the frontend/backend and ensure things run fine. Check README of repo on how to run if not sure.
  • I have performed a self-review of my own code
  • I have commented my code where needed
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Copy link
Contributor

@BrandonLim8890 BrandonLim8890 left a comment

Choose a reason for hiding this comment

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

LGTM! Just 1 small nit and one change I requested. Amend the changes, test one last time to ensure the changes didn't break anything and we can ship 🚢

packages/api-v2/src/plan/plan.service.ts Outdated Show resolved Hide resolved
packages/api-v2/src/plan/plan.service.ts Outdated Show resolved Hide resolved
…ck for valid concetrations last after valid catalogue years
@dkd2101 dkd2101 merged commit 0a4c3d5 into main Oct 12, 2023
4 checks passed
@dkd2101 dkd2101 deleted the dylans-concentration-update-512 branch October 12, 2023 20:29
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.

Fix: Validate concentration name when major/year is updated but concentration is not
3 participants