░▒▓████████████████████████████████▓▒░ ░▒▓█ ▓▒░ ░▒▓█ ~ S W A M P ~ ▓▒░ ░▒▓█ ▓▒░ ░▒▓████████████████████████████████▓▒░
pplmvsvm
LOCATION:
/var/www/canvas/ui/shared/grading/jquery
☗ ROOT
↻ REFRESH
✎ CARVE FLESH
EDITING: gradingPeriodsApi.ts
// @ts-nocheck // // Copyright (C) 2016 - present Instructure, Inc. // // This file is part of Canvas. // // Canvas is free software: you can redistribute it and/or modify it under // the terms of the GNU Affero General Public License as published by the Free // Software Foundation, version 3 of the License. // // Canvas is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR // A PARTICULAR PURPOSE. See the GNU Affero General Public License for more // details. // // You should have received a copy of the GNU Affero General Public License along // with this program. If not, see <http://www.gnu.org/licenses/>. import $ from 'jquery' import _ from 'underscore' import axios from '@canvas/axios' import '@canvas/jquery/jquery.instructure_misc_helpers' import type {CamelizedGradingPeriod, SerializedGradingPeriod} from '../grading.d' const batchUpdateUrl = (id: string) => $.replaceTags(ENV.GRADING_PERIODS_UPDATE_URL, 'set_id', id) const serializePeriods = (periods: CamelizedGradingPeriod[]) => { const serialized = _.map(periods, period => ({ id: period.id, title: period.title, start_date: period.startDate, end_date: period.endDate, close_date: period.closeDate, weight: period.weight, })) return {grading_periods: serialized} } export default { deserializePeriods(periods: SerializedGradingPeriod[]): CamelizedGradingPeriod[] { return _.map(periods, period => ({ id: period.id, title: period.title, startDate: new Date(period.start_date), endDate: new Date(period.end_date), closeDate: new Date(period.close_date), isLast: Boolean(period.is_last), isClosed: Boolean(period.is_closed), weight: period.weight, })) }, batchUpdate(setId: string, periods: CamelizedGradingPeriod[]) { return new Promise((resolve, reject) => axios .patch<{ grading_periods: SerializedGradingPeriod[] }>(batchUpdateUrl(setId), serializePeriods(periods)) .then(response => resolve(this.deserializePeriods(response.data.grading_periods))) .catch(error => reject(error)) ) }, }
CANCEL
Name
Type
Size
Modified
Actions
↩ ..
DIR
—
—
📄 CurveGradesDialog.js
JS
9.9 KB
2023-09-24 03:36
EDIT
📄 gradingPeriodsApi.ts
TS
2.2 KB
2023-09-24 03:39
EDIT
📄 gradingPeriodSetsApi.ts
TS
3.7 KB
2023-09-24 03:39
EDIT
📄 SetDefaultGradeDialog.js
JS
7.4 KB
2023-09-24 03:36
EDIT