Skip to content

Commit

Permalink
Merge pull request #912 from uw-it-aca/hotfix/MUWM-3997
Browse files Browse the repository at this point in the history
Hotfix/muwm 3997
  • Loading branch information
devights authored Oct 5, 2017
2 parents 521260a + 4a3f167 commit da1a286
Show file tree
Hide file tree
Showing 11 changed files with 150 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"Current": {
"ChangedSinceDate": "",
"CourseNumber": "552",
"CurriculumAbbreviation": "EDC&I",
"Href": "/student/v5/registration.json?year=2017&quarter=autumn&curriculum_abbreviation=EDC%26I&course_number=552&section_id=AA&reg_id=&is_active=&instructor_reg_id=&verbose=true&changed_since_date=&transcriptable_course=all&page_start=&page_size=10",
"InstructorRegID": "",
"IsActive": false,
"PageSize": "10",
"PageStart": null,
"Quarter": "autumn",
"RegID": null,
"SectionID": "A",
"TranscriptableCourse": "all",
"Verbose": true,
"Year": 2017
},
"Next": null,
"PageSize": "10",
"PageStart": null,
"Previous": null,
"Registrations": [
{
"AccessDateRangeEnd": "12/23/2017",
"AccessDateRangeStart": "09/13/2017",
"Auditor": false,
"Credits": "3",
"DuplicateCode": "",
"EducationUnitType": null,
"EndDate": "12/08/2017",
"FeeBaseType": "Course taken on fee basis",
"Grade": "X",
"GradeDate": "",
"GradeDocumentID": "",
"GradingSystem": null,
"HonorsCourse": false,
"Href": "/student/v5/registration/2017,autumn,EDC%26I,552,A,9136CCB8F66711D5BE060004AC494003,A.json",
"Instructor": null,
"IsActive": true,
"IsCredit": true,
"IsIndependentStart": false,
"Metadata": "RegistrationSourceLocation=SDB_EOS;",
"Person": {
"Href": "/student/v5/person/9136CCB8F66711D5BE060004AC494003.json",
"Name": "Average Student",
"RegID": "9136CCB8F66711D5BE060004AC494003"
},
"RepeatCourse": false,
"RepositoryTimeStamp": "9/6/2017 11:24:14 AM",
"RequestDate": "2017-09-06",
"RequestStatus": "ADDED TO CLASS",
"Section": {
"CourseNumber": "552",
"CurriculumAbbreviation": "EDC&I",
"Href": "/student/v5/course/2017,autumn,EDC%26I,552/A.json",
"Quarter": "autumn",
"SectionID": "A",
"Year": 2017
},
"StartDate": "09/27/2017",
"VariableCredit": false,
"WritingCourse": false
},
{
"AccessDateRangeEnd": "",
"AccessDateRangeStart": "",
"Auditor": false,
"Credits": "3",
"DuplicateCode": "",
"EducationUnitType": null,
"EndDate": "",
"FeeBaseType": "",
"Grade": "X",
"GradeDate": "",
"GradeDocumentID": "",
"GradingSystem": null,
"HonorsCourse": false,
"Href": "/student/v5/registration/2017,autumn,EDC%26I,552,A,9136CCB8F66711D5BE060004AC494002,.json",
"Instructor": null,
"IsActive": true,
"IsCredit": true,
"IsIndependentStart": false,
"Metadata": "RegistrationSourceLocation=SDB;",
"Person": {
"Href": "/student/v5/person/9136CCB8F66711D5BE060004AC494002.json",
"Name": "Average Student",
"RegID": "9136CCB8F66711D5BE060004AC494002"
},
"RepeatCourse": false,
"RepositoryTimeStamp": "8/23/2017 8:24:22 AM",
"RequestDate": "2017-07-14",
"RequestStatus": "ADDED TO CLASS",
"Section": {
"CourseNumber": "552",
"CurriculumAbbreviation": "EDC&I",
"Href": "/student/v5/course/2017,autumn,EDC%26I,552/A.json",
"Quarter": "autumn",
"SectionID": "A",
"Year": 2017
},
"StartDate": "",
"VariableCredit": false,
"WritingCourse": false
}
],
"TotalCount": 2
}
10 changes: 4 additions & 6 deletions myuw/static/js/card/instructor_schedule/course_resource_panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ var InstructorCourseResourcePanel = {
$(".create_email_list", panel).on("click", function(ev) {
var section_label = InstructorCourseResourcePanel.get_section_label(term, ev.currentTarget);
label = safe_label(section_label);
WSData.log_interaction("open_create_email_list_"+label, term);
WSData.log_interaction("open_create_email_list_"+label);
RequestEmailLists.render_init(section_label);
});

$(".manage_email_list", panel).on("click", function(ev) {
var section_label = InstructorCourseResourcePanel.get_section_label(term, ev.currentTarget);
label = safe_label(section_label);
WSData.log_interaction("open_manage_email_list_"+label, term);
WSData.log_interaction("open_manage_email_list_"+label);
ManageEmailLists.render_init(section_label);
});

Expand All @@ -66,10 +66,8 @@ var InstructorCourseResourcePanel = {
var top = window.screenY + 200;

window.open(ev.target.href, '_blank', 'scrollbars=1,resizable=1,width='+width+',height='+height+',left='+left+',top='+top);

var course_id = ev.currentTarget.getAttribute("rel");
course_id = course_id.replace(/[^a-z0-9]/gi, '_');
WSData.log_interaction("open_course_classlist_"+course_id, term);
var section_label = ev.currentTarget.getAttribute("rel");
WSData.log_interaction("open_course_classlist_"+section_label);
return false;
});
},
Expand Down
7 changes: 2 additions & 5 deletions myuw/static/js/handlebars-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,8 @@ Handlebars.registerHelper("safeLabel", function(str) {
return safe_label(str);
});

