Skip to content

Commit

Permalink
add instructor support call type (#1913)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jaroldwong authored Jan 15, 2025
1 parent 62d54df commit 372003f
Show file tree
Hide file tree
Showing 15 changed files with 120 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<div class="instructor-support-call-form__section-group-list">
<div class="instructor-support-call-form__sub-section-header">Courses</div>
<section-group-list active-section-group-id="view.state.misc.activeSectionGroupId"
active-appointment-type="view.state.misc.activeAppointmentType"
all-tabs="view.state.misc.allTabs">
</section-group-list>
</div>
Expand All @@ -47,7 +48,8 @@
<div class="instructor-support-call-form__sub-section-header">Preferences</div>
<instructor-preferences section-group="view.state.sectionGroups.list[view.state.misc.activeSectionGroupId]"
support-staff-list="view.state.supportStaff"
active-support-staff-id="view.state.misc.activeSupportStaffId">
active-support-staff-id="view.state.misc.activeSupportStaffId"
active-appointment-type="view.state.misc.activeAppointmentType">
</instructor-preferences>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="instructor-preferences">
<ul class="instructor-support-call-form__support-staff-list">
<li ng-repeat="instructorPreference in sectionGroup.instructorPreferences | orderBy: 'priority'">
<li ng-repeat="instructorPreference in instructorPreferences | orderBy: 'priority'">
<support-staff support-staff="instructorPreference"
instructor-preference="instructorPreference"
priority="instructorPreference.priority"
Expand All @@ -16,14 +16,28 @@

<div class="instructor-preferences__interested" ng-show="sectionGroup.eligibleSupportStaff.preferred.length > 0">
<h5>Interested</h5>
<ul class="instructor-support-call-form__support-staff-list">
<li ng-repeat="supportStaff in sectionGroup.eligibleSupportStaff.preferred">
<support-staff support-staff="supportStaff"
priority="supportStaff.priority"
active="(supportStaff.supportStaffId == activeSupportStaffId)">
</support-staff>
</li>
</ul>
<div ng-if="activeAppointmentType === 'teachingAssistant'">
<ul class="instructor-support-call-form__support-staff-list">
<li ng-repeat="supportStaff in sectionGroup.eligibleSupportStaff.tas">
<support-staff support-staff="supportStaff"
priority="supportStaff.priority"
active="(supportStaff.supportStaffId == activeSupportStaffId)"
type="activeAppointmentType">
</support-staff>
</li>
</ul>
</div>
<div ng-if="activeAppointmentType === 'reader'">
<ul class="instructor-support-call-form__support-staff-list">
<li ng-repeat="supportStaff in sectionGroup.eligibleSupportStaff.readers">
<support-staff support-staff="supportStaff"
priority="supportStaff.priority"
active="(supportStaff.supportStaffId == activeSupportStaffId)"
type="activeAppointmentType">
</support-staff>
</li>
</ul>
</div>
</div>
<div class="instructor-preferences__other">
<h5>Other</h6>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,25 @@ let instructorPreferences = function ($rootScope, InstructorFormActions) {
scope: {
sectionGroup: '=',
supportStaffList: '<',
activeSupportStaffId: '<'
activeSupportStaffId: '<',
activeAppointmentType: '<'
},
link: function (scope) {
scope.filteredSupportStaff = scope.sectionGroup.eligibleSupportStaff.other;
scope.instructorPreferences = filterInstructorPreferences(scope.sectionGroup.instructorPreferences, scope.activeAppointmentType);

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

function filterInstructorPreferences(instructorPreferences, activeAppointmentType) {
return instructorPreferences.filter((ip) =>
ip.appointmentType ? ip.appointmentType === activeAppointmentType : ip
);
}

scope.filterSupportStaff = function (searchQuery) {
if (searchQuery.length >= 1) {
var options = {
Expand All @@ -45,7 +54,7 @@ let instructorPreferences = function ($rootScope, InstructorFormActions) {
};

scope.addPreference = function(sectionGroupId, supportStaffId) {
InstructorFormActions.addInstructorPreference(sectionGroupId, supportStaffId);
InstructorFormActions.addInstructorPreference(sectionGroupId, supportStaffId, scope.activeAppointmentType);
};

scope.deleteInstructorPreference = function(preference) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@
<ul class="section-group-list__container">
<li ng-repeat="sectionGroup in allTabs"
class="section-group-list__item"
ng-class="{'active': sectionGroup.id === activeSectionGroupId}"
ng-click="selectSectionGroup(sectionGroup)">
<div>{{ sectionGroup.subjectCode + " " + sectionGroup.courseNumber + " " + sectionGroup.sequenceNumber }}</div>
<div class="section-group-list__title">{{ sectionGroup.title }}</div>
ng-class="{'active': sectionGroup.id === activeSectionGroupId && sectionGroup.appointmentType === activeAppointmentType}"
ng-click="selectSectionGroup(sectionGroup)"
style="display: flex; justify-content: space-between; align-items: center;">
<div>
<div>{{ sectionGroup.subjectCode + " " + sectionGroup.courseNumber + " " + sectionGroup.sequenceNumber }}</div>
<div class="section-group-list__title">{{ sectionGroup.title }}</div>
</div>
<div>
<div ng-if="sectionGroup.appointmentType === 'teachingAssistant'">TAs</div>
<div ng-if="sectionGroup.appointmentType === 'reader'">Readers</div>
</div>
</li>
</ul>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ let sectionGroupList = function (InstructorFormActions) {
replace: true,
scope: {
activeSectionGroupId: '<',
activeAppointmentType: '<',
allTabs: '<'
},
link: function (scope) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ class InstructorFormActions {
InstructorFormStateService.reduce({
type: ActionTypes.SELECT_SECTION_GROUP,
payload: {
activeSectionGroupId: sectionGroup.id
activeSectionGroupId: sectionGroup.id,
activeAppointmentType: sectionGroup.appointmentType
}
});
},
Expand All @@ -70,7 +71,7 @@ class InstructorFormActions {
});
},
addInstructorPreference: function (supportStaffId) {
InstructorFormService.addInstructorPreference(InstructorFormStateService._state.misc.activeSectionGroupId, supportStaffId).then(function (newPreference) {
InstructorFormService.addInstructorPreference(InstructorFormStateService._state.misc.activeSectionGroupId, supportStaffId, InstructorFormStateService._state.misc.activeAppointmentType).then(function (newPreference) {
$rootScope.$emit('toast', { message: "Added Preference", type: "SUCCESS" });
window.ipa_analyze_event('faculty_ta_form', 'added_support_staff_preference', newPreference.id);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { _array_sortByProperty } from 'shared/helpers/array';

class InstructorFormSelectors {
constructor () {
return {
Expand Down Expand Up @@ -53,6 +55,8 @@ class InstructorFormSelectors {
});

sectionGroup.eligibleSupportStaff.preferred = [];
sectionGroup.eligibleSupportStaff.tas = [];
sectionGroup.eligibleSupportStaff.readers = [];

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

sectionGroup.eligibleSupportStaff.preferred.push(preference);

if (preference.type === "reader") {
sectionGroup.eligibleSupportStaff.readers.push(preference);
} else {
sectionGroup.eligibleSupportStaff.tas.push(preference);
}
}
});

Expand All @@ -79,7 +89,11 @@ class InstructorFormSelectors {
sectionGroup.eligibleSupportStaff.other.push(staff);
}
});


sectionGroup.eligibleSupportStaff.tas = _array_sortByProperty(sectionGroup.eligibleSupportStaff.tas, ["priority", "lastName"]);
sectionGroup.eligibleSupportStaff.readers = _array_sortByProperty(sectionGroup.eligibleSupportStaff.readers, ["priority", "lastName"]);
sectionGroup.eligibleSupportStaff.other = _array_sortByProperty(sectionGroup.eligibleSupportStaff.other, ["lastName"]);

return sectionGroup;
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ class InstructorFormService {
getInitialState: function(workgroupId, year, termShortCode) {
return ApiService.get("/api/instructionalSupportInstructorFormView/workgroups/" + workgroupId + "/years/" + year + "/termCode/" + termShortCode);
},
addInstructorPreference: function(sectionGroupId, supportStaffId) {
return ApiService.post("/api/instructionalSupportInstructorFormView/sectionGroups/" + sectionGroupId + "/supportStaff/" + supportStaffId);
addInstructorPreference: function(sectionGroupId, supportStaffId, appointmentType) {
return ApiService.post("/api/instructionalSupportInstructorFormView/sectionGroups/" + sectionGroupId + "/supportStaff/" + supportStaffId + "/type/" + appointmentType);
},
updateSupportCallResponse: function(instructorSupportCallResponse) {
return ApiService.put("/api/instructionalSupportInstructorFormView/instructorSupportCallResponses/" + instructorSupportCallResponse.id, instructorSupportCallResponse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,29 @@ class InstructorFormStateService {

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

// add appointment type
var tabsByAppointmentType = [];
allTabs.forEach(tab => {
if (tab.teachingAssistantAppointments > 0) {
tabsByAppointmentType.push({...tab, appointmentType: "teachingAssistant"});
}
if (tab.readerAppointments > 0) {
tabsByAppointmentType.push({...tab, appointmentType: "reader"});
}
});

misc = {
allTabs: allTabs,
allTabs: tabsByAppointmentType,
activeSectionGroupId: activeSectionGroupId,
activeAppointmentType: tabsByAppointmentType[0]?.appointmentType,
activeSupportStaffId: activeSupportStaffId
};

misc.scheduleId = action.payload.scheduleId;
return misc;
case ActionTypes.SELECT_SECTION_GROUP:
misc.activeSectionGroupId = action.payload.activeSectionGroupId;
misc.activeAppointmentType = action.payload.activeAppointmentType;
misc.activeSupportStaffId = null;
return misc;
case ActionTypes.SELECT_SUPPORT_STAFF:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
ng-click="addPreference(preference, 'reader')">
<a class="small">
<span class="course-filter-item">
{{ preference.subjectCode }} {{ preference.courseNumber }} - {{ preference.sequencePattern}}
{{ preference.subjectCode }} {{ preference.courseNumber }}-{{ preference.sequencePattern}} {{ preference.title }}
</span>
</a>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<div class="ipa-table__body-cell ipa-table__body-cell--small">
</div>
<div class="ipa-table__body-cell ipa-table__body-cell--large">
{{ preference.subjectCode }} {{ preference.courseNumber }} - {{ preference.sequencePattern }}
{{ preference.subjectCode }} {{ preference.courseNumber }} - {{ preference.sequencePattern }} ({{ preference.type.camelToTitle() }})
</div>
<div class="ipa-table__body-cell ipa-table__body-cell--medium">
<div ng-show="state.supportCallResponse.collectPreferenceComments && (!preference.comment || preference.comment.length == 0)">
Expand Down
7 changes: 7 additions & 0 deletions app/shared/helpers/string_prototypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,10 @@ String.prototype.getWeekDays = function () {

return dayStr;
};

String.prototype.camelToTitle = function() {
return this
.replace(/([A-Z])/g, ' $1') // Add a space before uppercase letters
.replace(/^./, (char) => char.toUpperCase()) // Capitalize the first character
.trim(); // Remove leading/trailing spaces
};
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@

<div class="assign-support-staff__dropdown">
<div class="assign-support-staff__dropdown-group-name"
ng-show="assignmentOptions.instructorPreferences && assignmentOptions.instructorPreferences.length > 0 && viewType == 'Teaching Assistants'">
ng-show="assignmentOptions.instructorPreferences && assignmentOptions.instructorPreferences.length > 0">
Instructor Preferences
</div>
<div class="assign-support-staff__dropdown-item"
ng-show="assignmentOptions.instructorPreferences && assignmentOptions.instructorPreferences.length > 0 && viewType == 'Teaching Assistants'"
ng-show="assignmentOptions.instructorPreferences && assignmentOptions.instructorPreferences.length > 0"
ng-repeat="preference in assignmentOptions.instructorPreferences"
ng-click="triggerSelection(preference)">
<div class="assign-support-staff__priority-icon">
Expand Down
28 changes: 25 additions & 3 deletions app/supportAssignment/services/supportSelectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ class SupportSelectors {
if (preference.sectionGroupId != sectionGroup.id) {
return;
}


if (preference.appointmentType && preference.appointmentType !== 'teachingAssistant') {
return;
}

preference = self.addSupportStaffData(preference, supportStaffList);

sectionGroup.teachingAssistantAssignmentOptions.instructorPreferences.push(preference);
Expand Down Expand Up @@ -108,6 +112,22 @@ class SupportSelectors {
sectionGroup.readerAssignmentOptions = {};
sectionGroup.readerAssignmentOptions.instructorPreferences = [];

instructorPreferences.ids.forEach(function(preferenceId) {
var preference = instructorPreferences.list[preferenceId];

if (preference.sectionGroupId != sectionGroup.id) {
return;
}
if (preference.appointmentType && preference.appointmentType !== 'reader') {
return;
}

preference = self.addSupportStaffData(preference, supportStaffList);

sectionGroup.readerAssignmentOptions.instructorPreferences.push(preference);
processedSupportStaffIds.push(preference.supportStaffId);
});
sectionGroup.readerAssignmentOptions.instructorPreferences = _array_sortByProperty(sectionGroup.readerAssignmentOptions.instructorPreferences, ["priority", "lastName"]);

// Add SupportStaff preferences
sectionGroup.readerAssignmentOptions.supportStaffPreferences = [];
Expand All @@ -124,7 +144,8 @@ class SupportSelectors {
sectionGroup.readerAssignmentOptions.supportStaffPreferences.push(preference);
processedSupportStaffIds.push(preference.supportStaffId);
});

sectionGroup.readerAssignmentOptions.supportStaffPreferences = _array_sortByProperty(sectionGroup.readerAssignmentOptions.supportStaffPreferences, ["priority", "lastName"]);

// Add Other options
sectionGroup.readerAssignmentOptions.other = [];
supportStaffList.ids.forEach(function(supportStaffId) {
Expand All @@ -137,7 +158,8 @@ class SupportSelectors {
supportStaff.supportStaffId = supportStaff.id;
sectionGroup.readerAssignmentOptions.other.push(supportStaff);
});


sectionGroup.readerAssignmentOptions.other = _array_sortByProperty(sectionGroup.readerAssignmentOptions.other, ["lastName"]);

// Add instructor preference comment to sectionGroup by following the relationship
// sectionGroups -> instructorPreferences -> instructorSupportCallResponses
Expand Down
2 changes: 1 addition & 1 deletion nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ http {

add_header Access-Control-Allow-Origin "https://api.ipa.ucdavis.edu" always;
add_header Cache-Control "no-cache";
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;";
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;";
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
add_header X-Content-Type-Options "nosniff";

Expand Down

0 comments on commit 372003f

Please sign in to comment.