Skip to content

Commit b58c70a

Browse files
committed
Can't really share these query args
1 parent 3c5037f commit b58c70a

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

mazevo_r25/management/commands/r25_mazevo.py

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from uw_mazevo.api import PublicCourses
1010
from uw_sws.term import (get_current_term, get_next_term, get_term_after,
1111
get_term_by_year_and_quarter)
12-
from uw_r25.models import Reservation
12+
from uw_r25.models import Event, Reservation
1313

1414
from mazevo_r25.more_r25 import get_event_list, get_reservations_attrs
1515

@@ -151,24 +151,18 @@ def handle(self, *args, **options):
151151
favorites is maintained automatically by the separate tool mazevo2r25.
152152
"""
153153

154-
reservation_search = {
155-
"event_type_id": (
156-
settings.MAZEVO_R25_EVENTTYPE_TS_SECTION_FINAL if options["finals"]
157-
else settings.MAZEVO_R25_EVENTTYPE_TS_SECTION),
158-
"space_favorite": "T",
159-
"space_match": "occurrence",
160-
"state": "+".join([Reservation.STANDARD_STATE,
161-
Reservation.EXCEPTION_STATE,
162-
Reservation.WARNING_STATE,
163-
Reservation.OVERRIDE_STATE]),
164-
"start_dt": term.first_day_quarter.isoformat(),
165-
"end_dt": term.last_final_exam_date.isoformat(),
166-
}
167-
168154
# search for events in categories we want to be unlisted
169155
unlisted_events = get_event_list(
170-
**reservation_search, category_id="+".join(
171-
settings.MAZEVO_R25_CATEGORIES_UNLISTED))
156+
event_type_id=(
157+
settings.MAZEVO_R25_EVENTTYPE_TS_SECTION_FINAL if options["finals"]
158+
else settings.MAZEVO_R25_EVENTTYPE_TS_SECTION),
159+
space_favorite="T",
160+
state="+".join([Event.TENTATIVE_STATE,
161+
Event.CONFIRMED_STATE,
162+
Event.SEALED_STATE]),
163+
reservation_start_dt=term.first_day_quarter.isoformat(),
164+
reservation_end_dt=term.last_final_exam_date.isoformat(),
165+
category_id="+".join(settings.MAZEVO_R25_CATEGORIES_UNLISTED))
172166

173167
unlisted_event_ids = unlisted_events.keys()
174168

@@ -178,7 +172,18 @@ def handle(self, *args, **options):
178172
while True:
179173

180174
(reservations, attrs) = get_reservations_attrs(
181-
**reservation_search, paginate=paginate, page=page, page_size=1000)
175+
event_type_id=(
176+
settings.MAZEVO_R25_EVENTTYPE_TS_SECTION_FINAL if options["finals"]
177+
else settings.MAZEVO_R25_EVENTTYPE_TS_SECTION),
178+
space_favorite="T",
179+
space_match="occurrence",
180+
state="+".join([Reservation.STANDARD_STATE,
181+
Reservation.EXCEPTION_STATE,
182+
Reservation.WARNING_STATE,
183+
Reservation.OVERRIDE_STATE]),
184+
start_dt=term.first_day_quarter.isoformat(),
185+
end_dt=term.last_final_exam_date.isoformat(),
186+
paginate=paginate, page=page, page_size=1000)
182187

183188
if page == 1:
184189
logger.info("Total reservations: {}".format(attrs["total_results"]))

0 commit comments

Comments
 (0)