Skip to content
Merged
Show file tree
Hide file tree
Changes from 63 commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
7667b09
add disciplines to course card
Jay-Lalwani Oct 7, 2024
0ad1d3f
add cost to section
Jay-Lalwani Oct 7, 2024
fe7ac42
first draft of enhanced search functionality
Jay-Lalwani Oct 22, 2024
c9f6cc8
working filtering
Jay-Lalwani Oct 23, 2024
941eb34
filter by subject working
Jay-Lalwani Oct 24, 2024
f7cd46c
working number of courses displayed
Jay-Lalwani Oct 24, 2024
12cf9f9
pylint
Jay-Lalwani Oct 24, 2024
9620634
fixes
Jay-Lalwani Oct 24, 2024
c17833d
small fix
Jay-Lalwani Oct 24, 2024
79d9ac4
more fixes for auto merge
Jay-Lalwani Oct 24, 2024
ff5fae9
lint
Jay-Lalwani Oct 24, 2024
ca78f65
lint
Jay-Lalwani Oct 24, 2024
fb6b542
filter by instructor, semester
Jay-Lalwani Oct 25, 2024
6fd531a
lint
Jay-Lalwani Oct 25, 2024
e155434
remove filtering by previous semesters
Jay-Lalwani Oct 25, 2024
8909ca1
Merge branch 'disciplines-csv' into enhanced-search
Jay-Lalwani Oct 27, 2024
9bd137b
Merge branch 'dev' into enhanced-search
ajnye Oct 27, 2024
f021aae
added a checkbox to filter the courses that displays only the course …
YuDavidCao Nov 10, 2024
342ba98
add SectionTime to models and filter it
Jay-Lalwani Nov 21, 2024
5e9af62
migration made
Jay-Lalwani Nov 21, 2024
6375846
merge dev
Jay-Lalwani Nov 21, 2024
2da6771
remove db file
Jay-Lalwani Nov 21, 2024
2f53d67
filter by day/time draft
Jay-Lalwani Nov 21, 2024
5c994c2
quick fix
Jay-Lalwani Nov 21, 2024
a4f2cb9
lint
Jay-Lalwani Nov 21, 2024
100fd90
fix
Jay-Lalwani Nov 21, 2024
a76d25d
fix
Jay-Lalwani Nov 21, 2024
1c816bc
Merge branch 'dev' into enhanced-search
Jay-Lalwani Jan 19, 2025
6331f9e
Merge branch 'dev' into enhanced-search
Jay-Lalwani Jan 20, 2025
edb7766
set time inputs to empty on Clear Filters
Jay-Lalwani Jan 20, 2025
38d4816
Merge branch 'dev' into enhanced-search
Jay-Lalwani Jan 20, 2025
9d4804a
make time ranges persist (sticky)
Jay-Lalwani Jan 20, 2025
180d6ab
remove debug statements
Jay-Lalwani Jan 20, 2025
ed1d3b3
revert browse.py
Jay-Lalwani Jan 21, 2025
e811b53
revert browse.html
Jay-Lalwani Jan 21, 2025
16bd774
combined fetch_courses and filter_courses into a single function and …
brianlogic Jan 26, 2025
c5a1cd5
fixed alignment issue on course.html and department.html
YuDavidCao Jan 26, 2025
c779136
Merge branch 'dev' into enhanced-search
Jay-Lalwani Jan 28, 2025
427c3ed
fixed department view dropdown filter bug
YuDavidCao Feb 2, 2025
54d5a2e
Merge branch 'dev' into enhanced-search
Jay-Lalwani Feb 2, 2025
4b351b8
Merge pull request #992 from thecourseforum/dev
brianlogic Feb 2, 2025
a181881
changed discipline alignment on course.html
YuDavidCao Feb 3, 2025
bd27f81
Merge branch 'enhanced-search' into enhanced-search-david
YuDavidCao Feb 3, 2025
97db1f7
Implemented UI updates for enhanced search menu.
brianlogic Feb 3, 2025
9724535
Merge branch 'dev' into enhanced-search
Jay-Lalwani Feb 3, 2025
ef2aa98
Merge branch 'enhanced-search' into enhanced_search_brian
Jay-Lalwani Feb 3, 2025
37e3f57
black formatting
Jay-Lalwani Feb 3, 2025
22ac398
Merge branch 'enhanced-search' into enhanced_search_brian
Jay-Lalwani Feb 3, 2025
d0d9cc9
format
Jay-Lalwani Feb 3, 2025
1a90d64
Merge branch 'enhanced-search' into enhanced-search-david
YuDavidCao Feb 3, 2025
990bfa8
Reverted search.py to back to enhanced-search
brianlogic Feb 3, 2025
b087817
Merge branch 'enhanced_search_brian' of https://github.com/thecoursef…
brianlogic Feb 3, 2025
dab75d3
change discipline delimeter from & to /
Jay-Lalwani Feb 3, 2025
33bba0f
Merge pull request #997 from thecourseforum/enhanced-search-david
Jay-Lalwani Feb 3, 2025
ef85cea
Merge pull request #996 from thecourseforum/enhanced_search_brian
Jay-Lalwani Feb 3, 2025
3b3f884
sticky subject & disciplines selection
Jay-Lalwani Feb 3, 2025
6117417
store filters ctx in session
Jay-Lalwani Feb 4, 2025
4acbfb4
Merge pull request #1006 from thecourseforum/mvp-enhanced-search
brianlogic Feb 9, 2025
5456286
fixed incorrect filtering when both query string and time filter pres…
YuDavidCao Feb 9, 2025
62b23ee
linting
YuDavidCao Feb 9, 2025
d94157d
more linting
YuDavidCao Feb 9, 2025
7db48ef
should be the last linting fix
YuDavidCao Feb 9, 2025
35d6aa5
Merge pull request #1007 from thecourseforum/time-with-query-filter-fix
ajnye Feb 9, 2025
94e5450
Merge pull request #1011 from thecourseforum/mvp-enhanced-search
brianlogic Feb 9, 2025
c6d95a3
Merge branch 'dev' into mvp-enhanced-search
ajnye Feb 9, 2025
67825e9
Merge pull request #1013 from thecourseforum/mvp-enhanced-search
brianlogic Feb 9, 2025
ebf9457
fixed reset button not resetting weekdays
YuDavidCao Feb 13, 2025
ef61525
made default weekday searches return past courses
YuDavidCao Feb 13, 2025
83f7fe0
minor ui fix
YuDavidCao Feb 13, 2025
c4d183e
striped search string
YuDavidCao Feb 13, 2025
d4b5ba3
small refactor on filtering by time
YuDavidCao Feb 16, 2025
3dff48e
added tooltip and beacon for filters button
brianlogic Feb 16, 2025
252740a
minor ui fix
YuDavidCao Feb 16, 2025
666bf80
fixed beacon blocking interaction with button and shortened tooltip
brianlogic Feb 16, 2025
5d45b68
removed shadow on button, adjusted border radius, extended inputs of …
brianlogic Feb 16, 2025
0250a2a
adjusted weekdays selection to class days to exclude and fixed div of…
brianlogic Feb 16, 2025
fb0af2f
changed filter time frontend + backend
YuDavidCao Feb 16, 2025
3d67464
Merge remote-tracking branch 'origin/enhanced-search-david' into enha…
brianlogic Feb 16, 2025
5c27869
fixed issue with beacon flashing
brianlogic Feb 16, 2025
123f8af
adjusted width of time selection
brianlogic Feb 16, 2025
390f6c8
Merge pull request #1015 from thecourseforum/enhanced-search-david
ajnye Feb 17, 2025
5c3e4ab
Merge branch 'dev' into mvp-enhanced-search
ajnye Feb 17, 2025
17e8a2c
Merge pull request #1016 from thecourseforum/enhanced_search_brian
ajnye Feb 18, 2025
e5ecb43
tooltip cleanup
Jay-Lalwani Feb 18, 2025
44e27a2
Merge branch 'dev' into mvp-enhanced-search
barrettruth Feb 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion tcf_core/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from django.conf import settings

