Skip to content

Commit edb08a2

Browse files
Update Drexel quarter dates and auto-detection logic
Co-authored-by: zohair.ul.hasan <[email protected]>
1 parent 090021b commit edb08a2

File tree

3 files changed

+24
-21
lines changed

3 files changed

+24
-21
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ The scraper will output a JSON file called `data.json` in the same directory as
4848

4949
The scraper now automatically detects the current Drexel quarter based on the current date. You no longer need to manually update the `year` and `quarter` values in `src/config.py`. The system uses the following schedule:
5050

51-
- **Fall Quarter (15)**: September 23 - December 31
52-
- **Winter Quarter (25)**: January 1 - March 22
53-
- **Spring Quarter (35)**: March 23 - June 14
54-
- **Summer Quarter (45)**: June 15 - September 22
51+
- **Fall Quarter (15)**: July 1 - September 27
52+
- **Winter Quarter (25)**: September 28 - January 15
53+
- **Spring Quarter (35)**: January 16 - April 14
54+
- **Summer Quarter (45)**: April 15 - June 30
5555

5656
If you need to override the automatic detection (e.g., for testing or scraping a specific past/future quarter), you can set the `DREXEL_YEAR` and `DREXEL_QUARTER` environment variables:
5757

src/config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
print(f"Using auto-detected {get_quarter_name(quarter)} {year} quarter (code: {quarter})")
1414

1515
# Note: These values are now automatically determined based on the current date
16-
# Fall (15): Late September - Mid December
17-
# Winter (25): Early January - Late March
18-
# Spring (35): Late March/Early April - Mid June
19-
# Summer (45): Late June - Early September
16+
# Fall (15): July 1 - September 27
17+
# Winter (25): September 28 - January 15
18+
# Spring (35): January 16 - April 14
19+
# Summer (45): April 15 - June 30
2020
# check college code by going to the tms website and selecting your college from the left sidebar
2121
# the URL bar should update and it should end with something like collCode=CI
2222
# the characters after the = sign is your college code

src/quarter_utils.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ def get_current_quarter_and_year() -> Tuple[str, str]:
77
Determine the current Drexel quarter and year based on the current date.
88
99
Drexel quarters:
10-
- Fall (15): Late September - Mid December
11-
- Winter (25): Early January - Late March
12-
- Spring (35): Late March/Early April - Mid June
13-
- Summer (45): Late June - Early September
10+
- Fall (15): July 1 - September 27
11+
- Winter (25): September 28 - January 15
12+
- Spring (35): January 16 - April 14
13+
- Summer (45): April 15 - June 30
1414
1515
Returns:
1616
Tuple of (year, quarter_code) as strings
@@ -21,21 +21,24 @@ def get_current_quarter_and_year() -> Tuple[str, str]:
2121
year = now.year
2222

2323
# Determine quarter based on month and day
24-
if month == 1 or month == 2 or (month == 3 and day <= 22):
24+
if (month == 7) or (month == 8) or (month == 9 and day <= 27):
25+
# Fall quarter
26+
quarter = "15"
27+
elif (month == 9 and day >= 28) or month == 10 or month == 11 or month == 12 or (month == 1 and day <= 15):
2528
# Winter quarter
2629
quarter = "25"
27-
elif (month == 3 and day > 22) or month == 4 or month == 5 or (month == 6 and day <= 14):
30+
elif (month == 1 and day >= 16) or month == 2 or month == 3 or (month == 4 and day <= 14):
2831
# Spring quarter
2932
quarter = "35"
30-
elif (month == 6 and day > 14) or month == 7 or month == 8 or (month == 9 and day <= 22):
31-
# Summer quarter
32-
quarter = "45"
3333
else:
34-
# Fall quarter (Sept 23 - Dec 31)
35-
quarter = "15"
34+
# Summer quarter (April 15 - June 30)
35+
quarter = "45"
36+
37+
# For Winter quarter spanning two calendar years (Sept 28 - Jan 15),
38+
# if we're in January, it belongs to the previous year's academic year
39+
if quarter == "25" and month == 1:
40+
year = year - 1
3641

37-
# For Fall quarter, if we're in September-December, it's the current year
38-
# For other quarters in January-August, they belong to the current year
3942
return str(year), quarter
4043

4144

0 commit comments

Comments
 (0)