Skip to content

Commit

Permalink
fixed build err, button wont download
Browse files Browse the repository at this point in the history
  • Loading branch information
c-jimmy1 committed Oct 24, 2023
1 parent 4bafd7f commit bc358ca
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/web/src/pages/FinalExamScheduler.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ import {
exportFinalToImage,
} from "@/utils";
import { faPaperPlane } from "@fortawesome/free-solid-svg-icons";
import allExportVariables from "@/assets/dark.scss";
export default {
Expand Down
17 changes: 14 additions & 3 deletions src/web/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ export const prefixNamespacedTypes = (namespace, types) => {
*/
export const exportScheduleToImage = (
selectedCourses,
q,
currentSemester,
options
) => {
// Handle Special Case Where No Selected Courses On Schedule.
Expand All @@ -440,12 +440,23 @@ export const exportScheduleToImage = (
});
};

export const exportFinaltoImage = (selectedSections) => {
export const exportFinaltoImage = (selectedSections, options) => {
if (!Array.isArray(selectedSections) || selectedSections[0] == null) {
alert("No Final Exam Sections Found For Export to Image Data.");
return;
}

// Obtain Schedule Element Defined In Schedule.Vue File + Run Export To PNG.
domtoimage
.toPng(document.getElementById("allScheduleData"), options)
.then(function (dataUrl) {
var link = document.createElement("a");
link.download = "FinalExams-YACS-Schedule.png";
link.href = dataUrl;
link.click();
})
.catch(function (error) {
console.log("Oh No, Something Went Wrong!", error);
});
};

export const getLongName = (department) => {
Expand Down

0 comments on commit bc358ca

Please sign in to comment.