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

Staff f22: Add job to update MongoDB for a single quarter / subject area #22

Merged
merged 28 commits into from Nov 23, 2022

Conversation

pconrad
Copy link
Contributor

@pconrad pconrad commented Nov 22, 2022

Overview

In this PR, we roll out a new feature that allows admins to update a MongoDB database with course information via an asynchronous job.

The intent is for this new feature to open up several new lines of development, especially for the -1 teams on courses:

Especially, this opens up the possibility to develop searches that are not supported by the UCSB Courses API, such as search by course (over multiple quarters) and search by instructor (over multiple quarters.)

It also opens up the possibility to add similar jobs that will:

  • load all subject areas in a given quarter.
  • load all subject areas over a range of quarters.

User Story

As an admin

  • I can specify a quarter and a subject area and launch a job that loads data for that quarter and subject area into the MongoDB database
  • So that developers can work on queries that require such a database

How to Test / Use this feature

Here's an outline, followed by some animations

  1. Configure your app for a fresh MongoDB database; go see the data that is loaded
  2. Login as an admin
  3. Go to Admin / Load Subjects to make sure that the subject areas are loaded (this only needs to be done once)
  4. Go to Admin / Manage Jobs
  5. Specify Update Course Data
  6. Specify quarter and subject area
  7. Click "Update"
  8. Wait for job to finish. It should report how many courses were loaded or updated
  9. See results in MongoDb

Step 1: See MongoDB data:

This animation shows how to look at and do queries on MongoDB data:

see-mongodb-data

Steps 2-3: Login as Admin, Load Subjects

load-subjects

Steps: 4-8: Running the job and waiting for it to finish (in this case, MATH courses in W23):

load-course-data

Step 9: See the MATH courses

The query is:

{ 'courseInfo.quarter' : '20231', 'courseInfo.courseId': { $regex: /MATH/ }}

see-math-courses

This adds the ability to submit asynchronous jobs in the backend,
including one demonstration test job.  Tests are included as well.
backend tests failed due to missing @AutoConfigureDataJpa annotation
frontend tests had issues here and there
needed because we added the annotation that does automatic updatedAt createdAt attributes
to each entity
We need to both generate and store these dates with their
time zone, so that they get reported consistently regardless
of whether the server's local time is Pacific, Eastern, GMT or whatever
It was tripping up mutation testing
Also adds ability for Storybooks to do some limited mocking of apis
It is internal to React and not exposed, so it cannot be tested
@pconrad pconrad changed the title Staff f22 pc course job mongodb part Staff f22: Add job to update MongoDB for a single quarter / subject area Nov 22, 2022
@pconrad pconrad force-pushed the staff-f22-pc-course-job-mongodb-part branch from 142aa4c to 4f842c4 Compare November 23, 2022 00:38
@pconrad pconrad temporarily deployed to f22-5pm-1-courses November 23, 2022 01:49 Inactive
@pconrad pconrad merged commit 7c04667 into main Nov 23, 2022
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.

None yet

1 participant