Skip to content

Commit d39ccfc

Browse files
authored
Merge pull request #3024 from uw-it-aca/qa
Qa
2 parents 3e419bb + 5c86462 commit d39ccfc

19 files changed

+384
-185
lines changed

myuw/data/resource_link_import.csv

+5-2
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,18 @@ Services for Faculty and Staff,Finance and Procurement,all,,,https://finance.uw.
5656
Services for Faculty and Staff,Finance and Procurement,all,"http://wd5.myworkday.com/uw/login.htmld ",Workday,,,,,,,no
5757
Services for Faculty and Staff,Others,all,http://registrar.washington.edu/staffandfaculty/electronic-academic-records-system-ears,Electronic Advising Records System (EARS),,,,,,,no
5858
Services for Faculty and Staff,Others,all,,,https://itconnect.uw.edu/,IT Connect,https://www.uwb.edu/it,Information Technologies,https://www.tacoma.uw.edu/uwt/it,Information Technology,no
59-
Services for Faculty and Staff,Others,all,https://itconnect.uw.edu/tools-services-support/software-computers/uware/,Software and Hardware,,,,,,,
59+
Services for Faculty and Staff,Others,all,https://itconnect.uw.edu/tools-services-support/software-computers/uware/,Software and Hardware,,,,,,,no
6060
Services for Faculty and Staff,Others,all,,,https://www.ehs.washington.edu/,Environmental Health & Safety,https://www.uwb.edu/safety/ehs-emergency/environment-health-safety,Environmental Health & Safety,https://www.tacoma.uw.edu/fa/environmental-health-safety,Environmental Health & Safety,no
6161
Services for Faculty and Staff,Others,all,,,https://facilities.uw.edu/,UW Facilities,https://www.uwb.edu/facilities/,Facilities and Campus Operations,https://www.tacoma.uw.edu/fa/facilities,Facilities Services,no
6262
Services for Faculty and Staff,Others,all,,,https://facilities.uw.edu/services/requests,UW Facilities: Request Service,http://dlweb.megamation.com/uwb/DLWEB.php/O4W_INFO_PAGE,Facilities Maintenance Request,https://www.tacoma.uw.edu/fa/facilities/work-order-request,Facilities Services: Work Order Request,no
63+
Services for Faculty and Staff,Others,all,https://astra.admin.uw.edu/astra/,ASTRA,,,,,,,no
6364
Campus Life,Campus Retail,all,,,http://www.bookstore.washington.edu/student_faculty/student_faculty.taf?verba=uwseattle,University Book Store,http://www.bookstore.washington.edu/student_faculty/student_faculty.taf?verba=uwbothell,University Book Store,http://www.bookstore.washington.edu/student_faculty/student_faculty.taf?verba=uwtacoma,University Book Store,no
6465
Campus Life,Campus Safety,all,,,https://www.washington.edu/safety/,Campus Safety,https://www.uwb.edu/safety,Campus Safety Department,https://www.tacoma.uw.edu/uwt/fa/safety/,Campus Safety & Security,no
6566
Campus Life,Campus Safety,all,http://www.washington.edu/safecampus/,SafeCampus,,,,,,,no
6667
Campus Life,Campus Safety,all,,,https://www.ehs.washington.edu/,Environmental Health & Safety,https://www.uwb.edu/safety/ehs-emergency/environment-health-safety,Environmental Health & Safety,https://www.tacoma.uw.edu/fa/environmental-health-safety,Environmental Health & Safety,no
6768
Campus Life,Campus Safety,all,https://cspc.admin.uw.edu/mychem,MyChem,,,,,,,no
6869
Campus Life,Campus Safety,all,,,https://www.washington.edu/uwem/,UW Emergency Management,https://www.uwb.edu/emergency,UW Bothell Emergency Page,https://www.tacoma.uw.edu/fa/safety/emergency-preparedness,UW Tacoma Emergency Response,no
70+
Campus Life,Campus Safety,all,https://www.washington.edu/titleix/report/,Make a Title IX report,,,,,,,no
6971
Campus Life,Getting Around Campus,all,,,http://www.washington.edu/maps/,Campus Map,https://www.uwb.edu/wp-content/uploads/2023/09/uw-bothell-campus-map.pdf,Campus Map,http://www.tacoma.uw.edu/campus-map/campus-map,Campus Map,no
7072
Campus Life,Getting Around Campus,all,,,https://facilities.uw.edu/transportation/park-directions,Getting to Seattle Campus,http://www.uwb.edu/visitors/directions,Getting to UW Bothell Campus,https://www.tacoma.uw.edu/fa/facilities/transportation/parking-and-transportation-resources#permalink-19448,Getting to UW Tacoma Campus,no
7173
Campus Life,Getting Around Campus,all,,,https://facilities.uw.edu/transportation/student-u-pass,U-PASS for Students,https://www.uwb.edu/commuter-services/transportation/upass,U-PASS,https://www.tacoma.uw.edu/uwt/fa/facilities/transportation/u-pass,U-PASS,no
@@ -97,10 +99,11 @@ Campus Life,Support Services,all,http://grad.uw.edu/diversity/go-map/,Graduate O
9799
Campus Life,Support Services,all,https://sites.uw.edu/qcenter/,Q Center,,,,,,,no
98100
Campus Life,Support Services,all,http://depts.washington.edu/womenctr/,Women's Center,,,,,,,no
99101
Campus Life,Support Services,all,https://www.washington.edu/ombud/,Office of the Ombud,,,,,,,no
100-
Campus Life,Support Services,all,https://www.washington.edu/compliance/titleix/,Discrimination and Title IX Compliance,,,,,,,no
102+
Campus Life,Support Services,all,https://www.washington.edu/compliance/titleix/,Office of the Title IX Coordinator,,,,,,,no
101103
Campus Life,Support Services,all,http://www.washington.edu/bias/,Reporting Bias Incidents,,,,,,,no
102104
Campus Life,Support Services,all,http://www.washington.edu/sexualassault/,Sexual Assault Resources,,,,,,,no
103105
Campus Life,Support Services,all,http://depts.washington.edu/slsuw/,Student Legal Services,,,,,,,no
106+
Campus Life,Support Services,all,https://www.washington.edu/cr-investigations/,Civil Rights Investigation Office,,,,,,,no
104107
Employment,Employment Resources,all,,,http://careers.uw.edu/,Career & Internship Center,http://www.bothell.washington.edu/careers,Career Services,https://www.tacoma.uw.edu/uwt/career,Career Development,no
105108
Employment,Employment Resources,all,https://wd5.myworkday.com/uw/d/home.htmld,Workday,,,,,,,no
106109
Employment,Employment Resources,all,https://prp.admin.uw.edu/legacyess,Legacy ESS,,,,,,,no

myuw/test/api/test_books.py

-65
This file was deleted.
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright 2023 UW-IT, University of Washington
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
import json
5+
from myuw.test.api import require_url, MyuwApiTest
6+
from myuw.dao.registration import get_schedule_by_term
7+
from myuw.dao.instructor_schedule import get_instructor_schedule_by_term
8+
from myuw.views.api.textbook import (
9+
get_textbook_by_schedule, _get_schedule_textbooks, index_by_sln)
10+
from myuw.test import get_request_with_user, get_request_with_date
11+
12+
13+
@require_url('myuw_current_book')
14+
class TestInstructorTextbookCur(MyuwApiTest):
15+
16+
def test_get(self):
17+
self.set_user('billpce')
18+
self.set_date("2013-10-16 09:00:00")
19+
resp = self.get_response_by_reverse('myuw_current_book')
20+
data = json.loads(resp.content)
21+
self.assertEqual(data, {'21838': []})
22+
23+
def test_get_uwt_inst_textbook(self):
24+
# MUWM-5311: uwt no longer has books
25+
req = get_request_with_user('billtac',
26+
get_request_with_date("2013-04-01"))
27+
schedule = get_instructor_schedule_by_term(req)
28+
bkData = get_textbook_by_schedule(schedule)
29+
self.assertEqual(bkData, {})
30+
self.assertEqual(index_by_sln(bkData), {})
31+
32+
data = _get_schedule_textbooks(schedule)
33+
self.assertEqual(data, {})
34+
35+
self.set_user('billtac')
36+
resp = self.get_response_by_reverse('myuw_current_book')
37+
data = json.loads(resp.content)
38+
self.assertEqual(data, {})

myuw/test/api/test_textbook.py

