-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #485 from adhocteam/main
Requested changes to the TTA Overview widgets - add non-grantees, combine tta hours, fix region order
- Loading branch information
Showing
14 changed files
with
157 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* eslint-disable no-restricted-syntax */ | ||
/* eslint-disable no-loop-func */ | ||
import { Op } from 'sequelize'; | ||
import { auditLogger } from '../logger'; | ||
import { ActivityReport, ActivityRecipient, NonGrantee } from '../models'; | ||
|
||
const hubNonGrantees = { | ||
HSCO: 'Head Start Collaboration Office', | ||
'Local/State Education System': 'State Education System', | ||
'State Early Learning System / Guidelines': 'State Early Learning Standards', | ||
'State Advisory Council': 'QRIS System', | ||
'Regional TTA Team / Specialists': 'Regional TTA/Other Specialists', | ||
'State Early Learning Standards / Guidelines': | ||
'State Early Learning Standards', | ||
}; | ||
|
||
const populateLegacyNonGrantees = async () => { | ||
const nonGranteeReports = await ActivityReport.findAll({ | ||
where: { | ||
[Op.and]: [ | ||
{ legacyId: { [Op.ne]: null } }, | ||
{ | ||
imported: { | ||
nonGranteeActivity: { | ||
[Op.ne]: '', | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
}); | ||
|
||
for await (const nonGranteeReport of nonGranteeReports) { | ||
const nonGranteeArray = nonGranteeReport.imported.nonGranteeActivity.split( | ||
'\n', | ||
); | ||
for await (const nonGranteeName of nonGranteeArray) { | ||
const translatedNonGranteeName = hubNonGrantees[nonGranteeName] || nonGranteeName; | ||
const nonGrantee = await NonGrantee.findOne({ | ||
where: { name: translatedNonGranteeName }, | ||
}); | ||
if (nonGrantee) { | ||
auditLogger.info( | ||
`Processing non-grantee ${nonGrantee.id} for activity report ${nonGranteeReport.id}`, | ||
); | ||
await ActivityRecipient.findOrCreate({ | ||
where: { | ||
activityReportId: nonGranteeReport.id, | ||
nonGranteeId: nonGrantee.id, | ||
}, | ||
}); | ||
} | ||
} | ||
} | ||
}; | ||
|
||
export default populateLegacyNonGrantees; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import populateLegacyNonGrantees from './populateLegacyNonGrantees'; | ||
import { auditLogger } from '../logger'; | ||
|
||
populateLegacyNonGrantees().catch((e) => { | ||
auditLogger.error(e); | ||
process.exit(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters