Skip to content

Commit 4216f7c

Browse files
authored
Merge pull request #3162 from uw-it-aca/qa
Resolve MUWM-5364 (#3161)
2 parents 76ceffd + 4491413 commit 4216f7c

File tree

5 files changed

+33
-14
lines changed

5 files changed

+33
-14
lines changed

myuw/test/util/test_cache.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,21 @@ def test_get_cache_time(self):
5454
self.assertEqual(cache.get_cache_expiration_time(
5555
"sws", "/student/v5/section", status=404), 60 * 7)
5656
self.assertEqual(cache.get_cache_expiration_time(
57-
"sws", "/student/v5/section", status=503), 60 * 15)
57+
"sws", "/student/v5/section", status=503), 60 * 7)
5858

5959
self.assertEqual(cache.get_cache_expiration_time(
6060
"gws", "/group_sws/v3"), HALF_HOUR)
6161
self.assertEqual(cache.get_cache_expiration_time(
6262
"gws", "/group_sws/v3", status=404), 60 * 7)
6363
self.assertEqual(cache.get_cache_expiration_time(
64-
"gws", "/group_sws/v3", status=500), 60 * 15)
64+
"gws", "/group_sws/v3", status=500), 60 * 7)
6565

6666
self.assertEqual(cache.get_cache_expiration_time(
6767
"pws", "/identity/v2/person"), ONE_HOUR)
6868
self.assertEqual(cache.get_cache_expiration_time(
6969
"pws", "/identity/v2/person", status=404), 60 * 7)
7070
self.assertEqual(cache.get_cache_expiration_time(
71-
"pws", "/identity/v2/person", status=503), 60 * 15)
71+
"pws", "/identity/v2/person", status=503), 60 * 7)
7272

7373
self.assertEqual(cache.get_cache_expiration_time(
7474
"uwnetid", "/nws/v1/uwnetid"), FOUR_HOURS)
@@ -77,7 +77,7 @@ def test_get_cache_time(self):
7777
self.assertEqual(cache.get_cache_expiration_time(
7878
"uwnetid", "/nws/v1/uwnetid", status=409), 60 * 7)
7979
self.assertEqual(cache.get_cache_expiration_time(
80-
"uwnetid", "/nws/v1/uwnetid", status=500), 60 * 15)
80+
"uwnetid", "/nws/v1/uwnetid", status=500), 60 * 7)
8181

8282
self.assertEqual(cache.get_cache_expiration_time(
8383
"grad", "/services/students"), FOUR_HOURS)
@@ -99,12 +99,12 @@ def test_get_cache_time(self):
9999
self.assertEqual(cache.get_cache_expiration_time(
100100
"mailman", "/uw_list_manager/api/v1/list/", status=404), 60 * 7)
101101
self.assertEqual(cache.get_cache_expiration_time(
102-
"mailman", "/uw_list_manager/api/v1/list/", status=500), 60 * 15)
102+
"mailman", "/uw_list_manager/api/v1/list/", status=500), 60 * 7)
103103

104104
self.assertEqual(cache.get_cache_expiration_time(
105105
"uwidp", "/idp/profile/oidc/keyset", status=404), 60 * 7)
106106
self.assertEqual(cache.get_cache_expiration_time(
107-
"uwidp", "/idp/profile/oidc/keyset", status=500), 60 * 15)
107+
"uwidp", "/idp/profile/oidc/keyset", status=500), 60 * 7)
108108

109109

110110
class TestMyUWCache(TestCase):

myuw/util/cache.py

-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ def get_cache_expiration_time(self, service, url, status=None):
2525
return FIVE_SECONDS
2626

2727
if status and status != 200:
28-
if status >= 500:
29-
return FIFTEEN_MINS
3028
return SEVEN_MINS
3129

3230
if "sws" == service:

myuw/views/rest_search.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ def get_proxy_url(self, request, service, url):
3636
elif service == "canvas":
3737
regid = get_regid(get_input_value(request.POST, "uwregid"))
3838
url = (
39-
f"api/v1/users/sis_user_id:{regid}/enrollments?" +
40-
f"state[]=active&type[]=StudentEnrollment")
39+
f"api/v1/users/sis_user_id:{regid}/enrollments?state[]=active"
40+
+ f"&type[]=StudentEnrollment&page=first&per_page=500"
41+
)
4142
elif service == "grad":
4243
params = self.format_params(request)
4344
params['id'] = get_student_system_key(params['id'])

myuw_vue/components/home/summaries.vue

+13-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
</span>
4848
</a>
4949
</div>
50-
<div v-if="isHfsReady || isLibraryReady" class="col-md-10">
50+
<div v-if="loadData && (isHfsReady || isLibraryReady)" class="col-md-10">
5151
<div class="row float-md-end" style="padding: 0 10px;">
5252
<a
5353
v-if="hfs && hfs.student_husky_card"
@@ -162,6 +162,11 @@ export default {
162162
computed: {
163163
...mapState({
164164
termData: (state) => state.termData,
165+
alum: (state) => state.user.affiliations.alumni,
166+
student: (state) => state.user.affiliations.student,
167+
employee: (state) => state.user.affiliations.all_employee,
168+
past_stud: (state) => state.user.affiliations.past_stud,
169+
past_emp: (state) => state.user.affiliations.past_employee,
165170
}),
166171
...mapState('hfs', {
167172
hfs: (state) => state.value,
@@ -177,10 +182,15 @@ export default {
177182
isLibraryReady: 'isReady',
178183
isLibraryErrored: 'isErrored',
179184
}),
185+
loadData() {
186+
return (this.alum || this.student || this.past_stud || this.employee || this.past_emp);
187+
},
180188
},
181189
mounted() {
182-
this.fetchHfs();
183-
this.fetchLibrary();
190+
if (this.loadData) {
191+
this.fetchHfs();
192+
this.fetchLibrary();
193+
}
184194
},
185195
methods: {
186196
...mapActions('hfs', {

myuw_vue/tests/summaries.test.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,17 @@ describe('Summaries', () => {
2121
hfs,
2222
library,
2323
},
24-
state: {},
24+
state: {
25+
user: {
26+
affiliations: {
27+
alumni: false,
28+
student: false,
29+
past_stud: false,
30+
all_employee: false,
31+
past_employee: false,
32+
}
33+
}
34+
},
2535
});
2636
});
2737

0 commit comments

Comments
 (0)