+48-9
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,54 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
import json
5-
from myuw.test.api import require_url, MyuwApiTest
5+
from myuw.test.api import MyuwApiTest, require_url, fdao_bookstore_override
6+
from myuw.test import get_request_with_user, get_request_with_date
67

78

8-
@require_url('myuw_current_book')
9-
class TestInstructorTextbookCur(MyuwApiTest):
9+
VERBACOMPARE_URL_PREFIX = 'http://uw-seattle.verbacompare.com'
10+
IMAGE_URL_PREFIX = 'www7.bookstore.washington.edu/MyUWImage.taf'
1011

11-
def test_get(self):
12-
self.set_user('billpce')
13-
self.set_date("2013-10-16 09:00:00")
14-
resp = self.get_response_by_reverse('myuw_current_book')
15-
data = json.loads(resp.content)
16-
self.assertEqual(data, {'21838': []})
12+
13+
@fdao_bookstore_override
14+
class TestApiBooks(MyuwApiTest):
15+
'''Tests textbooks api'''
16+
17+
@require_url('myuw_home')
18+
def test_javerage_books(self):
19+
self.set_user('javerage')
20+
response = self.get_response_by_reverse(
21+
'myuw_book_api',
22+
kwargs={'year': 2013,
23+
'quarter': 'spring',
24+
'summer_term': ''})
25+
self.assertEquals(response.status_code, 200)
26+
27+
data = json.loads(response.content)
28+
29+
self.assertEquals(data["order_url"],
30+
('http://www.ubookstore.com/adoption-search' +
31+
'-results?ccid=9335,1132,5320,2230,4405'))
32+
33+
self.assertGreaterEqual(len(data['18532']), 1)
34+
book = data['18532'][0]
35+
self.assertEquals(
36+
book["cover_image_url"],
37+
("%s?isbn=9780878935970&key=46c9ef715edb2ec69517e2c8e6ec9c18" %
38+
IMAGE_URL_PREFIX))
39+
self.assertEquals(len(book["authors"]), 1)
40+
self.assertTrue(book["is_required"])
41+
self.assertIsNone(book["price"])
42+
self.assertIsNone(book["used_price"])
43+
self.assertEquals(book["isbn"], '9780878935970')
44+
self.assertEquals(book["notes"], 'required')
45+
self.assertIsNone(book["price"])
46+
47+
@require_url('myuw_home')
48+
def test_no_sche_books(self):
49+
self.set_user('billtac') # MUWM-5311
50+
response = self.get_response_by_reverse(
51+
'myuw_book_api',
52+
kwargs={'year': 2013,
53+
'quarter': 'spring',
54+
'summer_term': ''})
55+
self.assertEquals(response.status_code, 200)

myuw/test/dao/test_textbook.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,15 @@ def test_get_order_url_by_schedule(self):
4646
def test_get_inst_textbook(self):
4747
req = get_request_with_user('billpce',
4848
get_request_with_date("2013-10-01"))
49-
term = get_current_quarter(req)
5049
schedule = get_instructor_schedule_by_term(req)
5150

5251
books = get_textbook_by_schedule(schedule)
5352
self.assertEquals(len(books), 1)
53+
54+
def test_get_uwt_inst_textbook(self):
55+
req = get_request_with_user('billtac',
56+
get_request_with_date("2013-04-01"))
57+
schedule = get_instructor_schedule_by_term(req)
58+
self.assertEqual(len(schedule.sections), 3)
59+
books = get_textbook_by_schedule(schedule)
60+
self.assertEquals(len(books), 0)

myuw/views/api/textbook.py

+13-11
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def respond(self, timer, request, term, summer_term):
4242
try:
4343
schedule = get_schedule_by_term(
4444
request, term=term, summer_term=summer_term)
45-
by_sln.update(self._get_schedule_textbooks(schedule))
45+
by_sln.update(_get_schedule_textbooks(schedule))
4646

4747
order_url = get_order_url_by_schedule(schedule)
4848
if order_url:
@@ -55,14 +55,15 @@ def respond(self, timer, request, term, summer_term):
5555
try:
5656
schedule = get_instructor_schedule_by_term(
5757
request, term=term, summer_term="full-term")
58-
by_sln.update(self._get_schedule_textbooks(schedule))
58+
by_sln.update(_get_schedule_textbooks(schedule))
5959
except DataFailureException as ex:
6060
if ex.status != 404:
6161
raise
6262

