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

BC-4343 - SJW - Disable Transfer Period in all instances #4372

Merged
merged 2 commits into from
Sep 1, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions scripts/startNewSchoolYear.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ const federalStateModel = require('../src/services/federalState/model');

const exceptFederalStateNames = [''];

const NEXT_SCHOOL_YEAR = '2022/23';
const MAINTENANCE_START_DATE = new Date('2022-08-01');
const CURRENT_SCHOOL_YEAR = '2022/23';
const NEXT_SCHOOL_YEAR = '2023/24';
const MAINTENANCE_START_DATE = new Date('2023-08-01');

appPromise
.then(async () => {
const currentSchoolYearId = await yearModel.findOne({ name: CURRENT_SCHOOL_YEAR }).select('_id').lean().exec();
const nextSchoolYearId = await yearModel.findOne({ name: NEXT_SCHOOL_YEAR }).select('_id').lean().exec();

const federalStates = await federalStateModel
Expand All @@ -30,6 +32,8 @@ appPromise
{
federalState: { $in: federalStateIds },
ldapSchoolIdentifier: { $exists: true },
inMaintenanceSince: { $exists: false },
currentYear: currentSchoolYearId._id,
},
{ inMaintenanceSince: MAINTENANCE_START_DATE }
)
Expand All @@ -40,7 +44,7 @@ appPromise
.updateMany(
{
federalState: { $in: federalStateIds },
ldapSchoolIdentifier: { $exists: false },
$or: [{ ldapSchoolIdentifier: { $exists: false } }, { ldapSchoolIdentifier: '' }],
Copy link
Contributor

Choose a reason for hiding this comment

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

we could also add here currentSchoolYear condition
currentYear: currentSchoolYearId._id instead of (or in addition to) currentYear: { $exists: 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.

Good point to do it similarly to the above situation for LDAP schools.
Why this is different here was my idea to basically adjust every school so no "remainers" are left behind.

For LDAP I wanted it to be more specific because there is more stuff that could go wrong.

currentYear: { $exists: true },
},
{ currentYear: nextSchoolYearId._id }
Expand Down