Skip to content

Commit 372003f

Browse files
authored
add instructor support call type (#1913)
* separate instructor preferences by TAs and Readers * show preference type on student form * separate preferences on staff form * add course title to reader positions * add staging * sort reader dropdown preferences * apply sorting preferences to instructor form
1 parent 62d54df commit 372003f

File tree

15 files changed

+120
-30
lines changed

15 files changed

+120
-30
lines changed

app/instructionalSupport/instructorSupportCallForm/InstructorSupportCallForm.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
<div class="instructor-support-call-form__section-group-list">
4040
<div class="instructor-support-call-form__sub-section-header">Courses</div>
4141
<section-group-list active-section-group-id="view.state.misc.activeSectionGroupId"
42+
active-appointment-type="view.state.misc.activeAppointmentType"
4243
all-tabs="view.state.misc.allTabs">
4344
</section-group-list>
4445
</div>
@@ -47,7 +48,8 @@
4748
<div class="instructor-support-call-form__sub-section-header">Preferences</div>
4849
<instructor-preferences section-group="view.state.sectionGroups.list[view.state.misc.activeSectionGroupId]"
4950
support-staff-list="view.state.supportStaff"
50-
active-support-staff-id="view.state.misc.activeSupportStaffId">
51+
active-support-staff-id="view.state.misc.activeSupportStaffId"
52+
active-appointment-type="view.state.misc.activeAppointmentType">
5153
</instructor-preferences>
5254
</div>
5355
</div>

app/instructionalSupport/instructorSupportCallForm/directives/instructorPreferences/instructorPreferences.html

+23-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="instructor-preferences">
22
<ul class="instructor-support-call-form__support-staff-list">
3-
<li ng-repeat="instructorPreference in sectionGroup.instructorPreferences | orderBy: 'priority'">
3+
<li ng-repeat="instructorPreference in instructorPreferences | orderBy: 'priority'">
44
<support-staff support-staff="instructorPreference"
55
instructor-preference="instructorPreference"
66
priority="instructorPreference.priority"
@@ -16,14 +16,28 @@
1616

1717
<div class="instructor-preferences__interested" ng-show="sectionGroup.eligibleSupportStaff.preferred.length > 0">
1818
<h5>Interested</h5>
19-
<ul class="instructor-support-call-form__support-staff-list">
20-
<li ng-repeat="supportStaff in sectionGroup.eligibleSupportStaff.preferred">
21-
<support-staff support-staff="supportStaff"
22-
priority="supportStaff.priority"
23-
active="(supportStaff.supportStaffId == activeSupportStaffId)">
24-
</support-staff>
25-
</li>
26-
</ul>
19+
<div ng-if="activeAppointmentType === 'teachingAssistant'">
20+
<ul class="instructor-support-call-form__support-staff-list">
21+
<li ng-repeat="supportStaff in sectionGroup.eligibleSupportStaff.tas">
22+
<support-staff support-staff="supportStaff"
23+
priority="supportStaff.priority"
24+
active="(supportStaff.supportStaffId == activeSupportStaffId)"
25+
type="activeAppointmentType">
26+
</support-staff>
27+
</li>
28+
</ul>
29+
</div>
30+
<div ng-if="activeAppointmentType === 'reader'">
31+
<ul class="instructor-support-call-form__support-staff-list">
32+
<li ng-repeat="supportStaff in sectionGroup.eligibleSupportStaff.readers">
33+
<support-staff support-staff="supportStaff"
34+
priority="supportStaff.priority"
35+
active="(supportStaff.supportStaffId == activeSupportStaffId)"
36+
type="activeAppointmentType">
37+
</support-staff>
38+
</li>
39+
</ul>
40+
</div>
2741
</div>
2842
<div class="instructor-preferences__other">
2943
<h5>Other</h6>

app/instructionalSupport/instructorSupportCallForm/directives/instructorPreferences/instructorPreferences.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,25 @@ let instructorPreferences = function ($rootScope, InstructorFormActions) {
1111
scope: {
1212
sectionGroup: '=',
1313
supportStaffList: '<',
14-
activeSupportStaffId: '<'
14+
activeSupportStaffId: '<',
15+
activeAppointmentType: '<'
1516
},
1617
link: function (scope) {
1718
scope.filteredSupportStaff = scope.sectionGroup.eligibleSupportStaff.other;
19+
scope.instructorPreferences = filterInstructorPreferences(scope.sectionGroup.instructorPreferences, scope.activeAppointmentType);
1820

1921
$rootScope.$on('instructorFormStateChanged', function (event, data) {
2022
scope.sectionGroup = data.sectionGroups.list[data.misc.activeSectionGroupId];
23+
scope.instructorPreferences = filterInstructorPreferences(scope.sectionGroup.instructorPreferences, data.misc.activeAppointmentType);
2124
scope.filteredSupportStaff = scope.sectionGroup.eligibleSupportStaff.other;
2225
});
2326

27+
function filterInstructorPreferences(instructorPreferences, activeAppointmentType) {
28+
return instructorPreferences.filter((ip) =>
29+
ip.appointmentType ? ip.appointmentType === activeAppointmentType : ip
30+
);
31+
}
32+
2433
scope.filterSupportStaff = function (searchQuery) {
2534
if (searchQuery.length >= 1) {
2635
var options = {
@@ -45,7 +54,7 @@ let instructorPreferences = function ($rootScope, InstructorFormActions) {
4554
};
4655

4756
scope.addPreference = function(sectionGroupId, supportStaffId) {
48-
InstructorFormActions.addInstructorPreference(sectionGroupId, supportStaffId);
57+
InstructorFormActions.addInstructorPreference(sectionGroupId, supportStaffId, scope.activeAppointmentType);
4958
};
5059

5160
scope.deleteInstructorPreference = function(preference) {

app/instructionalSupport/instructorSupportCallForm/directives/sectionGroupList/sectionGroupList.html

+11-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@
22
<ul class="section-group-list__container">
33
<li ng-repeat="sectionGroup in allTabs"
44
class="section-group-list__item"
5-
ng-class="{'active': sectionGroup.id === activeSectionGroupId}"
6-
ng-click="selectSectionGroup(sectionGroup)">
7-
<div>{{ sectionGroup.subjectCode + " " + sectionGroup.courseNumber + " " + sectionGroup.sequenceNumber }}</div>
8-
<div class="section-group-list__title">{{ sectionGroup.title }}</div>
5+
ng-class="{'active': sectionGroup.id === activeSectionGroupId && sectionGroup.appointmentType === activeAppointmentType}"
6+
ng-click="selectSectionGroup(sectionGroup)"
7+
style="display: flex; justify-content: space-between; align-items: center;">
8+
<div>
9+
<div>{{ sectionGroup.subjectCode + " " + sectionGroup.courseNumber + " " + sectionGroup.sequenceNumber }}</div>
10+
<div class="section-group-list__title">{{ sectionGroup.title }}</div>
11+
</div>
12+
<div>
13+
<div ng-if="sectionGroup.appointmentType === 'teachingAssistant'">TAs</div>
14+
<div ng-if="sectionGroup.appointmentType === 'reader'">Readers</div>
15+
</div>
916
</li>
1017
</ul>
1118
</div>

app/instructionalSupport/instructorSupportCallForm/directives/sectionGroupList/sectionGroupList.js

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ let sectionGroupList = function (InstructorFormActions) {
77
replace: true,
88
scope: {
99
activeSectionGroupId: '<',
10+
activeAppointmentType: '<',
1011
allTabs: '<'
1112
},
1213
link: function (scope) {

app/instructionalSupport/instructorSupportCallForm/services/instructorFormActions.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ class InstructorFormActions {
5555
InstructorFormStateService.reduce({
5656
type: ActionTypes.SELECT_SECTION_GROUP,
5757
payload: {
58-
activeSectionGroupId: sectionGroup.id
58+
activeSectionGroupId: sectionGroup.id,
59+
activeAppointmentType: sectionGroup.appointmentType
5960
}
6061
});
6162
},
@@ -70,7 +71,7 @@ class InstructorFormActions {
7071
});
7172
},
7273
addInstructorPreference: function (supportStaffId) {
73-
InstructorFormService.addInstructorPreference(InstructorFormStateService._state.misc.activeSectionGroupId, supportStaffId).then(function (newPreference) {
74+
InstructorFormService.addInstructorPreference(InstructorFormStateService._state.misc.activeSectionGroupId, supportStaffId, InstructorFormStateService._state.misc.activeAppointmentType).then(function (newPreference) {
7475
$rootScope.$emit('toast', { message: "Added Preference", type: "SUCCESS" });
7576
window.ipa_analyze_event('faculty_ta_form', 'added_support_staff_preference', newPreference.id);
7677

app/instructionalSupport/instructorSupportCallForm/services/instructorFormSelectors.js

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { _array_sortByProperty } from 'shared/helpers/array';
2+
13
class InstructorFormSelectors {
24
constructor () {
35
return {
@@ -53,6 +55,8 @@ class InstructorFormSelectors {
5355
});
5456

5557
sectionGroup.eligibleSupportStaff.preferred = [];
58+
sectionGroup.eligibleSupportStaff.tas = [];
59+
sectionGroup.eligibleSupportStaff.readers = [];
5660

5761
studentPreferences.ids.forEach(function (preferenceId) {
5862
var preference = studentPreferences.list[preferenceId];
@@ -67,6 +71,12 @@ class InstructorFormSelectors {
6771
preference.fullName = slotSupportStaff.fullName;
6872

6973
sectionGroup.eligibleSupportStaff.preferred.push(preference);
74+
75+
if (preference.type === "reader") {
76+
sectionGroup.eligibleSupportStaff.readers.push(preference);
77+
} else {
78+
sectionGroup.eligibleSupportStaff.tas.push(preference);
79+
}
7080
}
7181
});
7282

@@ -79,7 +89,11 @@ class InstructorFormSelectors {
7989
sectionGroup.eligibleSupportStaff.other.push(staff);
8090
}
8191
});
82-
92+
93+
sectionGroup.eligibleSupportStaff.tas = _array_sortByProperty(sectionGroup.eligibleSupportStaff.tas, ["priority", "lastName"]);
94+
sectionGroup.eligibleSupportStaff.readers = _array_sortByProperty(sectionGroup.eligibleSupportStaff.readers, ["priority", "lastName"]);
95+
sectionGroup.eligibleSupportStaff.other = _array_sortByProperty(sectionGroup.eligibleSupportStaff.other, ["lastName"]);
96+
8397
return sectionGroup;
8498
}
8599
};

app/instructionalSupport/instructorSupportCallForm/services/instructorFormService.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ class InstructorFormService {
44
getInitialState: function(workgroupId, year, termShortCode) {
55
return ApiService.get("/api/instructionalSupportInstructorFormView/workgroups/" + workgroupId + "/years/" + year + "/termCode/" + termShortCode);
66
},
7-
addInstructorPreference: function(sectionGroupId, supportStaffId) {
8-
return ApiService.post("/api/instructionalSupportInstructorFormView/sectionGroups/" + sectionGroupId + "/supportStaff/" + supportStaffId);
7+
addInstructorPreference: function(sectionGroupId, supportStaffId, appointmentType) {
8+
return ApiService.post("/api/instructionalSupportInstructorFormView/sectionGroups/" + sectionGroupId + "/supportStaff/" + supportStaffId + "/type/" + appointmentType);
99
},
1010
updateSupportCallResponse: function(instructorSupportCallResponse) {
1111
return ApiService.put("/api/instructionalSupportInstructorFormView/instructorSupportCallResponses/" + instructorSupportCallResponse.id, instructorSupportCallResponse);

app/instructionalSupport/instructorSupportCallForm/services/instructorFormStateService.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,29 @@ class InstructorFormStateService {
7171

7272
activeSectionGroupId = allTabs[0] ? allTabs[0].id : null;
7373

74+
// add appointment type
75+
var tabsByAppointmentType = [];
76+
allTabs.forEach(tab => {
77+
if (tab.teachingAssistantAppointments > 0) {
78+
tabsByAppointmentType.push({...tab, appointmentType: "teachingAssistant"});
79+
}
80+
if (tab.readerAppointments > 0) {
81+
tabsByAppointmentType.push({...tab, appointmentType: "reader"});
82+
}
83+
});
84+
7485
misc = {
75-
allTabs: allTabs,
86+
allTabs: tabsByAppointmentType,
7687
activeSectionGroupId: activeSectionGroupId,
88+
activeAppointmentType: tabsByAppointmentType[0]?.appointmentType,
7789
activeSupportStaffId: activeSupportStaffId
7890
};
7991

8092
misc.scheduleId = action.payload.scheduleId;
8193
return misc;
8294
case ActionTypes.SELECT_SECTION_GROUP:
8395
misc.activeSectionGroupId = action.payload.activeSectionGroupId;
96+
misc.activeAppointmentType = action.payload.activeAppointmentType;
8497
misc.activeSupportStaffId = null;
8598
return misc;
8699
case ActionTypes.SELECT_SUPPORT_STAFF:

app/instructionalSupport/studentSupportCallForm/directives/studentPreferences/studentPreferenceTable/studentPreferenceSelector/studentPreferenceSelector.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
ng-click="addPreference(preference, 'reader')">
4747
<a class="small">
4848
<span class="course-filter-item">
49-
{{ preference.subjectCode }} {{ preference.courseNumber }} - {{ preference.sequencePattern}}
49+
{{ preference.subjectCode }} {{ preference.courseNumber }}-{{ preference.sequencePattern}} {{ preference.title }}
5050
</span>
5151
</a>
5252
</li>

app/instructionalSupport/studentSupportCallForm/directives/studentPreferences/studentPreferenceTable/studentPreferenceTable.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<div class="ipa-table__body-cell ipa-table__body-cell--small">
4949
</div>
5050
<div class="ipa-table__body-cell ipa-table__body-cell--large">
51-
{{ preference.subjectCode }} {{ preference.courseNumber }} - {{ preference.sequencePattern }}
51+
{{ preference.subjectCode }} {{ preference.courseNumber }} - {{ preference.sequencePattern }} ({{ preference.type.camelToTitle() }})
5252
</div>
5353
<div class="ipa-table__body-cell ipa-table__body-cell--medium">
5454
<div ng-show="state.supportCallResponse.collectPreferenceComments && (!preference.comment || preference.comment.length == 0)">

app/shared/helpers/string_prototypes.js

+7
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,10 @@ String.prototype.getWeekDays = function () {
141141

142142
return dayStr;
143143
};
144+
145+
String.prototype.camelToTitle = function() {
146+
return this
147+
.replace(/([A-Z])/g, ' $1') // Add a space before uppercase letters
148+
.replace(/^./, (char) => char.toUpperCase()) // Capitalize the first character
149+
.trim(); // Remove leading/trailing spaces
150+
};

app/supportAssignment/directives/supportAssignmentTable/supportCoursesTab/assignSupportStaff/assignSupportStaff.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212

1313
<div class="assign-support-staff__dropdown">
1414
<div class="assign-support-staff__dropdown-group-name"
15-
ng-show="assignmentOptions.instructorPreferences && assignmentOptions.instructorPreferences.length > 0 && viewType == 'Teaching Assistants'">
15+
ng-show="assignmentOptions.instructorPreferences && assignmentOptions.instructorPreferences.length > 0">
1616
Instructor Preferences
1717
</div>
1818
<div class="assign-support-staff__dropdown-item"
19-
ng-show="assignmentOptions.instructorPreferences && assignmentOptions.instructorPreferences.length > 0 && viewType == 'Teaching Assistants'"
19+
ng-show="assignmentOptions.instructorPreferences && assignmentOptions.instructorPreferences.length > 0"
2020
ng-repeat="preference in assignmentOptions.instructorPreferences"
2121
ng-click="triggerSelection(preference)">
2222
<div class="assign-support-staff__priority-icon">

app/supportAssignment/services/supportSelectors.js

+25-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ class SupportSelectors {
6161
if (preference.sectionGroupId != sectionGroup.id) {
6262
return;
6363
}
64-
64+
65+
if (preference.appointmentType && preference.appointmentType !== 'teachingAssistant') {
66+
return;
67+
}
68+
6569
preference = self.addSupportStaffData(preference, supportStaffList);
6670

6771
sectionGroup.teachingAssistantAssignmentOptions.instructorPreferences.push(preference);
@@ -108,6 +112,22 @@ class SupportSelectors {
108112
sectionGroup.readerAssignmentOptions = {};
109113
sectionGroup.readerAssignmentOptions.instructorPreferences = [];
110114

115+
instructorPreferences.ids.forEach(function(preferenceId) {
116+
var preference = instructorPreferences.list[preferenceId];
117+
118+
if (preference.sectionGroupId != sectionGroup.id) {
119+
return;
120+
}
121+
if (preference.appointmentType && preference.appointmentType !== 'reader') {
122+
return;
123+
}
124+
125+
preference = self.addSupportStaffData(preference, supportStaffList);
126+
127+
sectionGroup.readerAssignmentOptions.instructorPreferences.push(preference);
128+
processedSupportStaffIds.push(preference.supportStaffId);
129+
});
130+
sectionGroup.readerAssignmentOptions.instructorPreferences = _array_sortByProperty(sectionGroup.readerAssignmentOptions.instructorPreferences, ["priority", "lastName"]);
111131

112132
// Add SupportStaff preferences
113133
sectionGroup.readerAssignmentOptions.supportStaffPreferences = [];
@@ -124,7 +144,8 @@ class SupportSelectors {
124144
sectionGroup.readerAssignmentOptions.supportStaffPreferences.push(preference);
125145
processedSupportStaffIds.push(preference.supportStaffId);
126146
});
127-
147+
sectionGroup.readerAssignmentOptions.supportStaffPreferences = _array_sortByProperty(sectionGroup.readerAssignmentOptions.supportStaffPreferences, ["priority", "lastName"]);
148+
128149
// Add Other options
129150
sectionGroup.readerAssignmentOptions.other = [];
130151
supportStaffList.ids.forEach(function(supportStaffId) {
@@ -137,7 +158,8 @@ class SupportSelectors {
137158
supportStaff.supportStaffId = supportStaff.id;
138159
sectionGroup.readerAssignmentOptions.other.push(supportStaff);
139160
});
140-
161+
162+
sectionGroup.readerAssignmentOptions.other = _array_sortByProperty(sectionGroup.readerAssignmentOptions.other, ["lastName"]);
141163

142164
// Add instructor preference comment to sectionGroup by following the relationship
143165
// sectionGroups -> instructorPreferences -> instructorSupportCallResponses

nginx.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ http {
4040

4141
add_header Access-Control-Allow-Origin "https://api.ipa.ucdavis.edu" always;
4242
add_header Cache-Control "no-cache";
43-
add_header Content-Security-Policy "default-src 'self'; connect-src https://api.ipa.ucdavis.edu https://dw.dss.ucdavis.edu; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://www.google-analytics.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; frame-src 'self' https://www.youtube.com;";
43+
add_header Content-Security-Policy "default-src 'self'; connect-src https://api.ipa.ucdavis.edu https://staging.api.ipa.ucdavis.edu https://dw.dss.ucdavis.edu; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://www.google-analytics.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; frame-src 'self' https://www.youtube.com;";
4444
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
4545
add_header X-Content-Type-Options "nosniff";
4646

0 commit comments

Comments
 (0)