Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/muwm 5363 #3157

Merged
merged 8 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions myuw/test/views/test_teaching.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ def test_instrucor_access(self):
HTTP_USER_AGENT="Lynx/2.8.2rel.1 libwww-FM/2.14")
self.assertEqual(response.status_code, 200)

@skipIf(missing_url("myuw_teaching_page",
kwargs={}), "myuw urls not configured")
def test_current_quarter_access(self):
url = reverse("myuw_teaching_page", kwargs={})
self.set_user('bill')
response = self.client.get(
url,
HTTP_USER_AGENT="Lynx/2.8.2rel.1 libwww-FM/2.14")
self.assertEqual(response.status_code, 200)
self.assertEqual(response.context['display_term']["year"], 2013)
self.assertEqual(
response.context['display_term']["quarter"], 'spring')

@skipIf(missing_url("myuw_teaching_page",
kwargs={'year': '2013', 'quarter': 'summer'}),
"myuw urls not configured")
Expand Down
2 changes: 2 additions & 0 deletions myuw/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@
student_photo_list, name="myuw_photo_list"),
re_path(r'^teaching/(?P<year>2[0-9]{3}),(?P<quarter>[a-z]+)$',
teaching, name="myuw_teaching_page"),
# MUWM-5363
re_path(r'^teaching/current$', teaching, name="myuw_teaching_page"),
re_path(r'^teaching/?$', teaching, name="myuw_teaching_page"),
re_path(r'^notices/?', notices, name="myuw_notices_page"),
re_path(r'^thrive_messages/?', thrive_messages,
Expand Down
8 changes: 7 additions & 1 deletion myuw/views/teaching.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from myuw.dao.term import get_current_quarter
from myuw.views.page import page
from myuw.util.page_view import page_view

Expand All @@ -9,7 +10,12 @@
def teaching(request,
year=None,
quarter=None):
context = get_context(year, quarter)
if year is None and quarter is None:
# MUWM-5363
term = get_current_quarter(request)
context = get_context(term.year, term.quarter)
else:
context = get_context(year, quarter)
return page(request, 'teaching.html', context=context)


Expand Down
Loading