Fixes
diff --git a/dtps.css b/dtps.css
index 4b77dea..25fc302 100644
--- a/dtps.css
+++ b/dtps.css
@@ -377,7 +377,7 @@
.infoChip {
vertical-align: middle;
- margin: 0px 5px;
+ margin: 0px 3px;
display: inline-block;
font-size: 14px;
height: 20px;
@@ -885,7 +885,8 @@
}
.gradeSummaryShowHide {
- margin: 10px 0px;
+ margin-top: 40px;
+ margin-bottom: 20px;
cursor: pointer;
text-align: center;
}
@@ -950,13 +951,13 @@
}
.classContent.fixedGradeSummary {
- padding-top: 160px;
+ padding-top: 130px;
}
.block .showActualGrades {
font-size: 14px;
position: absolute;
- top: 50px;
+ top: 40px;
color: var(--secText);
cursor: pointer;
}
diff --git a/scripts/assignments.js b/scripts/assignments.js
index 2831fd6..5b9a661 100644
--- a/scripts/assignments.js
+++ b/scripts/assignments.js
@@ -38,6 +38,7 @@
<h5>
<!-- Assignment info -->
<div class="info">
+ ${assignment.error ? `<div style="color: #f2392c;" class="infoChip weighted"><i class="fluid-icon">error</i> Error</div>` : ""}
${assignment.dueAt ? `<div ${dtpsLMS.isUsualDueDate && !dtpsLMS.isUsualDueDate(assignment.dueAt) ? `style="font-weight: bold;color: var(--text);"` : ""} class="infoChip"><i style="margin-top: -2px;" class="fluid-icon">alarm</i> Due ` + dtps.formatDate(assignment.dueAt) + `</div>` : ""}
${assignment.outcomes ? `<div class="infoChip weighted"><i class="fluid-icon">adjust</i>` + assignment.outcomes.length + `</div>` : ""}
${assignment.category ? `<div class="infoChip weighted"><i class="fluid-icon">category</i> ` + assignment.category + `</div>` : ""}
@@ -727,6 +728,18 @@
${generic ? "" : scoreHTML}
</div>
+ ${assignment.error ? /*html*/`
+ <div>
+ <div class="alert error">
+ <div class="header">
+ <h5><i class="fluid-icon">error</i> Assignment Error</h5>
+ </div>
+
+ <p>${assignment.error}</p>
+ </div>
+ </div>
+ ` : ``}
+
<div style="margin-top: 20px;" class="assignmentBody">
${assignment.body ? assignmentBodyHTML : ""}
</div>
@@ -1159,6 +1172,7 @@
* @property {string} [letter] Letter grade on this assignment
* @property {number} [value] Total amount of points possible for this assignment
* @property {RubricItem[]} [rubric] Assignment rubric
+* @property {string} [error] If an error occures when processing this assignment, store an error message here to notify the user that some features/data may be unavailable
*/
/**
diff --git a/scripts/core.js b/scripts/core.js
index 33a1522..62e2532 100644
--- a/scripts/core.js
+++ b/scripts/core.js
@@ -1,7 +1,7 @@
/**
* @file DTPS Core functions and module loader
* @author jottocraft
- * @version v3.1.9
+ * @version v3.2.0
*
* @copyright Copyright (c) 2018-2021 jottocraft
* @license GPL-2.0-only
@@ -36,8 +36,8 @@
* @property {boolean} searchScrollListener True if the search scroll listener has been added
*/
var dtps = {
- ver: 319,
- readableVer: "v3.1.9",
+ ver: 320,
+ readableVer: "v3.2.0",
env: new URL(window.dtpsBaseURL || "https://powerplus.app").hostname == "localhost" ? "dev" : window.jottocraftSatEnv || "prod",
classes: [],
baseURL: window.dtpsBaseURL || "https://powerplus.app",
@@ -85,7 +85,8 @@
active: false
},
showVideoMeetingButton: true,
- webAnalytics: true
+ webAnalytics: true,
+ angryOnRubricError: 0
}
};
@@ -800,6 +801,7 @@
if (dtps.classes[i].letter) letterGradeHTML = dtps.classes[i].letter;
if (dtps.classes[i].letter == null) letterGradeHTML = "--";
if (dtps.classes[i].letter == "...") letterGradeHTML = `<div class="shimmer" style="vertical-align:middle;display: inline-block;width: 22px;height: 22px;border-radius: 8px;"></div>`; //Show loading indicator for ...
+ if (dtps.classes[i].letter == "ERROR") letterGradeHTML = `<i class="fluid-icon">error</i>`;
if (dtps.classes[i].group && (dtps.classes[i].group !== previousClassGroup)) {
if (previousClassGroup) dtps.classlist.push(`</div></div>`);
@@ -1227,7 +1229,7 @@
gradeHistory-ID: current|previous (e.g. "A|B+" represents a change of B+ -> A)
if there is only one grade, it is the current one
*/
- if (!dtps.classes[classNum].letter) return;
+ if (!dtps.classes[classNum].letter || (dtps.classes[classNum].letter == "...") || (dtps.classes[classNum].letter == "ERROR")) return;
if (window.localStorage.getItem("gradeHistory-" + dtps.classes[classNum].id)) {
var savedCurrent = window.localStorage.getItem("gradeHistory-" + dtps.classes[classNum].id).split("|")[0];
var savedPrevious = window.localStorage.getItem("gradeHistory-" + dtps.classes[classNum].id).split("|")[1];
@@ -2288,7 +2290,10 @@
* @property {string} [icon] The icon to show with this class
* @property {string} [group] The name of the group that this class is in
* @property {number|string} [period] The period or section the user has this class at
-* @property {Date} [endDate] The end date for this course
+* @property {Date} [startDate] The start date for this course. Only used internally for filtering out stale courses.
+* @property {Date} [endDate] The end date for this course. Only used internally for filtering out stale courses.
+* @property {Date} [termStartDate] The start date for the term this course is in. Only used internally for filtering out stale courses.
+* @property {Date} [termEndDate] The end date for the term this course is in. Only used internally for filtering out stale courses.
* @property {Assignment[]} assignments Class assignments. Assume assignments are still loading if this is undefined. The class has no assignments if this is an empty array. Loaded in dtps.init.
* @property {Module[]|boolean} [modules] Class modules. Assume this class supports the modules feature, but is not yet loaded, if this is true and that the class has no modules if this is an empty array. For LMSs that do not support modules, either keep it undefined or set it to false.
* @property {DiscussionThread[]|boolean} [discussions] Class discussion threads. Assume this class supports discussions, but not yet loaded, if this is true and that the class has no threads if this is an empty array. For LMSs that do not support discussions, either keep it undefined or set it to false.
diff --git a/scripts/lms/canvas.js b/scripts/lms/canvas.js
index 2bfa85a..c28189a 100644
--- a/scripts/lms/canvas.js
+++ b/scripts/lms/canvas.js
@@ -132,7 +132,9 @@
modules: course.tabs.map(tab => tab.id).includes("modules"),
discussions: true || course.tabs.map(tab => tab.id).includes("discussions"),
endDate: course.end_at,
- startDate: course.start_at
+ startDate: course.start_at,
+ termEndDate: course.term?.end_at,
+ termStartDate: course.term?.start_at
};
//Save teachers in cache
@@ -240,12 +242,21 @@
if (submission.assignment_id == assignment.id) {
//Add scores from this submission to the rubric
if (submission.rubric_assessment) {
- dtpsAssignment.rubric.forEach(rubric => {
- if (submission.rubric_assessment[rubric.id]) {
- rubric.score = submission.rubric_assessment[rubric.id].points;
- rubric.scoreName = temporaryScoreNames[rubric.id][rubric.score];
- }
- });
+ let matches = 0;
+ if (dtpsAssignment.rubric) {
+ dtpsAssignment.rubric.forEach(rubric => {
+ if (submission.rubric_assessment[rubric.id]) {
+ rubric.score = submission.rubric_assessment[rubric.id].points;
+ rubric.scoreName = temporaryScoreNames[rubric.id][rubric.score];
+ matches++;
+ }
+ });
+ }
+
+ if ((matches !== Object.keys(submission.rubric_assessment).length) && (dtps.remoteConfig.angryOnRubricError >= 1)) {
+ dtpsAssignment.error = "Power+ found a rubric assessment but could not find its associated rubric data. One or more rubric/outcome assessments may be unavailable for this assignment.";
+ if (dtpsLMS.dtech && (dtps.remoteConfig.angryOnRubricError == 2)) dtpsAssignment.error += " Please see the class grades tab for more information.";
+ }
}
//Check for turned in, late, missing, gradedAt, and feedback
diff --git a/scripts/lms/dtech.js b/scripts/lms/dtech.js
index a9fae28..237f91d 100644
--- a/scripts/lms/dtech.js
+++ b/scripts/lms/dtech.js
@@ -66,12 +66,9 @@
return new Promise((resolve, reject) => {
var tmpNewArray = [];
classes.forEach((course, i) => {
- //Fitler out first semester courses
- if (course.term == "20-21") return;
+ //Fitler out outdated courses
if (course.endDate && (new Date() > new Date(course.endDate))) return;
-
- //Manually filter out other stale courses
- if (course.name.toUpperCase().includes("FEB 2021")) return;
+ if (course.termEndDate && (new Date() > new Date(course.termEndDate))) return;
//Get course period
var matches = course.period.match(/[0-9](?=\(A)/);
@@ -93,7 +90,7 @@
//Get course cycle
if (!dtps.user.parent && (window.localStorage.getItem("pref-autoGroupClasses") !== "false")) {
- if (course.term == "20-21") {
+ if (false && (course.term == "S1")) {
course.group = "Semester 1";
} else if ((course.period >= 1) && (course.period <= 3)) {
course.group = "Cycle 1/3";
@@ -220,13 +217,17 @@
//If there is no grade calculation formula, don't run grade calc
if (!formula) return;
+ if (assignments.find(a => a.error)) {
+ if (dtps.remoteConfig.angryOnRubricError == 1) return;
+ }
+
//Run d.tech grade calculation
var dtechResults = dtechGradeCalc.run(assignments, formula);
if (dtechResults) {
//Class has a grade
return {
- letter: dtechResults.results.letter,
+ letter: assignments.find(a => a.error) ? "ERROR" : dtechResults.results.letter,
dtech: dtechResults //Return dtech results for gradebook
};
} else {
@@ -341,7 +342,6 @@
* @return {object} Grade calculation results
*/
run: function (assignments, formula, outcomesOverride) {
-
//Array of grade variations
var gradeVariations = [];
@@ -539,52 +539,71 @@
if (course.gradeCalculation && course.gradeCalculation.dtech) {
//RENDERER: RENDER GRADE CALCULATION SUMMARY ------------------------------------
if (course.gradeCalculation.dtech.formula == "2020-DASH-LT") {
+ var erroredAssignments = course.assignments.filter(a => a.error);
var gradeCalcSummary = /*html*/`
- <div id="gradeSummary" style="--size: 250px; margin: 0px 20px; --classColor: ${course.color};" class="grid flex">
- <div style="background-color: var(--classColor); color: white;" class="block status letterGrade card">
- <h2 class="main">${course.letter}</h2>
- ${course.previousLetter ? `<h5 class="previousGrade">Previous grade: ${course.previousLetter}</h5>` : ""}
- <h5 class="bottom"><i class="fluid-icon">grade</i> Grade</h5>
- </div>
- <div class="block status number75">
- <h2 class="main numFont">${course.gradeCalculation.dtech.results.parameters.number75.toFixed(2)}</h2>
- <h5 class="bottom"><i class="fluid-icon">functions</i> 75% of outcomes (rounded down, ${course.gradeCalculation.dtech.results.parameters.number75thresh}) ≥</h5>
- </div>
- <div class="block status lowestScore">
- <h2 class="main numFont">${course.gradeCalculation.dtech.results.parameters.lowestScore.toFixed(2)}</h2>
- <h5 class="bottom"><i class="fluid-icon">leaderboard</i> Lowest outcome</h5>
- </div>
- </div>
-
- <div style="--classColor: ${course.color};${dtps.gradebookExpanded ? "" : "display: none;"}" id="classGradeMore">
- <br />
- <table class="table">
- <thead>
- <tr>
- <th> Final Letter</th>
- <th>75% (rounded down) of outcomes are ≥</th>
- <th>No outcomes below</th>
- </tr>
- </thead>
-
- <tbody>
- ${dtechGradeCalc.letters.map(letter => {
- return /*html*/`
- <tr class="letter${letter} ${course.letter == letter ? `active` : ``}">
- <td> ${letter}</td>
- <td>${dtechGradeCalc.params[course.gradeCalculation.dtech.formula].percentage[letter]}</td>
- <td>${dtechGradeCalc.params[course.gradeCalculation.dtech.formula].lowest[letter]}</td>
- </tr>
- `
- }).join("")}
- </tbody>
- </table>
+ <div id="gradeSummary" style="--size: 250px; margin: 0px 20px; --classColor: ${course.color};" class="grid flex">
+ ${erroredAssignments.length ? /*html*/`
+ <div style="color: #f2392c;" class="block status letterGrade card">
+ <h2 class="main">${course.gradeCalculation.dtech.results.letter}</h2>
+ <h5 class="bottom"><i class="fluid-icon">error</i> Data incomplete</h5>
+ </div>
+ ` : /*html*/`
+ <div style="background-color: var(--classColor); color: white;" class="block status letterGrade card">
+ <h2 class="main">${course.letter}</h2>
+ ${course.previousLetter ? `<h5 class="previousGrade">Previous grade: ${course.previousLetter}</h5>` : ""}
+ <h5 class="bottom"><i class="fluid-icon">grade</i> Grade</h5>
+ </div>
+ `}
+ <div class="block status number75">
+ <h2 class="main numFont">${course.gradeCalculation.dtech.results.parameters.number75.toFixed(2)}</h2>
+ <h5 class="bottom"><i class="fluid-icon">functions</i> 75% of outcomes (rounded down, ${course.gradeCalculation.dtech.results.parameters.number75thresh}) ≥</h5>
+ </div>
+ <div class="block status lowestScore">
+ <h2 class="main numFont">${course.gradeCalculation.dtech.results.parameters.lowestScore.toFixed(2)}</h2>
+ <h5 class="bottom"><i class="fluid-icon">leaderboard</i> Lowest outcome</h5>
+ </div>
</div>
- <div onclick="$('#classGradeMore').toggle(); if ($('#classGradeMore').is(':visible')) {$(this).children('i').text('keyboard_arrow_up'); $(this).children('span').text('Show less'); dtps.gradebookExpanded = true;} else {$(this).children('i').text('keyboard_arrow_down'); $(this).children('span').text('Show more'); dtps.gradebookExpanded = false;}" class="gradeSummaryShowHide">
- ${dtps.gradebookExpanded ? `<i class="fluid-icon">keyboard_arrow_up</i> <span>Show less</span>` : `<i class="fluid-icon">keyboard_arrow_down</i> <span>Show more</span>`}
- </div>
- `;
+ <div style="--classColor: ${course.color};${dtps.gradebookExpanded ? "" : "display: none;"}" id="classGradeMore">
+ <br />
+ <table class="table">
+ <thead>
+ <tr>
+ <th> Final Letter</th>
+ <th>75% (rounded down) of outcomes are ≥</th>
+ <th>No outcomes below</th>
+ </tr>
+ </thead>
+
+ <tbody>
+ ${dtechGradeCalc.letters.map(letter => {
+ return /*html*/`
+ <tr class="letter${letter} ${course.letter == letter ? `active` : ``}">
+ <td> ${letter}</td>
+ <td>${dtechGradeCalc.params[course.gradeCalculation.dtech.formula].percentage[letter]}</td>
+ <td>${dtechGradeCalc.params[course.gradeCalculation.dtech.formula].lowest[letter]}</td>
+ </tr>
+ `
+ }).join("")}
+ </tbody>
+ </table>
+ </div>
+
+ <div onclick="$('#classGradeMore').toggle(); if ($('#classGradeMore').is(':visible')) {$(this).children('i').text('keyboard_arrow_up'); $(this).children('span').text('Show less'); dtps.gradebookExpanded = true;} else {$(this).children('i').text('keyboard_arrow_down'); $(this).children('span').text('Show more'); dtps.gradebookExpanded = false;}" class="gradeSummaryShowHide">
+ ${dtps.gradebookExpanded ? `<i class="fluid-icon">keyboard_arrow_up</i> <span>Show less</span>` : `<i class="fluid-icon">keyboard_arrow_down</i> <span>Show more</span>`}
+ </div>
+
+ ${erroredAssignments.length ? /*html*/`
+ <div style="margin: 20px;">
+ <h5>Incomplete Data</h5>
+ <p>
+ Power+ encountered an error when fetching data for the following ${erroredAssignments.length} assignment(s): ${erroredAssignments.map(a => `<a style="cursor: pointer;" onclick="${`dtps.assignment('` + a.id + `', ` + a.class + `)`}">${a.title}</a>`).join(", ")}.
+ Since this appears to be an issue with Canvas that is also affecting the d.tech CBL grade dashboard, Power+ is still calculating your grade for this class with the errored data omitted.
+ If you have any questions or information regarding this issue, please email me at <a href="mailto:[email protected]">[email protected]</a>.
+ </p>
+ </div>
+ ` : ``}
+ `;
} else {
var gradeCalcSummary = ""; //no grade calculation for this class
}