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

SDI-226: ♻️ Switch to new suspended activities endpoint #2187

Merged
merged 2 commits into from
Jun 10, 2022

Conversation

petergphillips
Copy link
Contributor

No description provided.

activity.bookingId === attendance.bookingId &&
moment(activity.startTime).format('YYYY-MM-DD') === attendance.eventDate &&
activity.eventId === attendance.eventId
(attendance) => activity.eventId === attendance.eventId
Copy link
Contributor Author

Choose a reason for hiding this comment

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

eventId is the primary key for an activity anyway, so no need to filter by extra criteria

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The EVENT_ID comes from the OFFENDER_COURSE_ATTENDANCES table. I think the confusion arises since in order to join to that table one needs to:

              JOIN OFFENDER_COURSE_ATTENDANCES OCA ON OCA.OFFENDER_BOOK_ID = OPP.OFFENDER_BOOK_ID AND
                    OCA.EVENT_DATE = CS.SCHEDULE_DATE AND
                    OCA.CRS_SCH_ID = CS.CRS_SCH_ID

so if we had a courseScheduleId instead we would need to use all three fields.

I have confirmed this by calling the activities-by-date-range endpoint for a period of a week and checking that each activity has a different event id.

firstName: 'Offender',
lastName: 'Four',
comment: 'Cleaner',
suspended: false,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was previously being filtered in the typescript, but no need now as Prison API only returns the suspended ones

@@ -696,7 +684,7 @@ describe('Attendance reason statistics', () => {
comments: 'Did not ask nicely',
},
{
eventId: 4,
eventId: 5,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

had to change the eventId here as the values are unique in the database

@@ -65,6 +65,7 @@ module.exports = (on) => {
auth.stubUserMe(username, 12345, 'James Stuart', caseload),
prisonApi.stubUserCaseloads(caseloads),
tokenverification.stubVerifyToken(true),
keyworker.stubKeyworkerMigrated(),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was annoying me as was causing all signins to display the sorry page instead of the home page

Copy link
Contributor

@andymarke andymarke left a comment

Choose a reason for hiding this comment

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

Lgtm

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.

2 participants