from tcf_website.models import Semester
from tcf_website.models import Discipline, Semester, Subdepartment


def base(request):
Expand Down Expand Up @@ -41,3 +41,26 @@ def history_cookies(request):
"previous_path_titles": previous_paths_titles,
"previous_paths_and_titles": previous_paths_and_titles,
}


def searchbar_context(request):
"""Provide context for the search bar."""
latest_semester = Semester.latest()
recent_semesters = Semester.objects.filter(
number__gte=latest_semester.number - 50 # 50 = 5 years * 10 semesters
).order_by("-number")

# Get saved filters from the session (or use defaults)
saved_filters = request.session.get("search_filters", {})

context = {
"disciplines": Discipline.objects.all().order_by("name"),
"subdepartments": Subdepartment.objects.all().order_by("mnemonic"),
"semesters": recent_semesters,
"selected_disciplines": saved_filters.get("disciplines", []),
"selected_subdepartments": saved_filters.get("subdepartments", []),
"selected_weekdays": saved_filters.get("weekdays", ["MON", "TUE", "WED", "THU", "FRI"]),
"from_time": saved_filters.get("from_time", ""),
"to_time": saved_filters.get("to_time", ""),
}
return context
1 change: 1 addition & 0 deletions tcf_core/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"social_django.context_processors.login_redirect",
"tcf_core.context_processors.base",
"tcf_core.context_processors.history_cookies",
"tcf_core.context_processors.searchbar_context",
],
},
},
Expand Down
33 changes: 33 additions & 0 deletions tcf_website/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,38 @@ def get_queryset(self, request):
return qs


