Closed srallen closed 6 years ago
@shaunanoordin I think this is ready for review. One last change is that I added the program filter to the student classroom request. The assignment POST works now with a successful 201 response, though, there's still one last API side bug with the new subject set getting the subjects in the POST linked. So far that appears to be an API only bug.
Noting that the subjects linking now works on the API.
I just remembered one thing that'll make things a bit weird: there's already a previous +"hardcode the selected Subjects for Assignments when on staging/development",_ code, hidden in AssignmentForm.jsx
. It does exactly what the new code does, and it looks like...
//TESTING: localhost uses 'Bacon' Zooniverse project for Subject IDs.
//WildCam Gorongosa has no Staging data that we can use to create Subjects.
//Therefore, we need to hardcode some Subject IDs.
//--------
if (!this.editMode() && window.location.hostname === 'localhost') {
newAssignment.subjects = [
'4077',
'4079',
'4078',
'4076',
'4080',
'4075',
];
}
//--------
OK, a few notes for this one:
AssignmentForm.handleSubmit()
(i.e. newAssignment.subjects = [...]
) because otherwise the AssignmentForm wouldn't validate.env
variable, just... just localhost, wtf.As a result, I'm marking the Bacon code as something that needs to be fixed separately from this PR.
It doesn't matter in practice, since the duplication just means that...
AssignmentForm.jsx
allows the Create/Edit Assignment form to be validated & submitted on staging/developmentassignment.js
allows Classroom API calls to work on staging/development
This updates the WG:L for the current API:
The assignment creation still isn't fully testable because as noted on slack, there's still an issue with the POST request failing permissions with Panoptes, however, the code itself could be reviewed in the interim.