Handlebars.registerHelper("toUrlSafe", function(str) {
if(str) {
return str.replace(/ /g, "%20");
}
return str;
Handlebars.registerHelper("toUrlSafe", function(curr_abbr) {
return curr_abbr_url_safe(curr_abbr);
});

Handlebars.registerHelper("toLowerCase", function(str) {
Expand Down
8 changes: 8 additions & 0 deletions myuw/static/js/myuw_m.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ var safe_label = function(section_label) {
return section_label;
};

var curr_abbr_url_safe = function(curr_abbr) {
if(curr_abbr){
return curr_abbr.replace(/ /g, '%20').replace(/&/g, '%26');
}
return curr_abbr;
};

var titilizeTerm = function (term) {
//Takes a term string (Eg summer 2013, b-term)
//returns a title (Eg Summer 2013 B-Term)
Expand Down Expand Up @@ -311,6 +318,7 @@ exports.date_from_string = date_from_string;
exports.myuwFeatureEnabled = myuwFeatureEnabled;
exports.register_link_recorder = register_link_recorder;
exports.safe_label = safe_label;
exports.curr_abbr_url_safe = curr_abbr_url_safe;
exports.renderedCardOnce = renderedCardOnce;
exports.titilizeTerm = titilizeTerm;
exports.remove_card = remove_card;
2 changes: 1 addition & 1 deletion myuw/static/js/ws_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ WSData = {
},

fetch_instructed_section_details: function(section_label, callback, err_callback, args) {
var url = "/api/v1/instructor_section_details/" + section_label;
var url = "/api/v1/instructor_section_details/" + section_label.replace(/&/g, "%26");

if (WSData._is_running_url(url)) {
WSData._enqueue_callbacks_for_url(url, callback, err_callback, args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ <h4 class="myuw-card-row-heading">Enrollment</h4>
</div>
{{else}}
{{#if enrollment_student_name}}
<span>{{ enrollment_student_name }}</span> <a target="_blank" href="/teaching/{{ year }},{{ quarter }},{{ curriculum_abbr }},{{ course_number }}/{{ section_id }}/students" class="course_class_list" rel="{{ curriculum_abbr }} {{course_number}} {{section_id}}">View student</a>
<span>{{ enrollment_student_name }}</span> <a target="_blank" href="/teaching/{{ year }},{{ quarter }},{{ toUrlSafe curriculum_abbr }},{{ course_number }}/{{ section_id }}/students" class="course_class_list" rel="{{section_label}}">View student</a>
{{else}}
<span>{{ current_enrollment }}{{#unless is_independent_study}} of {{ limit_estimate_enrollment }}{{/unless}}</span> {{#if current_enrollment }}<a target="_blank" href="/teaching/{{ year }},{{ quarter }},{{ curriculum_abbr }},{{ course_number }}/{{ section_id }}/students" class="course_class_list" rel="{{ curriculum_abbr }} {{course_number}} {{section_id}}">View class list</a>{{/if}}
<span>{{ current_enrollment }}{{#unless is_independent_study}} of {{ limit_estimate_enrollment }}{{/unless}}</span>
{{#if current_enrollment }}
<a target="_blank" href="/teaching/{{ year }},{{ quarter }},{{ toUrlSafe curriculum_abbr }},{{ course_number }}/{{ section_id }}/students"
class="course_class_list" rel="{{section_label}}">View class list</a>
{{/if}}
{{/if}}
{{/if}}
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{% load templatetag_handlebars %}
{% tplhandlebars "instructor_section_card_no_course" %}
<div class="card" style="position:relative;" data-name="CourseCard" data-type="card" data-identifier="{{ curriculum_abbr }} {{course_number}} {{section_id}}">
<div class="container">
<div class="myuw-card" style="position:relative;" data-name="CourseCard" data-type="card" data-identifier="{{ curriculum_abbr }} {{course_number}} {{section_id}}">
<div class="fade-in">
<div id="course_wrapper{{index}}" class="OFF" style="position:relative;">
<h4><span class="courseIDtitle">No Course By This Label Exists</span></h4>
<h3 class="myuw-card-title">No Course Found</h3>
<div>
Shucks. It don't appear any courses by this label are currently being offered.
<p>No course information was found with this name and term.</p>
</div>
</div>
</div>
</div>
</div>
{% endtplhandlebars %}
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{% load templatetag_handlebars %}
{% tplhandlebars "instructor_section_card_not_instructor" %}
<div class="card" style="position:relative;" data-name="CourseCard" data-type="card" data-identifier="{{ curriculum_abbr }} {{course_number}} {{section_id}}">
<div class="container">
<div class="myuw-card" style="position:relative;" data-name="CourseCard" data-type="card" data-identifier="{{ curriculum_abbr }} {{course_number}} {{section_id}}">
<div class="fade-in">
<div id="course_wrapper{{index}}" class="OFF" style="position:relative;">
<h4><span class="courseIDtitle">Not Instructor On This Course</span></h4>
<h3 class="myuw-card-title">Access Denied</h3>
<div>
Sorry. We can't show you this course because you don't appear to be an instructor.
<p>You do not have the necessary previledges to view this class list because you are not listed as an instructor of record. Contact your department's time schedule coordinator to be added as an instructor, or contact <a href="mailto:[email protected]">[email protected]</a> for help.</p>
</div>
</div>
</div>
</div>
</div>
{% endtplhandlebars %}
2 changes: 2 additions & 0 deletions myuw/templates/teaching/photo_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

{% block teaching_content %}
{% include "handlebars/teaching/photo_list.html" %}
{% include "handlebars/card/instructor_schedule/no_section_card.html" %}
{% include "handlebars/card/instructor_schedule/not_instructor_card.html" %}
{% endblock %}

{% block extra_js %}
Expand Down
9 changes: 9 additions & 0 deletions myuw/test/dao/test_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,12 @@ def test_get_active_registrations_for_section(self):
self.assertEqual(len(registrations), 1)
enrolled_student = registrations[0].person
self.assertEqual(enrolled_student.uwnetid, "javg001")

section = get_section_by_label('2017,autumn,EDC&I,552/A')
self.assertEqual(section.section_label(), '2017,autumn,EDC&I,552/A')

regid = "10000000000000000000000000000006"
reg = get_active_registrations_for_section(section, regid)
self.assertEqual(len(reg), 2)
enrolled_student = reg[0].person
self.assertEqual(enrolled_student.uwnetid, "javg003")
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
'unittest2',
'AuthZ-Group',
'python-binary-memcached',
'UW-RestClients-Core<1.0,>=0.9.1',
'UW-RestClients-Core==0.9.1',
'UW-RestClients-SWS<2.0,>=1.4.4',
'UW-RestClients-PWS<1.0,>=0.6',
'UW-RestClients-HFS<1.0',
Expand Down

0 comments on commit da1a286

Please sign in to comment.