Skip to content

Commit 496e860

Browse files
authored
Merge pull request #2862 from uw-it-aca/qa
Fix/muwm 5182 (#2856)
2 parents defd0ab + bea72ce commit 496e860

18 files changed

+162
-23
lines changed

myuw/dao/degree.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from myuw.dao import is_using_file_dao, get_netid_of_current_user
1111
from myuw.dao.pws import get_regid_of_current_user
1212
from myuw.dao.term import (
13-
during_april_may, is_cur_term_before, is_cur_term_same)
13+
last_4w_inst, during_april_may, is_cur_term_before, is_cur_term_same)
1414
from myuw.dao.term import more_than_2terms_before as before_display_window
1515

1616

@@ -49,7 +49,7 @@ def get_degrees_json(request):
4949
json_data["before_degree_earned_term"] = is_cur_term_before(
5050
request, degree.year, degree.quarter)
5151
json_data["during_april_may"] = during_april_may(request)
52-
52+
json_data["last_4w_inst"] = last_4w_inst(request)
5353
degrees.append(json_data)
5454
response['degrees'] = degrees
5555
except DataFailureException as ex:

myuw/dao/degree_notice.py

+9
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@
4545
"to your UW address – set up forwarding</span>" +
4646
"<span class=\"notice-body-with-title\"></span>"
4747
)
48+
},
49+
{
50+
"NoticeCategory": "Degree",
51+
"NoticeType": "NextDestination",
52+
"NoticeContent": (
53+
"<span class=\"notice-title\">What do graduates do after " +
54+
"leaving UW?</span>" +
55+
"<span class=\"notice-body-with-title\"></span>"
56+
)
4857
}
4958
]
5059

myuw/dao/notice_categorization.py

+5
Original file line numberDiff line numberDiff line change
@@ -398,5 +398,10 @@
398398
"myuw_category": "Graduation EmailForwarding",
399399
"location_tags": ['graduation'],
400400
"critical": False
401+
},
402+
"degree_nextdestination": {
403+
"myuw_category": "Graduation NextDestination",
404+
"location_tags": ['graduation'],
405+
"critical": False
401406
}
402407
}

myuw/dao/term.py

+21-2
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,15 @@ def more_than_2terms_before(request, year, quarter):
150150
return comparison_term < pprev_term
151151

152152

