Skip to content

Commit 299d7d8

Browse files
authored
Merge pull request #1106 from uw-it-aca/bug/sis-import-none
update cache policy to add student/person
2 parents 743d332 + b34badc commit 299d7d8

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
'django-storages[google]',
3636
'uw-memcached-clients~=1.0',
3737
'uw-restclients-core~=1.4',
38-
'uw-restclients-sws>=2.4',
38+
'uw-restclients-sws~=2.5',
3939
'uw-restclients-pws~=2.1',
4040
'uw-restclients-gws~=2.3',
4141
'uw-restclients-kws~=1.1',
@@ -49,7 +49,7 @@
4949
description='An application that manages SIS imports to Canvas',
5050
long_description=README,
5151
url='https://github.com/uw-it-aca/canvas-sis-provisioner',
52-
author="UW-IT Student & Educational Technology Services",
52+
author="UWIT Student & Educational Technology Services",
5353
author_email="aca-it@uw.edu",
5454
classifiers=[
5555
'Environment :: Web Environment',

sis_provisioner/apps.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@
33

44

55
from django.apps import AppConfig
6+
from restclients_core.dao import MockDAO
7+
import os
68

79

810
class SISProvisionerConfig(AppConfig):
911
name = 'sis_provisioner'
1012

1113
def ready(self):
1214
import sis_provisioner.signals
15+
16+
mocks = os.path.join(os.path.dirname(__file__), 'resources')
17+
MockDAO.register_mock_path(mocks)

sis_provisioner/cache.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ def get_cache_expiration_time(self, service, url, status=200):
3333
return ONE_MINUTE * 5
3434
if re.match(r'^/student/v\d/term/', url):
3535
return ONE_DAY
36+
if re.match(r'^/student/v5/person/', url):
37+
return ONE_HOUR
3638
if re.match(
3739
r'^/student/v\d/(?:campus|college|department|curriculum)',
3840
url):

sis_provisioner/dao/course.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def get_new_sections_by_term(changed_since_date, term, existing={}):
215215

216216
def get_registrations_by_section(section):
217217
registrations = get_all_registrations_by_section(
218-
section, transcriptable_course='all')
218+
section, transcriptable_course='all', use_pws_person=True)
219219

220220
# Sort by regid, is_active, duplicate code
221221
registrations.sort(key=lambda r: (

sis_provisioner/management/commands/get_page_views.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
from django.conf import settings
77
from uw_canvas.users import Users
88
from dateutil.parser import parse
9-
from datetime import timedelta
10-
from pytz import timezone
9+
from datetime import timedelta, timezone
10+
from zoneinfo import ZoneInfo
1111
import argparse
1212
import csv
1313
import os
1414

15-
UTC = timezone('UTC')
16-
PST = timezone('US/Pacific')
15+
LOCAL_TZ = ZoneInfo('America/Los_Angeles')
1716

1817

1918
class Command(BaseCommand):
@@ -48,7 +47,8 @@ def handle(self, *args, **options):
4847
login, start_time=start_time, end_time=end_time)
4948

5049
for pv in page_views:
51-
dt = parse(pv['created_at']).replace(tzinfo=UTC).astimezone(PST)
50+
dt = parse(pv['created_at']).replace(
51+
tzinfo=timezone.utc).astimezone(LOCAL_TZ)
5252
participated = 'yes' if pv['participated'] else ''
5353
contributed = 'yes' if pv['contributed'] else ''
5454
writer.writerow([

0 commit comments

Comments
 (0)