Update exam clash detection in the Module search page#3678
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
@uyencfi is attempting to deploy a commit to a Personal Account owned by @nusmodifications on Vercel. @nusmodifications first needs to authorize it. |
|
Thanks for the PR! We'll test out scraper changes over the next few days and get back to you |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3678 +/- ##
=======================================
Coverage 54.52% 54.52%
=======================================
Files 274 274
Lines 6076 6085 +9
Branches 1455 1453 -2
=======================================
+ Hits 3313 3318 +5
- Misses 2763 2767 +4 ☔ View full report in Codecov by Sentry. |
|
Quick live test case:
|
|
Hey, it looks like the exam for CM2112 got changed to be 2.30pm instead of 1pm, which makes it match HSI2001, so it's no longer that good of a candidate for a test case. A valid test case still exists: Sem 1, SH5110 vs FE5222 That said, let me take a look and test some things with your query and get back to you -- it looks pretty good right now, but for one, I think the query is inverted! (i.e. "No Exam Clash" gives us courses which do have an exam clash) |
Context
Fix #3663Implementation
Given
timetable = [m1, m2, m3]which is the list of modules currently added in the timetable.To detect whether a module
Xclashes withtimetable:X.start == m.start(exact match) for each m in timetable(X.start < m.end) && (X.end > m.start)for each m in timetable. This is the condition for 2 intervals to overlap, see https://stackoverflow.com/questions/325933/determine-whether-two-date-ranges-overlap❗ However, the module struct only stores examStartTime (ISO timestamp, assuming UTC(?)) and examDuration (in minutes). Thus to get the endTime:
m.endcan be easily obtained sincemis a known value from the timetable.X.endis more difficult since we need to compute it on-the-fly inside the Elasticsearch query.The new Elasticsearch query I have looks like
TBD
examStartTimereally stored in Elasticsearch in UTC or UTC+08?