OpenTree-Education / rhizone-lms

A learning management system focused on self-reflection.
https://rhi.zone
BSD 3-Clause Clear License
14 stars 7 forks source link

Implement functionality for the GET / route and accompanying service file functions #551

Closed Awatanka closed 1 year ago

Awatanka commented 1 year ago

Describe the Feature / Enhancement

The GET / route needs to be implemented and fully tested. The GET / route gets a list of all assessments the user has access to, including each assessment's CurriculumAssessment, each assessment's ProgramAssessment, the user's role with that program (participant/facilitator), and (if participant) a summary of their submissions for that assessment or (if facilitator) a summary of all participants' submissions for that assessment.

There needs to be a test coverage for the GET / route and the service file functions it needs. We need to test this route to ensure the code written for the test will behave as expected by the protocol we previously defined.

This issue continues the work from issue #515.

Additional Details and Resources

This route requires the principal ID (the user ID) from the session information, and this route does not expect a body in the request. The response should contain the following:

Facilitator

const assessmentsList: AssessmentWithSummary[] = [{
  curriculum_assessment: CurriculumAssessment, (not including 'questions' member)
  program_assessment: ProgramAssessment,
  principal_program_role: 'Facilitator',
  facilitator_submissions_summary: FacilitatorAssessmentSubmissionsSummary,
}];

res.json(collectionEnvelope(assessmentsList, assessmentsList.length));

Participant

const assessmentsList: AssessmentWithSummary[] = [{
  curriculum_assessment: CurriculumAssessment, (not including 'questions' member)
  program_assessment: ProgramAssessment,
  principal_program_role: 'Participant',
  participant_submissions_summary: ParticipantAssessmentSubmissionsSummary,
}];

res.json(collectionEnvelope(assessmentsList, assessmentsList.length));

Correct Project Selected

Labels

Awatanka commented 1 year ago

EOD: changed function getAssessmentsSummary in service file according to changing the type of model ProgramAssessment; refactored function getAssessmentSubmissions; added first draft with functions to router file, Next steps:

Awatanka commented 1 year ago

EOD: changed function getAssessmentsSummary in the service file according to logic in router; changed tests for router get/; run tests and they were successful; started writing tests for service functions;

Plan for tomorrow:

Awatanka commented 1 year ago

EOD: updated router function according to models and logic of params-response in tests; fixed some minor issues in functions that were mocked in tests; tested router function and tests have passed (except 'Internal server error.' response ); cleaned up unnecessary code in service functions; added and improved descriptions for each function in service file; added and checked one test for service function principalEnrolledPrograms;

Plan for tomorrow:

Awatanka commented 1 year ago

EOD: analyzed router and service functions; check the route on Postman; check getCurriculumAssessmentById

Plan for tomorrow:

Awatanka commented 1 year ago

EOD:

Awatanka commented 1 year ago

EOD: improved tests for router function => tests passed; checked constructParticipantAssessmentSummary with all functions included; found some issues with query for constructParticipantAssessmentSummary => fixed function; added drafts for test functions constructParticipantAssessmentSummary and constructFacilitatorAssessmentSummary;

Plan for tomorrow: finish fixing tests before standup;