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

Migrate roads to new course numbers #476

Merged
merged 5 commits into from
May 2, 2022
Merged

Conversation

georgiashay
Copy link
Collaborator

Migrates roads to use the new course numbers. Currently this code will let the roads load in and wait until subjects are loaded to migrate to the new numberings - so your road will briefly show up with the old numbers before being migrated. I figured this was better than withholding the whole road until the catalog loads, but lmk if this is a bad idea.

@miriam-rittenberg
Copy link
Contributor

It seems like this transitions my current course numbers to the new ones, but if I then re-add eg 6.009 to a road it stays as 6.009 permanently. Is this the behavior we want / do we want it to still be possible to add the old course numbers at all?

@georgiashay
Copy link
Collaborator Author

Currently Fireroad keeps classes that aren't around anymore as "historical classes." I'm not sure what the right approach is.

@georgiashay
Copy link
Collaborator Author

I've thought about it and removing the old courses is probably the best approach. This will need a change on the server code, tracking in sipb/fireroad-server#31

@psvenk
Copy link
Member

psvenk commented Apr 30, 2022

This looks good overall, but it would be nice if:

  • Searching for subjects looks at old_id in addition to subject_id, so that, e.g., a search for "6.009" turns up 6.1010
  • The old subject ID is displayed in addition to the new one when opening the description for a subject.

@psvenk
Copy link
Member

psvenk commented Apr 30, 2022

Here is a patch for the first issue:

diff --git a/src/components/ClassSearch.vue b/src/components/ClassSearch.vue
index 70ff0c3..dafb99e 100644
--- a/src/components/ClassSearch.vue
+++ b/src/components/ClassSearch.vue
@@ -81,7 +81,7 @@ var unitsGte15 = new MathFilter('>15', '>15', [15, undefined], false, ['total_un
 var termFall = new BooleanFilter('Fall', 'FA', false, ['offered_fall']);
 var termIAP = new BooleanFilter('IAP', 'IAP', false, ['offered_IAP']);
 var termSpring = new BooleanFilter('Spring', 'SP', false, ['offered_spring']);
-var textFilter = new RegexFilter('Subject ID', 'ID', '', 'nameInput', ['subject_id', 'title'], 'OR');
+var textFilter = new RegexFilter('Subject ID', 'ID', '', 'nameInput', ['subject_id', 'title', 'old_id'], 'OR');
 var instructorFilter = new ArrayFilter('Instructor', 'Prof', RegexFilter, ['', 'nameInput'], ['instructors'], 'OR');
 
 export default {

@georgiashay
Copy link
Collaborator Author

Thanks for the catch, and the patch! Should be fixed now

@psvenk
Copy link
Member

psvenk commented Apr 30, 2022

Now that sipb/fireroad-server#31 has been merged, is this ready to merge (and deploy once that is deployed on production) or is further work needed?

@georgiashay
Copy link
Collaborator Author

I have a few bugs (prior credit not being transitioned, and vuex is upset at the way we are modifying the state), so I'm going to work on fixing those before merging.

@georgiashay georgiashay force-pushed the course-renumbering branch from b06255d to dd55de7 Compare May 1, 2022 18:09
@georgiashay
Copy link
Collaborator Author

Ready for another review

Copy link
Member

@psvenk psvenk left a comment

Choose a reason for hiding this comment

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

I'm not sure if I'm qualified to review this, but I tested it and it works great.

One thing that I noticed is that when running the old code (what is currently on master) with the new backend (what is currently on fireroad-dev.mit.edu), all Course 6 subjects are deleted because they are no longer listed on the backend. Assuming that the production backend will be updated no sooner than this is merged and deployed, I don't see this being an issue, but I just wanted to note it.

In the longer term, I think it would be good for CourseRoad to support custom subjects (to support cross-registration, for example, and generally to avoid having things disappear in cases like this), but I don't think this is necessary right now and it anyway won't address the (hopefully nonexistent) edge case above (because the new frontend already handles the newly missing subjects). We can split this out to a separate issue.

@georgiashay
Copy link
Collaborator Author

Are you seeing this behavior when loading roads already on your account, or when importing a road? Currently Courseroad can only import roads with classes it knows about (the new code migrates old courses -> new courses first). Regardless, yes we can deploy this before the backend.

We have wanted to support custom subjects for a while (and we do display them if you create them in the fireroad app). If you are interested, we have an open issue (#423) for this and we're always looking for more people to help out! We have a courseroad development channel in mattermost as well if you're interested.

@psvenk
Copy link
Member

psvenk commented May 2, 2022

I only tested with imported roads; it's good that this behavior (as a general thing) is only for imported roads. I did see that the migration is done before removing unknown courses, which is good.

Is there a technical reason why unknown subjects in general are deleted? (I assume that it won't be necessary once custom subjects are fully supported.)

Thanks for inviting me to Mattermost; I just joined the channel a few minutes ago. I would be happy to help with adding support for custom subjects when I have some more time on my hands.

@georgiashay
Copy link
Collaborator Author

The current reason why unknown subjects are deleted is that on import, we make sure that the road subjects have all the required fields and fill them in if they do not. If the subject is unknown, we don't know those values if they're not provided. This was I believe originally for compatibility in case of old road documents. A better idea might be to just set these fields to empty string/0/undefined/etc as appropriate.

@georgiashay georgiashay merged commit a7822a5 into master May 2, 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.

3 participants