63-
if len(by_sln) == 0:
64-
log_data_not_found_response(logger, timer)
65-
return data_not_found()
63+
# MUWM-5311: uwt no longer has books
64+
# if len(by_sln) == 0:
65+
# log_data_not_found_response(logger, timer)
66+
# return data_not_found()
6667

6768
log_api_call(timer, request, "Get Textbook for {}.{}".format(
6869
term.year, term.quarter))
@@ -71,12 +72,13 @@ def respond(self, timer, request, term, summer_term):
7172
except Exception:
7273
return handle_exception(logger, timer, traceback)
7374

74-
def _get_schedule_textbooks(self, schedule):
75-
by_sln = {}
76-
if schedule and len(schedule.sections):
77-
book_data = get_textbook_by_schedule(schedule)
78-
by_sln.update(index_by_sln(book_data))
79-
return by_sln
75+
76+
def _get_schedule_textbooks(schedule):
77+
by_sln = {}
78+
if schedule and len(schedule.sections):
79+
book_data = get_textbook_by_schedule(schedule)
80+
by_sln.update(index_by_sln(book_data))
81+
return by_sln
8082

8183

8284
def index_by_sln(book_data):

myuw_vue/components/_common/course/student/resources.vue

+5-18
Original file line numberDiff line numberDiff line change
@@ -30,39 +30,26 @@
3030
</li>
3131
</template>
3232
<li v-if="section.sln" class="mb-1">
33-
<a
34-
:href="textbookHref"
35-
:title="`Textbooks of ${section.label}`"
36-
>
37-
Textbooks
38-
</a>
33+
<uw-textbook :section="section" />
3934
</li>
4035
</ul>
4136
</div>
4237
</div>
4338
</template>
4439

4540
<script>
41+
import TextbookLink from '../textbook.vue';
4642
export default {
43+
components: {
44+
'uw-textbook': TextbookLink,
45+
},
4746
props: {
4847
section: {
4948
type: Object,
5049
required: true,
5150
},
5251
},
5352
computed: {
54-
textbookHref() {
55-
let url = `/textbooks/${this.section.year},${this.section.quarter}`;
56-
57-
if (this.section.requestSummerTerm) {
58-
url += `,${this.section.requestSummerTerm.toLowerCase()}`;
59-
}
60-
url += `/${this.section.curriculum_abbr}${
61-
this.section.course_number
62-
}${this.section.section_id}`;
63-
64-
return url;
65-
},
6653
hasResources() {
6754
return (
6855
this.section.class_website_url ||
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<template>
2+
<a
3+
:href="uwtCourse ? uwtTextbookUrl : textbookPageUrl"
4+
:title="`Textbooks of ${section.label}`"
5+
>Textbooks</a>
6+
</template>
7+
8+
<script>
9+
export default {
10+
props: {
11+
section: {
12+
type: Object,
13+
required: true,
14+
},
15+
},
16+
computed: {
17+
termId() {
18+
if (this.section.quarter.toLowerCase() === "winter") return "1";
19+
if (this.section.quarter.toLowerCase() === "spring") return "2";
20+
if (this.section.quarter.toLowerCase() === "summer") return "3";
21+
return "4";
22+
},
23+
uwtTextbookUrl() {
24+
// MUWM-5311
25+
return (
26+
"https://www.bkstr.com/webApp/discoverView?" +
27+
"bookstore_id-1=2335&div-1=&term_id-1=" +
28+
String(this.section.year) + this.termId +
29+
"&dept-1=" + encodeURIComponent(this.section.curriculum_abbr) +
30+
"&course-1=" + this.section.course_number +
31+
"&section-1=" + this.section.section_id);
32+
},
33+
uwtCourse() {
34+
return this.section.course_campus.toLowerCase() === 'tacoma';
35+
},
36+
textbookPageUrl() {
37+
let url = `/textbooks/${this.section.year},${this.section.quarter}`;
38+
39+
if (this.section.requestSummerTerm) {
40+
url += `,${this.section.requestSummerTerm.toLowerCase()}`;
41+
}
42+
url += (
43+
'#' + this.section.curriculum_abbr +
44+
this.section.course_number + this.section.section_id);
45+
46+
return url;
47+
},
48+
},
49+
};
50+
</script>

0 commit comments

Comments
 (0)