Skip to content

Commit

Permalink
implement half-semester and online search terms
Browse files Browse the repository at this point in the history
  • Loading branch information
Highfire1 committed Jun 20, 2024
1 parent 0977687 commit db19889
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
17 changes: 14 additions & 3 deletions static/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,24 @@ <h1>Langara Course Planner</h1>

<br>

<p>This website uses information from the Langara website and BCTransferPlanner. Data for the last semester is retrieved every 30 minutes.</p>
<p>This website uses information from the Langara website and BCTransferPlanner. Data for the last semester is retrieved every hour.</p>

<p>You can also use AND, OR, and NOT operators in the search bar. You can search by subject, course code, location, class type, or by teacher.</p>

<p>VALID SEARCH TERMS:</p>
<ul>
<li>"online" - whether the course is fully online</li>
<li>"half-semester", "a", "b" - if the section is a half-semester section</li>
<li>"2ar", "2sc", "hum", "lsc", "sci", "soc", "ut" - whether the course fulfills a given attribute</li>
<li>"www", "lab", "lecture", "seminar" - whether a section has a given type of schedule</li>
<li>crn - the 5 digit crn of a section</li>
<li>subject - the 4 letter string of the subject</li>
<li>subject course_code - when a 4 letter string is given with numbers, we look for the exact course</li>
<li>time e.g. (1230, 1030, 1530) - 4 digit number which represents a time</li>

</ul>
<br>

<p>This website has been brought to you by Anderson Tseng in association with the Langara Computer Science Club.</p>
<p>This website has been brought to you by <a href="https://highfire1.github.io" target="_blank">Anderson Tseng</a> in association with the Langara Computer Science Club.</p>

<p>Please reach out if you have feedback!</p>
</body>
Expand Down
31 changes: 30 additions & 1 deletion static/js/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,25 @@ class Calendar {
})
}



else if (term == "half-semester") {
results.push({
type: "course.half-semester",
condition: storedCondition,
search: term
})
}


else if (term == "online") {
results.push({
type: "course.online",
condition: storedCondition,
search: term
})
}


else if (term.length == 4 && subjects.includes(term)) {
results.push({
Expand Down Expand Up @@ -489,7 +508,7 @@ class Calendar {
for (const s of search) {
console.assert(s.type != null && (s.condition == "NOT" || s.condition == "AND" || s.condition == "OR") && s.search != null, `something wrong with search ${s}`)

const valid_searches = ["fuzzy", "crn", "course.half", "schedule.type", "subject", "coursepartial", "course", "course.time", "course.attributes"]
const valid_searches = ["fuzzy", "crn", "course.half", "schedule.type", "subject", "coursepartial", "course", "course.time", "course.attributes", "course.half-semester", "course.online"]
console.assert( !(s.type in valid_searches), `something wrong with search ${s}`)

let searchResult = []
Expand Down Expand Up @@ -539,6 +558,16 @@ class Calendar {
searchResult = c_shown.filter(c => c.section[0].toLowerCase() == s.search).map(c => c.id)
}

else if (s.type == "course.half-semester") {

searchResult = c_shown.filter(c => c.section[0].toLowerCase() == 'a' || c.section[0].toLowerCase() == 'b').map(c => c.id)
}

else if (s.type == "course.online") {

searchResult = c_shown.filter(c => c.section[0].toLowerCase() == 'w').map(c => c.id)
}

else if (s.type == "subject") {
searchResult = c_shown.filter(c => c.subject == s.search).map(c => c.id)
}
Expand Down

0 comments on commit db19889

Please sign in to comment.