Skip to content

Commit 423d48a

Browse files
committed
Merge pull request #65 from uw-it-aca/qa
Qa
2 parents 51853f8 + fe0fdee commit 423d48a

File tree

86 files changed

+1688
-14592
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+1688
-14592
lines changed

.jshintignore

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
myuw_mobile/static/js/vendor/**
2+
myuw_mobile/static/vendor/js/**
3+
myuw_mobile/static/js/test/**

.travis.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ before_script:
88
- pip install python-coveralls
99
- pip install pep8
1010
- npm install jshint
11+
- npm install mocha
1112
- cp travis-ci/manage.py manage.py
1213
- python manage.py syncdb --noinput
1314
script:
1415
- pep8 myuw_mobile/ --exclude=migrations,myuw_mobile/test,myuw_mobile/management
1516
- jshint myuw_mobile/static/js/ --verbose
16-
- coverage run --source=myuw_mobile/ manage.py test myuw_mobile
17+
- mocha myuw_mobile/static/js/test/ --recursive
18+
- coverage run --source=myuw_mobile/ --omit=myuw_mobile/migrations/* manage.py test myuw_mobile
1719
after_script:
1820
- coveralls
1921
notifications:

myuw_mobile/dao/card_display_dates.py

+51-15
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ def get_values_by_date(now, request):
2929
is_after_grade_submission_deadline = False
3030
is_after_last_day_of_classes = False
3131
is_after_start_of_registration_display_period = False
32+
is_after_start_of_summer_reg_display_period1 = False
33+
is_after_start_of_summer_reg_display_periodA = False
3234
is_before_end_of_finals_week = False
3335
is_before_last_day_of_classes = False
3436
is_before_end_of_registration_display_period = False
37+
is_before_end_of_summer_reg_display_period1 = False
38+
is_before_end_of_summer_reg_display_periodA = False
3539
is_before_first_day_of_term = False
3640

3741
if now.date() < current_term.first_day_quarter:
@@ -45,28 +49,31 @@ def get_values_by_date(now, request):
4549
if now >= d + timedelta(days=1):
4650
is_after_last_day_of_classes = True
4751

48-
# XXX - this will be a bug when summer quarter comes around
49-
# because there will need to be a summer term + a next non-summer term
50-
# version of this. We're holding off on the summer term card though...
51-
if (now >= next_term.registration_services_start - timedelta(days=7) and
52-
now < next_term.registration_period2_start + timedelta(days=7)):
53-
is_after_start_of_registration_display_period = True
54-
is_before_end_of_registration_display_period = True
52+
term_reg_data = {
53+
"after_start": False,
54+
"after_summer1_start": False,
55+
"after_summerA_start": False,
56+
}
5557

58+
get_reg_data(now, next_term, term_reg_data)
5659
# We also need to be able to show this term's registration stuff, because
5760
# the period 2 stretches past the grade submission deadline
58-
if (now >= current_term.registration_services_start - timedelta(days=7) and
59-
now < current_term.registration_period2_start + timedelta(days=7)):
60-
is_after_start_of_registration_display_period = True
61-
is_before_end_of_registration_display_period = True
62-
61+
get_reg_data(now, current_term, term_reg_data)
6362
# We also need to be able to show the term after next, in spring quarter
64-
start = term_after_next.registration_services_start - timedelta(days=7)
65-
end = term_after_next.registration_period2_start + timedelta(days=7)
66-
if now >= start and now < end:
63+
get_reg_data(now, term_after_next, term_reg_data)
64+
65+
if term_reg_data["after_start"]:
6766
is_after_start_of_registration_display_period = True
6867
is_before_end_of_registration_display_period = True
6968

69+
if term_reg_data["after_summer1_start"]:
70+
is_after_start_of_summer_reg_display_period1 = True
71+
is_before_end_of_summer_reg_display_period1 = True
72+
73+
if term_reg_data["after_summerA_start"]:
74+
is_after_start_of_summer_reg_display_periodA = True
75+
is_before_end_of_summer_reg_display_periodA = True
76+
7077
raw_date = current_term.last_final_exam_date
7178
d = datetime(raw_date.year, raw_date.month, raw_date.day)
7279
if now < d:
@@ -81,19 +88,47 @@ def get_values_by_date(now, request):
8188
after_registration = is_after_start_of_registration_display_period
8289
before_reg_end = is_before_end_of_registration_display_period
8390

91+
summerA_start = is_after_start_of_summer_reg_display_periodA
92+
summer1_start = is_after_start_of_summer_reg_display_period1
93+
94+
summerA_end = is_before_end_of_summer_reg_display_periodA
95+
summer1_end = is_before_end_of_summer_reg_display_period1
96+
8497
last_term = get_term_before(current_term)
8598
return {
8699
"is_after_grade_submission_deadline": after_submission,
87100
"is_after_last_day_of_classes": is_after_last_day_of_classes,
88101
"is_after_start_of_registration_display_period": after_registration,
102+
"is_after_start_of_summer_reg_display_periodA": summerA_start,
103+
"is_after_start_of_summer_reg_display_period1": summer1_start,
89104
"is_before_end_of_finals_week": is_before_end_of_finals_week,
90105
"is_before_last_day_of_classes": is_before_last_day_of_classes,
91106
"is_before_end_of_registration_display_period": before_reg_end,
107+
"is_before_end_of_summer_reg_display_periodA": summerA_end,
108+
"is_before_end_of_summer_reg_display_period1": summer1_end,
92109
"is_before_first_day_of_term": is_before_first_day_of_term,
93110
"last_term": "%s,%s" % (last_term.year, last_term.quarter),
94111
}
95112

96113

114+
def get_reg_data(now, term, data):
115+
if term.quarter == "summer":
116+
if (now >= term.registration_period1_start - timedelta(days=7) and
117+
now < term.registration_period1_start + timedelta(days=7)):
118+
data["after_summerA_start"] = True
119+
data["before_summerA_end"] = True
120+
121+
elif (now >= term.registration_period1_start + timedelta(days=7) and
122+
now < term.registration_period2_start + timedelta(days=7)):
123+
data["after_summer1_start"] = True
124+
data["before_summer1_end"] = True
125+
else:
126+
if (now >= term.registration_period1_start - timedelta(days=14) and
127+
now < term.registration_period2_start + timedelta(days=7)):
128+
data["after_start"] = True
129+
data["before_end"] = True
130+
131+
97132
def set_js_overrides(request, values):
98133
after_reg = 'is_after_start_of_registration_display_period'
99134
before_reg = 'is_before_end_of_registration_display_period'
@@ -103,6 +138,7 @@ def set_js_overrides(request, values):
103138
'myuw_before_finals_end': 'is_before_end_of_finals_week',
104139
'myuw_before_last_day': 'is_before_last_day_of_classes',
105140
'myuw_before_end_of_reg_display': before_reg,
141+
'myuw_before_first_day': 'is_before_first_day_of_term',
106142
}
107143

108144
for key, value in MAP.iteritems():

myuw_mobile/dao/registered_term.py

+18-6
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55

66
import logging
77
from myuw_mobile.dao.term import is_a_term, is_b_term, is_full_summer_term
8-
from myuw_mobile.dao.term import get_current_summer_term
8+
from myuw_mobile.dao.term import get_current_summer_term, get_comparison_date
99
from myuw_mobile.dao.schedule import get_next_quarter_schedule
1010
from myuw_mobile.dao.schedule import get_next_autumn_quarter_schedule
1111
from myuw_mobile.dao.schedule import has_summer_quarter_section
1212
from myuw_mobile.dao import get_user_model
1313
from myuw_mobile.models import SeenRegistration
1414
from django.utils import timezone
15+
from datetime import datetime
1516

1617

1718
logger = logging.getLogger(__name__)
@@ -166,9 +167,10 @@ def _get_registered_summer_terms(registered_summer_sections):
166167

167168

168169
# MUWM-2210
169-
def should_highlight_future_quarters(schedule):
170+
def should_highlight_future_quarters(schedule, request):
170171
should_highlight = False
171-
now = timezone.now()
172+
# MUWM-2373
173+
now = get_comparison_date(request)
172174

173175
for term in schedule:
174176
summer_term = "F"
@@ -181,11 +183,21 @@ def should_highlight_future_quarters(schedule):
181183
model, created = sr_get_or_create(user=get_user_model(),
182184
year=term["year"],
183185
quarter=term["quarter"],
184-
summer_term=summer_term
186+
summer_term=summer_term,
185187
)
186188

187-
days_diff = (now - model.first_seen_date).days
188-
if days_diff < 1:
189+
# Want to make sure that we have a full day, not just today/tomorrow
190+
actual_now = timezone.now()
191+
now_datetime = datetime(now.year, now.month, now.day, actual_now.hour,
192+
actual_now.minute, actual_now.second,
193+
tzinfo=actual_now.tzinfo)
194+
if created:
195+
model.first_seen_date = now_datetime
196+
model.save()
197+
198+
days_diff = (now_datetime - model.first_seen_date).days
199+
# XXX - this needs to be changed when we can set a time in the override
200+
if days_diff < 1.02:
189201
should_highlight = True
190202

191203
return should_highlight

myuw_mobile/dao/term.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ def is_same_summer_term(summer_term1, summer_term2):
191191
return summer_term1.lower() == summer_term2.lower()
192192

193193

194-
def is_past(term):
194+
def is_past(term, request):
195195
"""
196196
return true if the term is in the past
197197
"""
198-
return term.last_final_exam_date < date.today()
198+
return term.last_final_exam_date < get_comparison_date(request)

myuw_mobile/logger/session_log.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@
33
from myuw_mobile.dao.gws import is_grad_student, is_undergrad_student
44
import logging
55
import json
6+
import hashlib
67

78
logger = logging.getLogger('session')
89

910

1011
def log_session(netid, session_key, request):
12+
if session_key is None:
13+
session_key = ''
14+
15+
session_hash = hashlib.md5(session_key).hexdigest()
1116
log_entry = {'netid': netid,
12-
'session_key': session_key,
17+
'session_key': session_hash,
1318
'class_level': None,
1419
'is_grad': None,
1520
'campus': None}

myuw_mobile/models.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@ class SeenRegistration(models.Model):
139139
unique_together = (("user",
140140
"year",
141141
"quarter",
142-
"summer_term",
143-
"first_seen_date"
142+
"summer_term"
144143
),
145144
)
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,66 @@
11
{
22
"Notices": [
3+
{
4+
"NoticeAttributes": [
5+
{
6+
"Name": "Date",
7+
"DataType": "date",
8+
"Value": "next-week"
9+
},
10+
{
11+
"Name": "DisplayBegin",
12+
"DataType": "date",
13+
"Value": "yesterday"
14+
},
15+
{
16+
"Name": "DisplayEnd",
17+
"DataType": "date",
18+
"Value": "next-week"
19+
},
20+
{
21+
"Name": "Quarter",
22+
"DataType": "string",
23+
"Value": "Autumn"
24+
}
25+
26+
],
27+
"NoticeCategory": "StudentDAD",
28+
"NoticeContent": "<span class=\"notice-title\">Estimated Registration Date</span><span class=\"notice-body-with-title\">Your estimated Period I Priority Registration Date for autumn quarter is <span class=\"date\"> Thurs, May 15</span>. Registration begins at 6:00 AM. <a href=\"http://www.washington.edu/students/reg/priorau14.html\">View your Period 1 Priority Registration Date</a>.</span>",
29+
"NoticeType": "EstPd1RegDate"
30+
},
31+
{
32+
"NoticeAttributes": [
33+
{
34+
"Name": "Date",
35+
"DataType": "date",
36+
"Value": "next-week"
37+
},
38+
{
39+
"Name": "DisplayBegin",
40+
"DataType": "date",
41+
"Value": "yesterday"
42+
},
43+
{
44+
"Name": "DisplayEnd",
45+
"DataType": "date",
46+
"Value": "next-week"
47+
},
48+
{
49+
"Name": "Quarter",
50+
"DataType": "string",
51+
"Value": "Summer"
52+
}
53+
54+
],
55+
"NoticeCategory": "StudentDAD",
56+
"NoticeContent": "<span class=\"notice-title\">Estimated Registration Date</span><span class=\"notice-body-with-title\">Your estimated Period I Priority Registration Date for summer quarter is <span class=\"date\"> Thurs, May 13</span>. Registration begins at 6:00 AM. <a href=\"http://www.washington.edu/students/reg/priorau14.html\">View your Period 1 Priority Registration Date</a>.</span>",
57+
"NoticeType": "EstPd1RegDate"
58+
}
59+
360
],
461
"Person": {
562
"Href": "",
663
"Name": "None STUDENT",
764
"RegID": "00000000000000000000000000000001"
865
}
9-
}
66+
}

myuw_mobile/resources/sws/file/student/v5/person/12345678901234567890123456789012.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{"BirthDate":"1994-10-26",
2-
"DirectoryRelease":true,
2+
"DirectoryRelease":false,
33
44
"EmployeeID":"87654321",
55
"FirstName":"Evelyn Marie",
@@ -19,18 +19,18 @@
1919
"LocalAddress":{"City":"Tacoma",
2020
"Country":"",
2121
"Line1":"1101 Pacific Ave S",
22-
"Line2":"APT 307",
22+
"Line2":"#307",
2323
"PostalCode":"",
2424
"State":"WA",
2525
"Zip":"98424"},
2626
"PermanentPhone":"2535552468",
27-
"RegID":"9136CCB8F66711D5BE060004AC494FFE",
27+
"RegID":"12345678901234567890123456789012",
2828
"Resident":null,
2929
"StudentName":"Hightower,Evelyn Marie",
3030
"StudentNumber":"1443336",
3131
"StudentSystemKey":"000083857",
32-
"TestScore":{"Href":"\/student\/v5\/testscore\/9136CCB8F66711D5BE060004AC494FFE.json",
33-
"RegID":"9136CCB8F66711D5BE060004AC494FFE"},
32+
"TestScore":{"Href":"\/student\/v5\/testscore\/12345678901234567890123456789012.json",
33+
"RegID":"12345678901234567890123456789012"},
3434
"UWNetID":"eight",
3535
"Veteran":{"Code":"0",
3636
"Description":null},

myuw_mobile/resources/sws/file/student/v5/person/9136CCB8F66711D5BE060004AC494FFE.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
"Line2":"APT 102",
1515
"PostalCode":"",
1616
"State":"WA",
17-
"Zip":"98105"},
17+
"Zip":"98105-4566"},
1818
"LocalPhone":null,
1919
"PermanentAddress":{"City":"Bellevue",
20-
"Country":"",
20+
"Country":"United States",
2121
"Line1":"1645 140th Ave NE",
2222
"Line2":"APT 980",
2323
"PostalCode":"",

myuw_mobile/resources/sws/file/student/v5/person/FE36CCB8F66711D5BE060004AC494F31.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"PostalCode":"",
2424
"State":"WA",
2525
"Zip":"98055"},
26-
"PermanentPhone":"2065551357",
26+
"PermanentPhone":null,
2727
"RegID":"FE36CCB8F66711D5BE060004AC494F31",
2828
"Resident":null,
2929
"StudentName":"Newsome,Jaylen",

myuw_mobile/resources/sws/file/student/v5/person/FE36CCB8F66711D5BE060004AC494FCD.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"Year":2013},
1010
"LastName":"Othello",
1111
"LocalAddress":{"City":"Edmonds",
12-
"Country":"",
12+
"Country":"United States",
1313
"Line1":"502 Main St",
1414
"Line2":"",
1515
"PostalCode":"",

myuw_mobile/restclients/__init__.py

Whitespace-only changes.

myuw_mobile/restclients/dao.py

-13
This file was deleted.

myuw_mobile/restclients/dao_implementation/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)