153+
def last_4w_inst(request):
154+
"""
155+
return True if it is four weeks prior last day class of the term
156+
"""
157+
comparison_dt = get_comparison_datetime(request)
158+
starting_point = get_bod_days_before_last_instruction(request, 28)
159+
return comparison_dt > starting_point
160+
161+
153162
def get_term_from_quarter_string(quarter_string):
154163
"""
155164
Return a uw_sws.models.Term object
@@ -388,15 +397,25 @@ def get_eod_current_term_last_instruction(request, break_at_a_term=False):
388397
request, break_at_a_term)
389398

390399

400+
def get_bod_days_before_last_instruction(request, days):
401+
"""
402+
@return the datetime object of the beginning of
403+
the given number of days before the last instruction day for
404+
current quarter and current summer-term if applicable.
405+
Exclude the last instruction day.
406+
"""
407+
return (get_eod_current_term_last_instruction(request, True) -
408+
timedelta(days=days))
409+
410+
391411
def get_bod_7d_before_last_instruction(request):
392412
"""
393413
@return the datetime object of the beginning of
394414
the 7 days before the last instruction day for
395415
current quarter and current summer-term if applicable.
396416
Exclude the last instruction day.
397417
"""
398-
return (get_eod_current_term_last_instruction(request, True) -
399-
timedelta(days=8))
418+
return get_bod_days_before_last_instruction(request, 8)
400419

401420

402421
def get_eod_current_term_last_final_exam(request, break_at_a_term=False):

myuw/test/api/test_notices.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_javerage_notices(self):
2323

2424
data = json.loads(response.content)
2525

26-
self.assertEquals(len(data), 28)
26+
self.assertEquals(len(data), 29)
2727
self.assertFalse(data[0]["is_read"])
2828

2929
hash_value = data[0]["id_hash"]
@@ -37,7 +37,7 @@ def test_javerage_notices(self):
3737
self.assertEquals(response.status_code, 200)
3838

3939
data = json.loads(response.content)
40-
self.assertEquals(len(data), 28)
40+
self.assertEquals(len(data), 29)
4141

4242
match = False
4343
for el in data:

myuw/test/dao/test_degree.py

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
'is_degree_earned_term': False,
1919
'before_degree_earned_term': True,
2020
'during_april_may': True,
21+
"last_4w_inst": False,
2122
'level': 1,
2223
'name_on_diploma': 'John Joseph Average',
2324
'quarter': 'summer',

myuw/test/dao/test_degree_notice.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class TestDegreeNotices(TestCase):
1010

1111
def test_get_graduation_notices(self):
1212
notices = get_graduation_notices()
13-
self.assertEquals(len(notices), 4)
13+
self.assertEquals(len(notices), 5)
1414
self.assertEquals(notices[0].notice_category, "Degree")
1515

1616
final_notices = categorize_notices(notices)

myuw/test/dao/test_notice_categorization.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class TestNoticeCategories(TestCase):
99

1010
def test_categories(self):
11-
self.assertEqual(len(NOTICE_CATEGORIES.keys()), 79)
11+
self.assertEqual(len(NOTICE_CATEGORIES.keys()), 80)
1212

1313
categorization = NOTICE_CATEGORIES.get("studentalr_intlstucheckin")
1414
self.assertIsNotNone(categorization)

myuw/test/dao/test_term.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
get_specific_term, is_past, is_future, sws_now,
1010
get_default_date, get_default_datetime, get_comparison_date,
1111
get_current_quarter, get_next_quarter, is_cur_term_before,
12-
get_previous_quarter, get_previous_number_quarters,
12+
get_previous_number_quarters, last_4w_inst,
1313
get_future_number_quarters, during_april_may, is_cur_term_same,
1414
get_next_non_summer_quarter, get_next_autumn_quarter,
1515
is_in_summer_a_term, is_in_summer_b_term, more_than_2terms_before,
@@ -100,6 +100,12 @@ def test_during_april_may(self):
100100
self.assertTrue(is_cur_term_same(request, 2013, 'winter'))
101101
self.assertFalse(during_april_may(request))
102102

103+
def test_last_4w_inst(self):
104+
request = get_request_with_date("2013-11-08")
105+
self.assertFalse(last_4w_inst(request))
106+
request = get_request_with_date("2013-11-09")
107+
self.assertTrue(last_4w_inst(request))
108+
103109
def test_current_quarter(self):
104110
now_request = get_request()
105111
quarter = get_current_quarter(now_request)

myuw_vue/components/home/graduation/application-submitted.vue

+56-5
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,33 @@
193193
</ul>
194194
</div>
195195

196+
<div v-if="hasActiveOrGrantedDegreeLast4weeksInst">
197+
<h3 class="h6 myuw-font-encode-sans">
198+
Your plans after graduation
199+
</h3>
200+
<ul class="list-unstyled myuw-text-md">
201+
<li>
202+
<uw-collapsed-item :notice="degreeNextDestination">
203+
<template #notice-body>
204+
<p>
205+
Each year we track, aggregate and
206+
<a href="https://careers.uw.edu/outcomes/"
207+
>visualize UW bachelor graduate's next destination.</a>
208+
</p>
209+
<p>
210+
What are <i>you</i> planning to do? Whether you&apos;re intending to work,
211+
travel, go to grad school, or are still figuring it out,
212+
we want to know!
213+
<a href="https://careers.uw.edu/resources/next-destination-survey/"
214+
>Please take 5 mins to tell us your plans</a>
215+
so we can better coach students and inform future graduates
216+
&ndash; we want to hear from every graduate! </p>
217+
</template>
218+
</uw-collapsed-item>
219+
</li>
220+
</ul>
221+
</div>
222+
196223
<div v-if="hasActiveOrGrantedDegreeDuringEarnedTerm">
197224
<h3 class="h6 myuw-font-encode-sans">
198225
Verify that your information and data will not be lost
@@ -480,6 +507,12 @@ export default {
480507
(notice) => notice.category === 'Graduation EmailForwarding'
481508
)[0];
482509
},
510+
degreeNextDestination() {
511+
// MUWM-5182
512+
return this.degreeNotices.filter((notice) =>
513+
notice.category === 'Graduation NextDestination'
514+
)[0];
515+
},
483516
showCard() {
484517
return this.graduatingSenior && (this.isFetching || this.showContent || this.showError);
485518
},
@@ -492,7 +525,8 @@ export default {
492525
Boolean(this.degreeCeremony) &&
493526
Boolean(this.degreeDiploma) &&
494527
Boolean(this.degreeSaveWork) &&
495-
Boolean(this.degreeEmailForwarding)
528+
Boolean(this.degreeEmailForwarding) &&
529+
Boolean(this.degreeNextDestination)
496530
);
497531
},
498532
showError() {
@@ -560,6 +594,23 @@ export default {
560594
}
561595
return value;
562596
},
597+
hasActiveOrGrantedDegreeLast4weeksInst() {
598+
// MUWM-5182 since the beginning of the last 4th week of instruction
599+
let value = (
600+
this.degrees &&
601+
(this.isActive(this.degrees[0]) || this.isGranted(this.degrees[0])) &&
602+
this.degrees[0].is_degree_earned_term &&
603+
this.degrees[0].last_4w_inst
604+
);
605+
if (!value && this.hasDoubleDegrees) {
606+
value = (
607+
(this.isActive(this.degrees[1]) || this.isGranted(this.degrees[1])) &&
608+
this.degrees[1].is_degree_earned_term &&
609+
this.degrees[1].last_4w_inst
610+
);
611+
}
612+
return value;
613+
},
563614
hasActiveApplication() {
564615
let value = this.degrees && this.isActive(this.degrees[0]);
565616
if (!value && this.hasDoubleDegrees) {
@@ -614,16 +665,16 @@ export default {
614665
fetchProfile: 'fetch',
615666
}),
616667
hasMisconduct(degree) {
617-
return degree.is_admin_hold;
668+
return degree.is_admin_hold; // degree status: 1
618669
},
619670
isIncomplete(degree) {
620-
return degree.is_incomplete;
671+
return degree.is_incomplete; // degree status: 2
621672
},
622673
isActive(degree) {
623-
return degree.has_applied;
674+
return degree.has_applied; // degree status: 3,4,5
624675
},
625676
isGranted(degree) {
626-
return degree.is_granted;
677+
return degree.is_granted; // degree status: 9
627678
},
628679
degreeTerm(degree) {
629680
return this.titleCaseWord(degree.quarter) + ' ' + degree.year;

myuw_vue/tests/degree-appl-submitted.test.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe('Graduation Card', () => {
7878
expect(wrapper.vm.tacoma).toBe(false);
7979
expect(wrapper.vm.degreeTerm(wrapper.vm.degrees[0])).toBe('Summer 2013');
8080
expect(wrapper.findComponent(Graduation).exists()).toBe(true);
81-
expect(wrapper.vm.degreeNotices.length).toBe(4);
81+
expect(wrapper.vm.degreeNotices.length).toBe(5);
8282
expect(wrapper.vm.degreeCeremony).toBeTruthy;
8383
expect(wrapper.vm.degreeDiploma).toBeTruthy;
8484
expect(wrapper.vm.degreeSaveWork).toBeTruthy;
@@ -100,10 +100,14 @@ describe('Graduation Card', () => {
100100
expect(wrapper.vm.doubleDegreesInDiffTerms).toBe(true);
101101
expect(wrapper.vm.hasActiveOrGrantedDegreeDuringAprilMay).toBe(true);
102102
expect(wrapper.vm.hasActiveOrGrantedDegreeDuringEarnedTerm).toBe(true);
103+
expect(wrapper.vm.hasActiveOrGrantedDegreeLast4weeksInst).toBe(true);
103104
expect(wrapper.vm.hasActiveApplBeforeEarnedTerm).toBe(true);
104105
expect(wrapper.vm.hasActiveApplication).toBe(true);
105106
expect(wrapper.vm.hasGrantedDegree).toBe(false);
106-
expect(wrapper.findAllComponents(CollapsedItem).length).toBe(4);
107+
expect(wrapper.vm.degreeNextDestination.category).toBe(
108+
"Graduation NextDestination"
109+
);
110+
expect(wrapper.findAllComponents(CollapsedItem).length).toBe(5);
107111
});
108112
it('Verify double degrees diff status', async () => {
109113
axios.get.mockImplementation((url) => {
@@ -119,6 +123,7 @@ describe('Graduation Card', () => {
119123
expect(wrapper.vm.doubleDegreeDiffStatus).toBe(true);
120124
expect(wrapper.vm.doubleDegreesInDiffTerms).toBe(false);
121125
expect(wrapper.vm.hasActiveOrGrantedDegreeDuringAprilMay).toBe(true);
126+
expect(wrapper.vm.hasActiveOrGrantedDegreeLast4weeksInst).toBe(true);
122127
expect(wrapper.vm.hasActiveOrGrantedDegreeDuringEarnedTerm).toBe(true);
123128
expect(wrapper.vm.hasActiveApplBeforeEarnedTerm).toBe(false);
124129
expect(wrapper.vm.hasActiveApplication).toBe(false);

myuw_vue/tests/mock_data/notice/eight.json

+12
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,18 @@
352352
"graduation"
353353
]
354354
},
355+
{
356+
"notice_content": "<span class=\"notice-title\">What do graduates do after leaving UW?</span><span class=\"notice-body-with-title\"></span>",
357+
"attributes": [],
358+
"category": "Graduation NextDestination",
359+
"sws_category": "Degree",
360+
"is_critical": false,
361+
"id_hash": "872f5b28b56e5e056d1f0ecbcf65dbc1",
362+
"is_read": false,
363+
"location_tags": [
364+
"graduation"
365+
]
366+
},
355367
{
356368
"notice_content": "<span class=\"notice-title\"> 2015-2016 FAFSA aid still available</span>&nbsp;<span class=\"notice-body-with-title\">You can still <a href=\"https://fafsa.gov\">apply for financial aid</a> even though the priority deadline has passed.</span>",
357369
"attributes": [

myuw_vue/tests/mock_data/notice/javerage.json

+12
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,18 @@
567567
"graduation"
568568
]
569569
},
570+
{
571+
"notice_content": "<span class=\"notice-title\">What do graduates do after leaving UW?</span><span class=\"notice-body-with-title\"></span>",
572+
"attributes": [],
573+
"category": "Graduation NextDestination",
574+
"sws_category": "Degree",
575+
"is_critical": false,
576+
"id_hash": "872f5b28b56e5e056d1f0ecbcf65dbc1",
577+
"is_read": false,
578+
"location_tags": [
579+
"graduation"
580+
]
581+
},
570582
{
571583
"notice_content": "<span class=\"notice-title\">How to update your diploma name and mailing address</span><span class=\"notice-body-with-title\"></span>",
572584
"attributes": [],

myuw_vue/tests/mock_data/notice/javg004.json

+12
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,18 @@
554554
"graduation"
555555
]
556556
},
557+
{
558+
"notice_content": "<span class=\"notice-title\">What do graduates do after leaving UW?</span><span class=\"notice-body-with-title\"></span>",
559+
"attributes": [],
560+
"category": "Graduation NextDestination",
561+
"sws_category": "Degree",
562+
"is_critical": false,
563+
"id_hash": "872f5b28b56e5e056d1f0ecbcf65dbc1",
564+
"is_read": false,
565+
"location_tags": [
566+
"graduation"
567+
]
568+
},
557569
{
558570
"notice_content": "<span class=\"notice-title\">How to update your diploma name and mailing address</span><span class=\"notice-body-with-title\"></span>",
559571
"attributes": [],

myuw_vue/tests/mock_data/profile/eight.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
"is_incomplete": true,
5454
"is_degree_earned_term": true,
5555
"before_degree_earned_term": false,
56-
"during_april_may": true
56+
"during_april_may": true,
57+
"last_4w_inst": true
5758
},
5859
{
5960
"campus": "TACOMA",
@@ -72,7 +73,8 @@
7273
"is_incomplete": false,
7374
"is_degree_earned_term": true,
7475
"before_degree_earned_term": false,
75-
"during_april_may": true
76+
"during_april_may": true,
77+
"last_4w_inst": true
7678
}
7779
],
7880
"error_code": null

myuw_vue/tests/mock_data/profile/javerage.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
"is_incomplete": false,
5454
"is_degree_earned_term": false,
5555
"before_degree_earned_term": true,
56-
"during_april_may": true
56+
"during_april_may": true,
57+
"last_4w_inst": true
5758
}
5859
],
5960
"error_code": null

myuw_vue/tests/mock_data/profile/javg003.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
"is_incomplete": false,
5454
"is_degree_earned_term": true,
5555
"before_degree_earned_term": false,
56-
"during_april_may": true
56+
"during_april_may": true,
57+
"last_4w_inst": true
5758
},
5859
{
5960
"campus": "SEATTLE",
@@ -72,7 +73,8 @@
7273
"is_incomplete": false,
7374
"is_degree_earned_term": true,
7475
"before_degree_earned_term": false,
75-
"during_april_may": true
76+
"during_april_may": true,
77+
"last_4w_inst": true
7678
}
7779
],
7880
"error_code": null

0 commit comments

Comments
 (0)