(function () { 'use strict'; angular.module('saz') .factory('unitAssignment', unitAssignment); unitAssignment.$inject = ['$http', '$q', 'ApiBatch', '_']; function unitAssignment($http, $q, ApiBatch, _) { var infoCache = {}; return { getUnitAssignmentInfo: getUnitAssignmentInfo, updateMultipleScienceIndividualAssignment: updateMultipleScienceIndividualAssignment, getStudentResourceLimit: getStudentResourceLimit }; function getUnitAssignmentInfo(unitId) { if (infoCache[unitId]) { return $q(function (resolve, reject) { resolve(infoCache[unitId]); }); } else { return $http.get('/api/science/unit/' + unitId) .then(function (response) { infoCache[unitId] = response; return response; }); } } function updateMultipleScienceIndividualAssignment(studentIds, formData) { return $http.put( '/api/assignments/science/student-custom-science-assignment?student_ids=' + studentIds.join(','), formData); } function getStudentResourceLimit(studentIDsAsDelimitedString) { return $http.get("/api/resources/getAssignedResourceCount/" + studentIDsAsDelimitedString); } } }());