class SectionTimeAdmin(admin.ModelAdmin):
list_display = ["section", "get_days_display", "start_time", "end_time"]
list_filter = ["monday", "tuesday", "wednesday", "thursday", "friday", "start_time", "end_time"]
search_fields = [
"section__course__subdepartment__mnemonic",
"section__course__number",
"section__course__title",
]
autocomplete_fields = ["section"]

def get_days_display(self, obj):
"""Return formatted string of meeting days."""
days = []
if getattr(obj, "monday", False):
days.append("MON")
if getattr(obj, "tuesday", False):
days.append("TUE")
if getattr(obj, "wednesday", False):
days.append("WED")
if getattr(obj, "thursday", False):
days.append("THU")
if getattr(obj, "friday", False):
days.append("FRI")
return ", ".join(days)

get_days_display.short_description = "Days"

def get_queryset(self, request):
qs = super().get_queryset(request)
return qs.select_related("section__course__subdepartment")


class CourseGradeAdmin(admin.ModelAdmin):
ordering = ["course__subdepartment", "course__number", "course__title"]
search_fields = ["course__subdepartment", "course__number"]
Expand All @@ -83,3 +115,4 @@ class CourseInstructorGradeAdmin(admin.ModelAdmin):
admin.site.register(Semester, SemesterAdmin)
admin.site.register(CourseGrade, CourseGradeAdmin)
admin.site.register(CourseInstructorGrade, CourseInstructorGradeAdmin)
admin.site.register(SectionTime, SectionTimeAdmin)
38 changes: 38 additions & 0 deletions tcf_website/management/commands/load_semester.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import re
from datetime import datetime

import pandas as pd
from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist
Expand Down Expand Up @@ -306,4 +307,41 @@ def load_section(
else:
print(f"Retrieved {section}")

def parse_section_times(section_times_str):
if not section_times_str:
return []

times = []
for time_block in section_times_str.split(","):
if not time_block.strip():
continue
try:
days_part, time_part = time_block.strip().split(" ", 1)
start_time, end_time = time_part.split(" - ")

# Create time block with boolean fields
time_data = {
"monday": "Mo" in days_part,
"tuesday": "Tu" in days_part,
"wednesday": "We" in days_part,
"thursday": "Th" in days_part,
"friday": "Fr" in days_part,
"start_time": datetime.strptime(start_time, "%I:%M%p").time(),
"end_time": datetime.strptime(end_time, "%I:%M%p").time(),
}
times.append(time_data)

except (ValueError, IndexError):
continue

return times

# Clear existing section times
section.sectiontime_set.all().delete()

# Create new section times
times = parse_section_times(section_times)
for time_data in times:
SectionTime.objects.create(section=section, **time_data)

return section
Loading
Loading