Skip to content

Commit 9e28e86

Browse files
committed
Merge branch 'main' of https://github.com/ericahan22/Wat2Do
2 parents ff34e04 + d26a15a commit 9e28e86

File tree

8 files changed

+358
-6
lines changed

8 files changed

+358
-6
lines changed

backend/apps/events/views.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,12 @@ def get_events(request):
5151
if not dtstart_utc_param:
5252
now = timezone.now()
5353
ninety_minutes_ago = now - timedelta(minutes=90)
54-
# Filter events that have at least one upcoming date
54+
# Filter events that are either:
55+
# 1. Have no end time and started within last 90 minutes
56+
# 2. Have end time and are currently happening (between start and end)
5557
events_queryset = events_queryset.filter(
56-
event_dates__dtstart_utc__gte=ninety_minutes_ago
58+
Q(event_dates__dtend_utc__isnull=True, event_dates__dtstart_utc__gte=ninety_minutes_ago)
59+
| Q(event_dates__dtend_utc__isnull=False, event_dates__dtstart_utc__lte=now, event_dates__dtend_utc__gte=now)
5760
).distinct()
5861

5962
filterset = EventFilter(request.GET, queryset=events_queryset)
@@ -148,9 +151,13 @@ def get_events(request):
148151
for event in events_list:
149152
# Get all event dates and filter for upcoming ones
150153
all_dates = list(event.event_dates.all())
151-
# Filter to only upcoming dates (>= ninety_minutes_ago to match the filter logic)
154+
# Filter to only upcoming/live dates matching the query logic:
155+
# 1. No end time and started within last 90 minutes
156+
# 2. Has end time and currently happening (between start and end)
152157
upcoming_dates = [
153-
date for date in all_dates if date.dtstart_utc >= ninety_minutes_ago
158+
date for date in all_dates
159+
if (date.dtend_utc is None and date.dtstart_utc >= ninety_minutes_ago)
160+
or (date.dtend_utc is not None and date.dtstart_utc <= now and date.dtend_utc >= now)
154161
]
155162
# Select the most recent upcoming date (first one since they're ordered by dtstart_utc)
156163
# If no upcoming dates, fall back to the earliest date overall

backend/scraping/generate_static_data.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,26 @@ def main():
109109
current_time = datetime.now(timezone.utc).isoformat()
110110
f.write(f'export const LAST_UPDATED = "{current_time}";\n\n')
111111

112+
# Write event emoji categories
113+
f.write("export const EVENT_EMOJIS_CATEGORIES: [string, string, string][] = [\n")
114+
emoji_categories = [
115+
["Objects", "Graduation%20Cap", "Academic"],
116+
["Objects", "Briefcase", "Career & Networking"],
117+
["Activity", "Video%20Game", "Social & Games"],
118+
["Activity", "Soccer%20Ball", "Athletics"],
119+
["Activity", "Artist%20Palette", "Creative Arts"],
120+
["Travel%20and%20Places", "Classical%20Building", "Cultural"],
121+
["Animals%20and%20Nature", "Dove", "Religious"],
122+
["Objects", "Megaphone", "Advocacy & Causes"],
123+
["Objects", "Chart%20Increasing", "Sales & Fundraising"]
124+
]
125+
for i, (group, emoji, category) in enumerate(emoji_categories):
126+
f.write(f' ["{group}", "{emoji}", "{category}"]')
127+
if i < len(emoji_categories) - 1:
128+
f.write(",")
129+
f.write("\n")
130+
f.write("];\n\n")
131+
112132
# Write event categories
113133
f.write("export const EVENT_CATEGORIES = [\n")
114134
categories = [

frontend/package-lock.json

Lines changed: 182 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
"dependencies": {
1414
"@clerk/clerk-react": "^5.53.3",
1515
"@clerk/themes": "^2.4.30",
16+
"@codemirror/lang-json": "^6.0.2",
17+
"@codemirror/state": "^6.5.2",
18+
"@codemirror/theme-one-dark": "^6.1.3",
19+
"@codemirror/view": "^6.38.7",
1620
"@hookform/resolvers": "^5.2.2",
1721
"@number-flow/react": "^0.5.10",
1822
"@radix-ui/react-checkbox": "^1.3.3",
@@ -30,6 +34,7 @@
3034
"axios": "^1.7.7",
3135
"class-variance-authority": "^0.7.1",
3236
"clsx": "^2.1.1",
37+
"codemirror": "^6.0.2",
3338
"date-fns": "^4.1.0",
3439
"date-fns-tz": "^3.2.0",
3540
"framer-motion": "^12.23.24",

frontend/src/data/staticData.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
export const LAST_UPDATED = "2025-11-15T16:57:42.276863+00:00";
22

3+
export const EVENT_EMOJIS_CATEGORIES: [string, string, string][] = [
4+
["Objects", "Graduation%20Cap", "Academic"],
5+
["Objects", "Briefcase", "Career & Networking"],
6+
["Activity", "Video%20Game", "Social & Games"],
7+
["Activity", "Soccer%20Ball", "Athletics"],
8+
["Activity", "Artist%20Palette", "Creative Arts"],
9+
["Travel%20and%20Places", "Classical%20Building", "Cultural"],
10+
["Animals%20and%20Nature", "Dove", "Religious"],
11+
["Objects", "Megaphone", "Advocacy & Causes"],
12+
["Objects", "Chart%20Increasing", "Sales & Fundraising"]
13+
];
14+
315
export const EVENT_CATEGORIES = [
416
"Academic",
517
"Career & Networking",
@@ -10,4 +22,4 @@ export const EVENT_CATEGORIES = [
1022
"Religious",
1123
"Advocacy & Causes",
1224
"Sales & Fundraising"
13-
];
25+
];

frontend/src/features/events/pages/EventsPage.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
FloatingEventExportBar,
1616
formatRelativeDateTime,
1717
FilterButton,
18+
// JSONEditor,
1819
} from "@/shared";
1920
import { Calendar, LayoutGrid, Sparkles, Heart, Clock } from "lucide-react";
2021
import SearchInput from "@/features/search/components/SearchInput";
@@ -103,6 +104,7 @@ function EventsPage() {
103104
"campus activities",
104105
]}
105106
/>
107+
{/* <JSONEditor /> */}
106108
<div className="flex flex-col gap-4">
107109
<div className="sm:text-left">
108110
<h1 className="sm:text-3xl text-2xl font-bold mb-2 -mt-3 sm:mt-0">

0 commit comments

Comments
 (0)