From d5ef8b1d00460685573d2e55498f0b3ce3938917 Mon Sep 17 00:00:00 2001 From: AndersonStettner Date: Mon, 9 Oct 2023 13:40:14 +0000 Subject: [PATCH] deploy: BCStudentSoftwareDevTeam/celts@11b7edb107059d8513f35a3a73260bc812165668 --- .../celts/fixAdminLog/coverage_html.js | 624 ++++++++++++++++++ .../d_074bda25efadd8bd_bonner_py.html | 175 +++++ .../d_074bda25efadd8bd_certification_py.html | 215 ++++++ .../d_074bda25efadd8bd_config_py.html | 136 ++++ ..._074bda25efadd8bd_courseManagement_py.html | 195 ++++++ .../d_074bda25efadd8bd_createLogs_py.html | 110 +++ .../d_074bda25efadd8bd_downloadFile_py.html | 139 ++++ .../d_074bda25efadd8bd_emailHandler_py.html | 380 +++++++++++ .../d_074bda25efadd8bd_events_py.html | 600 +++++++++++++++++ .../d_074bda25efadd8bd_fileHandler_py.html | 193 ++++++ .../d_074bda25efadd8bd_landingPage_py.html | 134 ++++ .../d_074bda25efadd8bd_loginManager_py.html | 157 +++++ ...d_074bda25efadd8bd_manageSLFaculty_py.html | 116 ++++ .../d_074bda25efadd8bd_participants_py.html | 260 ++++++++ .../d_074bda25efadd8bd_searchUsers_py.html | 130 ++++ ...fadd8bd_serviceLearningCoursesData_py.html | 361 ++++++++++ .../d_074bda25efadd8bd_term_py.html | 159 +++++ .../d_074bda25efadd8bd_transcript_py.html | 174 +++++ .../d_074bda25efadd8bd_userManagement_py.html | 164 +++++ .../d_074bda25efadd8bd_users_py.html | 246 +++++++ .../d_074bda25efadd8bd_utils_py.html | 183 +++++ .../d_074bda25efadd8bd_volunteers_py.html | 203 ++++++ .../d_0e098e07e81a8f2f___init___py.html | 107 +++ .../d_0e098e07e81a8f2f_routes_py.html | 392 +++++++++++ ...1690e95_send_event_reminder_emails_py.html | 150 +++++ .../d_2e3eaab626e4e78a___init___py.html | 110 +++ .../d_5f5a17c013354698___init___py.html | 208 ++++++ .../d_6c0e4b930745278b___init___py.html | 117 ++++ .../d_6c0e4b930745278b_adminLog_py.html | 105 +++ ..._6c0e4b930745278b_attachmentUpload_py.html | 106 +++ ...0e4b930745278b_backgroundCheckType_py.html | 102 +++ ...d_6c0e4b930745278b_backgroundCheck_py.html | 106 +++ .../d_6c0e4b930745278b_bonnerCohort_py.html | 106 +++ ...30745278b_certificationRequirement_py.html | 106 +++ .../d_6c0e4b930745278b_certification_py.html | 106 +++ ..._6c0e4b930745278b_courseInstructor_py.html | 104 +++ ...6c0e4b930745278b_courseParticipant_py.html | 105 +++ .../d_6c0e4b930745278b_courseQuestion_py.html | 104 +++ .../d_6c0e4b930745278b_courseStatus_py.html | 105 +++ .../d_6c0e4b930745278b_course_py.html | 119 ++++ .../d_6c0e4b930745278b_emailLog_py.html | 111 ++++ .../d_6c0e4b930745278b_emailTemplate_py.html | 105 +++ ..._6c0e4b930745278b_emergencyContact_py.html | 110 +++ ..._6c0e4b930745278b_eventParticipant_py.html | 110 +++ .../d_6c0e4b930745278b_eventRsvpLog_py.html | 106 +++ .../d_6c0e4b930745278b_eventRsvp_py.html | 111 ++++ .../d_6c0e4b930745278b_eventTemplate_py.html | 121 ++++ .../d_6c0e4b930745278b_eventViews_py.html | 106 +++ .../d_6c0e4b930745278b_event_py.html | 165 +++++ .../d_6c0e4b930745278b_insuranceInfo_py.html | 109 +++ .../d_6c0e4b930745278b_interest_py.html | 104 +++ .../d_6c0e4b930745278b_note_py.html | 106 +++ .../d_6c0e4b930745278b_partner_py.html | 101 +++ .../d_6c0e4b930745278b_profileNote_py.html | 106 +++ .../d_6c0e4b930745278b_programBan_py.html | 108 +++ .../d_6c0e4b930745278b_programManager_py.html | 105 +++ .../d_6c0e4b930745278b_program_py.html | 123 ++++ .../d_6c0e4b930745278b_questionNote_py.html | 104 +++ ..._6c0e4b930745278b_requirementMatch_py.html | 106 +++ .../d_6c0e4b930745278b_term_py.html | 158 +++++ .../d_6c0e4b930745278b_user_py.html | 168 +++++ .../d_82713a9719f5b640___init___py.html | 107 +++ .../d_82713a9719f5b640_email_py.html | 175 +++++ .../d_82713a9719f5b640_routes_py.html | 147 +++++ .../d_beb112d5d893d27f___init___py.html | 107 +++ .../d_beb112d5d893d27f_routes_py.html | 583 ++++++++++++++++ .../d_c86a23c356556db1___init___py.html | 109 +++ .../d_c86a23c356556db1_routes_py.html | 555 ++++++++++++++++ .../d_c86a23c356556db1_userManagement_py.html | 213 ++++++ .../d_c86a23c356556db1_volunteers_py.html | 342 ++++++++++ .../celts/fixAdminLog/favicon_32.png | Bin 0 -> 1732 bytes .../celts/fixAdminLog/index.html | 578 ++++++++++++++++ .../celts/fixAdminLog/keybd_closed.png | Bin 0 -> 9004 bytes .../celts/fixAdminLog/keybd_open.png | Bin 0 -> 9003 bytes .../celts/fixAdminLog/status.json | 1 + .../celts/fixAdminLog/style.css | 309 +++++++++ 76 files changed, 13081 insertions(+) create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/coverage_html.js create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_bonner_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_certification_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_config_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_courseManagement_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_createLogs_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_downloadFile_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_emailHandler_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_events_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_fileHandler_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_landingPage_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_loginManager_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_manageSLFaculty_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_participants_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_searchUsers_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_serviceLearningCoursesData_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_term_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_transcript_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_userManagement_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_users_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_utils_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_volunteers_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_0e098e07e81a8f2f___init___py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_0e098e07e81a8f2f_routes_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_122d09e411690e95_send_event_reminder_emails_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_2e3eaab626e4e78a___init___py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_5f5a17c013354698___init___py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b___init___py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_adminLog_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_attachmentUpload_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_backgroundCheckType_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_backgroundCheck_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_bonnerCohort_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_certificationRequirement_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_certification_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_courseInstructor_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_courseParticipant_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_courseQuestion_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_courseStatus_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_course_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_emailLog_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_emailTemplate_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_emergencyContact_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_eventParticipant_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_eventRsvpLog_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_eventRsvp_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_eventTemplate_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_eventViews_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_event_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_insuranceInfo_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_interest_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_note_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_partner_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_profileNote_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_programBan_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_programManager_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_program_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_questionNote_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_requirementMatch_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_term_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_user_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_82713a9719f5b640___init___py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_82713a9719f5b640_email_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_82713a9719f5b640_routes_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_beb112d5d893d27f___init___py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_beb112d5d893d27f_routes_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_c86a23c356556db1___init___py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_c86a23c356556db1_routes_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_c86a23c356556db1_userManagement_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/d_c86a23c356556db1_volunteers_py.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/favicon_32.png create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/index.html create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/keybd_closed.png create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/keybd_open.png create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/status.json create mode 100644 BCStudentSoftwareDevTeam/celts/fixAdminLog/style.css diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/coverage_html.js b/BCStudentSoftwareDevTeam/celts/fixAdminLog/coverage_html.js new file mode 100644 index 000000000..4c321182c --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/coverage_html.js @@ -0,0 +1,624 @@ +// Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +// For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt + +// Coverage.py HTML report browser code. +/*jslint browser: true, sloppy: true, vars: true, plusplus: true, maxerr: 50, indent: 4 */ +/*global coverage: true, document, window, $ */ + +coverage = {}; + +// General helpers +function debounce(callback, wait) { + let timeoutId = null; + return function(...args) { + clearTimeout(timeoutId); + timeoutId = setTimeout(() => { + callback.apply(this, args); + }, wait); + }; +}; + +function checkVisible(element) { + const rect = element.getBoundingClientRect(); + const viewBottom = Math.max(document.documentElement.clientHeight, window.innerHeight); + const viewTop = 30; + return !(rect.bottom < viewTop || rect.top >= viewBottom); +} + +function on_click(sel, fn) { + const elt = document.querySelector(sel); + if (elt) { + elt.addEventListener("click", fn); + } +} + +// Helpers for table sorting +function getCellValue(row, column = 0) { + const cell = row.cells[column] + if (cell.childElementCount == 1) { + const child = cell.firstElementChild + if (child instanceof HTMLTimeElement && child.dateTime) { + return child.dateTime + } else if (child instanceof HTMLDataElement && child.value) { + return child.value + } + } + return cell.innerText || cell.textContent; +} + +function rowComparator(rowA, rowB, column = 0) { + let valueA = getCellValue(rowA, column); + let valueB = getCellValue(rowB, column); + if (!isNaN(valueA) && !isNaN(valueB)) { + return valueA - valueB + } + return valueA.localeCompare(valueB, undefined, {numeric: true}); +} + +function sortColumn(th) { + // Get the current sorting direction of the selected header, + // clear state on other headers and then set the new sorting direction + const currentSortOrder = th.getAttribute("aria-sort"); + [...th.parentElement.cells].forEach(header => header.setAttribute("aria-sort", "none")); + if (currentSortOrder === "none") { + th.setAttribute("aria-sort", th.dataset.defaultSortOrder || "ascending"); + } else { + th.setAttribute("aria-sort", currentSortOrder === "ascending" ? "descending" : "ascending"); + } + + const column = [...th.parentElement.cells].indexOf(th) + + // Sort all rows and afterwards append them in order to move them in the DOM + Array.from(th.closest("table").querySelectorAll("tbody tr")) + .sort((rowA, rowB) => rowComparator(rowA, rowB, column) * (th.getAttribute("aria-sort") === "ascending" ? 1 : -1)) + .forEach(tr => tr.parentElement.appendChild(tr) ); +} + +// Find all the elements with data-shortcut attribute, and use them to assign a shortcut key. +coverage.assign_shortkeys = function () { + document.querySelectorAll("[data-shortcut]").forEach(element => { + document.addEventListener("keypress", event => { + if (event.target.tagName.toLowerCase() === "input") { + return; // ignore keypress from search filter + } + if (event.key === element.dataset.shortcut) { + element.click(); + } + }); + }); +}; + +// Create the events for the filter box. +coverage.wire_up_filter = function () { + // Cache elements. + const table = document.querySelector("table.index"); + const table_body_rows = table.querySelectorAll("tbody tr"); + const no_rows = document.getElementById("no_rows"); + + // Observe filter keyevents. + document.getElementById("filter").addEventListener("input", debounce(event => { + // Keep running total of each metric, first index contains number of shown rows + const totals = new Array(table.rows[0].cells.length).fill(0); + // Accumulate the percentage as fraction + totals[totals.length - 1] = { "numer": 0, "denom": 0 }; + + // Hide / show elements. + table_body_rows.forEach(row => { + if (!row.cells[0].textContent.includes(event.target.value)) { + // hide + row.classList.add("hidden"); + return; + } + + // show + row.classList.remove("hidden"); + totals[0]++; + + for (let column = 1; column < totals.length; column++) { + // Accumulate dynamic totals + cell = row.cells[column] + if (column === totals.length - 1) { + // Last column contains percentage + const [numer, denom] = cell.dataset.ratio.split(" "); + totals[column]["numer"] += parseInt(numer, 10); + totals[column]["denom"] += parseInt(denom, 10); + } else { + totals[column] += parseInt(cell.textContent, 10); + } + } + }); + + // Show placeholder if no rows will be displayed. + if (!totals[0]) { + // Show placeholder, hide table. + no_rows.style.display = "block"; + table.style.display = "none"; + return; + } + + // Hide placeholder, show table. + no_rows.style.display = null; + table.style.display = null; + + const footer = table.tFoot.rows[0]; + // Calculate new dynamic sum values based on visible rows. + for (let column = 1; column < totals.length; column++) { + // Get footer cell element. + const cell = footer.cells[column]; + + // Set value into dynamic footer cell element. + if (column === totals.length - 1) { + // Percentage column uses the numerator and denominator, + // and adapts to the number of decimal places. + const match = /\.([0-9]+)/.exec(cell.textContent); + const places = match ? match[1].length : 0; + const { numer, denom } = totals[column]; + cell.dataset.ratio = `${numer} ${denom}`; + // Check denom to prevent NaN if filtered files contain no statements + cell.textContent = denom + ? `${(numer * 100 / denom).toFixed(places)}%` + : `${(100).toFixed(places)}%`; + } else { + cell.textContent = totals[column]; + } + } + })); + + // Trigger change event on setup, to force filter on page refresh + // (filter value may still be present). + document.getElementById("filter").dispatchEvent(new Event("input")); +}; + +coverage.INDEX_SORT_STORAGE = "COVERAGE_INDEX_SORT_2"; + +// Loaded on index.html +coverage.index_ready = function () { + coverage.assign_shortkeys(); + coverage.wire_up_filter(); + document.querySelectorAll("[data-sortable] th[aria-sort]").forEach( + th => th.addEventListener("click", e => sortColumn(e.target)) + ); + + // Look for a localStorage item containing previous sort settings: + const stored_list = localStorage.getItem(coverage.INDEX_SORT_STORAGE); + + if (stored_list) { + const {column, direction} = JSON.parse(stored_list); + const th = document.querySelector("[data-sortable]").tHead.rows[0].cells[column]; + th.setAttribute("aria-sort", direction === "ascending" ? "descending" : "ascending"); + th.click() + } + + // Watch for page unload events so we can save the final sort settings: + window.addEventListener("unload", function () { + const th = document.querySelector('[data-sortable] th[aria-sort="ascending"], [data-sortable] [aria-sort="descending"]'); + if (!th) { + return; + } + localStorage.setItem(coverage.INDEX_SORT_STORAGE, JSON.stringify({ + column: [...th.parentElement.cells].indexOf(th), + direction: th.getAttribute("aria-sort"), + })); + }); + + on_click(".button_prev_file", coverage.to_prev_file); + on_click(".button_next_file", coverage.to_next_file); + + on_click(".button_show_hide_help", coverage.show_hide_help); +}; + +// -- pyfile stuff -- + +coverage.LINE_FILTERS_STORAGE = "COVERAGE_LINE_FILTERS"; + +coverage.pyfile_ready = function () { + // If we're directed to a particular line number, highlight the line. + var frag = location.hash; + if (frag.length > 2 && frag[1] === "t") { + document.querySelector(frag).closest(".n").classList.add("highlight"); + coverage.set_sel(parseInt(frag.substr(2), 10)); + } else { + coverage.set_sel(0); + } + + on_click(".button_toggle_run", coverage.toggle_lines); + on_click(".button_toggle_mis", coverage.toggle_lines); + on_click(".button_toggle_exc", coverage.toggle_lines); + on_click(".button_toggle_par", coverage.toggle_lines); + + on_click(".button_next_chunk", coverage.to_next_chunk_nicely); + on_click(".button_prev_chunk", coverage.to_prev_chunk_nicely); + on_click(".button_top_of_page", coverage.to_top); + on_click(".button_first_chunk", coverage.to_first_chunk); + + on_click(".button_prev_file", coverage.to_prev_file); + on_click(".button_next_file", coverage.to_next_file); + on_click(".button_to_index", coverage.to_index); + + on_click(".button_show_hide_help", coverage.show_hide_help); + + coverage.filters = undefined; + try { + coverage.filters = localStorage.getItem(coverage.LINE_FILTERS_STORAGE); + } catch(err) {} + + if (coverage.filters) { + coverage.filters = JSON.parse(coverage.filters); + } + else { + coverage.filters = {run: false, exc: true, mis: true, par: true}; + } + + for (cls in coverage.filters) { + coverage.set_line_visibilty(cls, coverage.filters[cls]); + } + + coverage.assign_shortkeys(); + coverage.init_scroll_markers(); + coverage.wire_up_sticky_header(); + + document.querySelectorAll("[id^=ctxs]").forEach( + cbox => cbox.addEventListener("click", coverage.expand_contexts) + ); + + // Rebuild scroll markers when the window height changes. + window.addEventListener("resize", coverage.build_scroll_markers); +}; + +coverage.toggle_lines = function (event) { + const btn = event.target.closest("button"); + const category = btn.value + const show = !btn.classList.contains("show_" + category); + coverage.set_line_visibilty(category, show); + coverage.build_scroll_markers(); + coverage.filters[category] = show; + try { + localStorage.setItem(coverage.LINE_FILTERS_STORAGE, JSON.stringify(coverage.filters)); + } catch(err) {} +}; + +coverage.set_line_visibilty = function (category, should_show) { + const cls = "show_" + category; + const btn = document.querySelector(".button_toggle_" + category); + if (btn) { + if (should_show) { + document.querySelectorAll("#source ." + category).forEach(e => e.classList.add(cls)); + btn.classList.add(cls); + } + else { + document.querySelectorAll("#source ." + category).forEach(e => e.classList.remove(cls)); + btn.classList.remove(cls); + } + } +}; + +// Return the nth line div. +coverage.line_elt = function (n) { + return document.getElementById("t" + n)?.closest("p"); +}; + +// Set the selection. b and e are line numbers. +coverage.set_sel = function (b, e) { + // The first line selected. + coverage.sel_begin = b; + // The next line not selected. + coverage.sel_end = (e === undefined) ? b+1 : e; +}; + +coverage.to_top = function () { + coverage.set_sel(0, 1); + coverage.scroll_window(0); +}; + +coverage.to_first_chunk = function () { + coverage.set_sel(0, 1); + coverage.to_next_chunk(); +}; + +coverage.to_prev_file = function () { + window.location = document.getElementById("prevFileLink").href; +} + +coverage.to_next_file = function () { + window.location = document.getElementById("nextFileLink").href; +} + +coverage.to_index = function () { + location.href = document.getElementById("indexLink").href; +} + +coverage.show_hide_help = function () { + const helpCheck = document.getElementById("help_panel_state") + helpCheck.checked = !helpCheck.checked; +} + +// Return a string indicating what kind of chunk this line belongs to, +// or null if not a chunk. +coverage.chunk_indicator = function (line_elt) { + const classes = line_elt?.className; + if (!classes) { + return null; + } + const match = classes.match(/\bshow_\w+\b/); + if (!match) { + return null; + } + return match[0]; +}; + +coverage.to_next_chunk = function () { + const c = coverage; + + // Find the start of the next colored chunk. + var probe = c.sel_end; + var chunk_indicator, probe_line; + while (true) { + probe_line = c.line_elt(probe); + if (!probe_line) { + return; + } + chunk_indicator = c.chunk_indicator(probe_line); + if (chunk_indicator) { + break; + } + probe++; + } + + // There's a next chunk, `probe` points to it. + var begin = probe; + + // Find the end of this chunk. + var next_indicator = chunk_indicator; + while (next_indicator === chunk_indicator) { + probe++; + probe_line = c.line_elt(probe); + next_indicator = c.chunk_indicator(probe_line); + } + c.set_sel(begin, probe); + c.show_selection(); +}; + +coverage.to_prev_chunk = function () { + const c = coverage; + + // Find the end of the prev colored chunk. + var probe = c.sel_begin-1; + var probe_line = c.line_elt(probe); + if (!probe_line) { + return; + } + var chunk_indicator = c.chunk_indicator(probe_line); + while (probe > 1 && !chunk_indicator) { + probe--; + probe_line = c.line_elt(probe); + if (!probe_line) { + return; + } + chunk_indicator = c.chunk_indicator(probe_line); + } + + // There's a prev chunk, `probe` points to its last line. + var end = probe+1; + + // Find the beginning of this chunk. + var prev_indicator = chunk_indicator; + while (prev_indicator === chunk_indicator) { + probe--; + if (probe <= 0) { + return; + } + probe_line = c.line_elt(probe); + prev_indicator = c.chunk_indicator(probe_line); + } + c.set_sel(probe+1, end); + c.show_selection(); +}; + +// Returns 0, 1, or 2: how many of the two ends of the selection are on +// the screen right now? +coverage.selection_ends_on_screen = function () { + if (coverage.sel_begin === 0) { + return 0; + } + + const begin = coverage.line_elt(coverage.sel_begin); + const end = coverage.line_elt(coverage.sel_end-1); + + return ( + (checkVisible(begin) ? 1 : 0) + + (checkVisible(end) ? 1 : 0) + ); +}; + +coverage.to_next_chunk_nicely = function () { + if (coverage.selection_ends_on_screen() === 0) { + // The selection is entirely off the screen: + // Set the top line on the screen as selection. + + // This will select the top-left of the viewport + // As this is most likely the span with the line number we take the parent + const line = document.elementFromPoint(0, 0).parentElement; + if (line.parentElement !== document.getElementById("source")) { + // The element is not a source line but the header or similar + coverage.select_line_or_chunk(1); + } else { + // We extract the line number from the id + coverage.select_line_or_chunk(parseInt(line.id.substring(1), 10)); + } + } + coverage.to_next_chunk(); +}; + +coverage.to_prev_chunk_nicely = function () { + if (coverage.selection_ends_on_screen() === 0) { + // The selection is entirely off the screen: + // Set the lowest line on the screen as selection. + + // This will select the bottom-left of the viewport + // As this is most likely the span with the line number we take the parent + const line = document.elementFromPoint(document.documentElement.clientHeight-1, 0).parentElement; + if (line.parentElement !== document.getElementById("source")) { + // The element is not a source line but the header or similar + coverage.select_line_or_chunk(coverage.lines_len); + } else { + // We extract the line number from the id + coverage.select_line_or_chunk(parseInt(line.id.substring(1), 10)); + } + } + coverage.to_prev_chunk(); +}; + +// Select line number lineno, or if it is in a colored chunk, select the +// entire chunk +coverage.select_line_or_chunk = function (lineno) { + var c = coverage; + var probe_line = c.line_elt(lineno); + if (!probe_line) { + return; + } + var the_indicator = c.chunk_indicator(probe_line); + if (the_indicator) { + // The line is in a highlighted chunk. + // Search backward for the first line. + var probe = lineno; + var indicator = the_indicator; + while (probe > 0 && indicator === the_indicator) { + probe--; + probe_line = c.line_elt(probe); + if (!probe_line) { + break; + } + indicator = c.chunk_indicator(probe_line); + } + var begin = probe + 1; + + // Search forward for the last line. + probe = lineno; + indicator = the_indicator; + while (indicator === the_indicator) { + probe++; + probe_line = c.line_elt(probe); + indicator = c.chunk_indicator(probe_line); + } + + coverage.set_sel(begin, probe); + } + else { + coverage.set_sel(lineno); + } +}; + +coverage.show_selection = function () { + // Highlight the lines in the chunk + document.querySelectorAll("#source .highlight").forEach(e => e.classList.remove("highlight")); + for (let probe = coverage.sel_begin; probe < coverage.sel_end; probe++) { + coverage.line_elt(probe).querySelector(".n").classList.add("highlight"); + } + + coverage.scroll_to_selection(); +}; + +coverage.scroll_to_selection = function () { + // Scroll the page if the chunk isn't fully visible. + if (coverage.selection_ends_on_screen() < 2) { + const element = coverage.line_elt(coverage.sel_begin); + coverage.scroll_window(element.offsetTop - 60); + } +}; + +coverage.scroll_window = function (to_pos) { + window.scroll({top: to_pos, behavior: "smooth"}); +}; + +coverage.init_scroll_markers = function () { + // Init some variables + coverage.lines_len = document.querySelectorAll("#source > p").length; + + // Build html + coverage.build_scroll_markers(); +}; + +coverage.build_scroll_markers = function () { + const temp_scroll_marker = document.getElementById("scroll_marker") + if (temp_scroll_marker) temp_scroll_marker.remove(); + // Don't build markers if the window has no scroll bar. + if (document.body.scrollHeight <= window.innerHeight) { + return; + } + + const marker_scale = window.innerHeight / document.body.scrollHeight; + const line_height = Math.min(Math.max(3, window.innerHeight / coverage.lines_len), 10); + + let previous_line = -99, last_mark, last_top; + + const scroll_marker = document.createElement("div"); + scroll_marker.id = "scroll_marker"; + document.getElementById("source").querySelectorAll( + "p.show_run, p.show_mis, p.show_exc, p.show_exc, p.show_par" + ).forEach(element => { + const line_top = Math.floor(element.offsetTop * marker_scale); + const line_number = parseInt(element.querySelector(".n a").id.substr(1)); + + if (line_number === previous_line + 1) { + // If this solid missed block just make previous mark higher. + last_mark.style.height = `${line_top + line_height - last_top}px`; + } else { + // Add colored line in scroll_marker block. + last_mark = document.createElement("div"); + last_mark.id = `m${line_number}`; + last_mark.classList.add("marker"); + last_mark.style.height = `${line_height}px`; + last_mark.style.top = `${line_top}px`; + scroll_marker.append(last_mark); + last_top = line_top; + } + + previous_line = line_number; + }); + + // Append last to prevent layout calculation + document.body.append(scroll_marker); +}; + +coverage.wire_up_sticky_header = function () { + const header = document.querySelector("header"); + const header_bottom = ( + header.querySelector(".content h2").getBoundingClientRect().top - + header.getBoundingClientRect().top + ); + + function updateHeader() { + if (window.scrollY > header_bottom) { + header.classList.add("sticky"); + } else { + header.classList.remove("sticky"); + } + } + + window.addEventListener("scroll", updateHeader); + updateHeader(); +}; + +coverage.expand_contexts = function (e) { + var ctxs = e.target.parentNode.querySelector(".ctxs"); + + if (!ctxs.classList.contains("expanded")) { + var ctxs_text = ctxs.textContent; + var width = Number(ctxs_text[0]); + ctxs.textContent = ""; + for (var i = 1; i < ctxs_text.length; i += width) { + key = ctxs_text.substring(i, i + width).trim(); + ctxs.appendChild(document.createTextNode(contexts[key])); + ctxs.appendChild(document.createElement("br")); + } + ctxs.classList.add("expanded"); + } +}; + +document.addEventListener("DOMContentLoaded", () => { + if (document.body.classList.contains("indexfile")) { + coverage.index_ready(); + } else { + coverage.pyfile_ready(); + } +}); diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_bonner_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_bonner_py.html new file mode 100644 index 000000000..35dc16b8e --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_bonner_py.html @@ -0,0 +1,175 @@ + + + + + Coverage for app/logic/bonner.py: 45% + + + + + +
+
+

+ Coverage for app/logic/bonner.py: + 45% +

+ +

+ 47 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from collections import defaultdict 

+

2from datetime import date 

+

3from peewee import IntegrityError 

+

4 

+

5import xlsxwriter 

+

6 

+

7from app import app 

+

8from app.models.bonnerCohort import BonnerCohort 

+

9from app.models.eventRsvp import EventRsvp 

+

10from app.models.user import User 

+

11 

+

12def makeBonnerXls(): 

+

13 """ 

+

14 Create and save a BonnerStudents.xlsx file with all of the current and former bonner students. 

+

15 Working with XLSX files: https://xlsxwriter.readthedocs.io/index.html 

+

16 

+

17 Returns: 

+

18 The file path and name to the newly created file, relative to the web root. 

+

19 """ 

+

20 filepath = app.config['files']['base_path'] + '/BonnerStudents.xlsx' 

+

21 workbook = xlsxwriter.Workbook(filepath, {'in_memory': True}) 

+

22 worksheet = workbook.add_worksheet('students') 

+

23 bold = workbook.add_format({'bold': True}) 

+

24 

+

25 worksheet.write('A1', 'Cohort Year', bold) 

+

26 worksheet.set_column('A:A', 10) 

+

27 worksheet.write('B1', 'Student', bold) 

+

28 worksheet.set_column('B:B', 20) 

+

29 worksheet.write('C1', 'B-Number', bold) 

+

30 worksheet.set_column('C:C', 10) 

+

31 worksheet.write('D1', 'Student Email', bold) 

+

32 worksheet.set_column('D:D', 20) 

+

33 

+

34 students = BonnerCohort.select(BonnerCohort, User).join(User).order_by(BonnerCohort.year.desc(), User.lastName) 

+

35 

+

36 prev_year = 0 

+

37 row = 0 

+

38 for student in students: 

+

39 if prev_year != student.year: 

+

40 row += 1 

+

41 prev_year = student.year 

+

42 worksheet.write(row, 0, f"{student.year} - {student.year+1}", bold) 

+

43 

+

44 worksheet.write(row, 1, student.user.fullName) 

+

45 worksheet.write(row, 2, student.user.bnumber) 

+

46 worksheet.write(row, 3, student.user.email) 

+

47 

+

48 row += 1 

+

49 

+

50 workbook.close() 

+

51 

+

52 return filepath 

+

53 

+

54def getBonnerCohorts(limit=None, currentYear=date.today().year): 

+

55 """ 

+

56 Return a dictionary with years as keys and a list of bonner users as values. Returns empty lists for 

+

57 intermediate years, or the last 5 years if there are no older records. 

+

58 """ 

+

59 years = list(BonnerCohort.select(BonnerCohort, User).join(User).order_by(BonnerCohort.year).execute()) 

+

60 

+

61 defaultStart = currentYear-4 

+

62 firstYear = years[0].year if len(years) and years[0].year < defaultStart else defaultStart 

+

63 

+

64 cohorts = { year: [] for year in range(firstYear, currentYear+1) } 

+

65 for cohort in years: 

+

66 cohorts[cohort.year].append(cohort.user) 

+

67 

+

68 # slice off the last n elements 

+

69 if limit: 

+

70 cohorts = dict(list(cohorts.items())[-limit:]) 

+

71 

+

72 return cohorts 

+

73 

+

74def rsvpForBonnerCohort(year, event): 

+

75 """ 

+

76 Adds an EventRsvp record to the given event for each user in the given Bonner year. 

+

77 """ 

+

78 EventRsvp.insert_from(BonnerCohort.select(BonnerCohort.user, event).where(BonnerCohort.year == year),[EventRsvp.user, EventRsvp.event]).on_conflict(action='IGNORE').execute() 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_certification_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_certification_py.html new file mode 100644 index 000000000..cb689fe58 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_certification_py.html @@ -0,0 +1,215 @@ + + + + + Coverage for app/logic/certification.py: 100% + + + + + +
+
+

+ Coverage for app/logic/certification.py: + 100% +

+ +

+ 49 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from peewee import JOIN, DoesNotExist, Case 

+

2 

+

3from app.models.certification import Certification 

+

4from app.models.certificationRequirement import CertificationRequirement 

+

5from app.models.requirementMatch import RequirementMatch 

+

6from app.models.eventParticipant import EventParticipant 

+

7 

+

8def getCertRequirementsWithCompletion(*, certification, username): 

+

9 """ 

+

10 Function to differentiate between simple requirements and requirements completion checking. 

+

11 See: `getCertRequirements` 

+

12 """ 

+

13 return getCertRequirements(certification, username) 

+

14 

+

15def getCertRequirements(certification=None, username=None): 

+

16 """ 

+

17 Return the requirements for all certifications, or for one if requested. 

+

18 

+

19 Keyword arguments: 

+

20 certification -- The id or object for a certification to request 

+

21 username -- The username to check for completion 

+

22 

+

23 Returns: 

+

24 A list of dictionaries with all certification data and requirements. If `certification` 

+

25 is given, returns only a list of requirement objects for the given certification. If  

+

26 `username` is given, the requirement objects have a `completed` attribute. 

+

27 """ 

+

28 reqList = (Certification.select(Certification, CertificationRequirement) 

+

29 .join(CertificationRequirement, JOIN.LEFT_OUTER, attr="requirement") 

+

30 .order_by(Certification.id, CertificationRequirement.order.asc(nulls="LAST"))) 

+

31 

+

32 if certification: 

+

33 if username: 

+

34 # I don't know how to add something to a select, so we have to recreate the whole query :( 

+

35 completedCase = Case(None, ((EventParticipant.user_id.is_null(True), 0),), 1) 

+

36 reqList = (Certification 

+

37 .select(Certification, CertificationRequirement, completedCase.alias("completed")) 

+

38 .join(CertificationRequirement, JOIN.LEFT_OUTER, attr="requirement") 

+

39 .join(RequirementMatch, JOIN.LEFT_OUTER) 

+

40 .join(EventParticipant, JOIN.LEFT_OUTER, on=(RequirementMatch.event == EventParticipant.event)) 

+

41 .where(EventParticipant.user.is_null(True) | (EventParticipant.user == username)) 

+

42 .order_by(Certification.id, CertificationRequirement.order.asc(nulls="LAST"))) 

+

43 

+

44 # we have to add the is not null check so that `cert.requirement` always exists 

+

45 reqList = reqList.where(Certification.id == certification, CertificationRequirement.id.is_null(False)) 

+

46 reqList = reqList.distinct() 

+

47 

+

48 certs = [] 

+

49 for cert in reqList: 

+

50 if username: 

+

51 cert.requirement.completed = bool(cert.__dict__['completed']) 

+

52 certs.append(cert.requirement) 

+

53 return certs 

+

54 

+

55 #return [cert.requirement for cert in reqList] 

+

56 

+

57 certs = {} 

+

58 for cert in reqList: 

+

59 if cert.id not in certs.keys(): 

+

60 certs[cert.id] = {"data": cert, "requirements": []} 

+

61 

+

62 if getattr(cert, 'requirement', None): 

+

63 certs[cert.id]["requirements"].append(cert.requirement) 

+

64 

+

65 return certs 

+

66 

+

67def updateCertRequirements(certId, newRequirements): 

+

68 """ 

+

69 Update the certification requirements in the database to match the provided list of requirement data. 

+

70 

+

71 The order of the list matters. Any ids that are in the database and not in `newRequirements` will be  

+

72 removed. IDs that do not exist in the database will be created (and given a new, auto-generated ID). 

+

73 

+

74 Arguments: 

+

75 certId - The id of the certification whose requirements we are updating 

+

76 newRequirements - a list of dictionaries. Each dictionary needs 'id', 'required', 'frequency', and 'name'. 

+

77 

+

78 Returns: 

+

79 A list of CertificationRequirement objects corresponding to the given `newRequirements` list. 

+

80 """ 

+

81 # check for missing ids to remove 

+

82 saveIds = [requirementData['id'] for requirementData in newRequirements] 

+

83 CertificationRequirement.delete().where(CertificationRequirement.id.not_in(saveIds)).execute() 

+

84 

+

85 

+

86 # update existing and add new requirements 

+

87 requirements = [] 

+

88 for order, requirementData in enumerate(newRequirements): 

+

89 try: 

+

90 newRequirement = CertificationRequirement.get_by_id(requirementData['id']) 

+

91 except DoesNotExist: 

+

92 newRequirement = CertificationRequirement() 

+

93 

+

94 newRequirement.certification = certId 

+

95 newRequirement.isRequired = bool(requirementData['required']) 

+

96 newRequirement.frequency = requirementData['frequency'] 

+

97 newRequirement.name = requirementData['name'] 

+

98 newRequirement.order = order 

+

99 newRequirement.save() 

+

100 

+

101 requirements.append(newRequirement) 

+

102 

+

103 return requirements 

+

104 

+

105def updateCertRequirementForEvent(event, requirement): 

+

106 """ 

+

107 Add a certification requirement to an event.  

+

108 Replaces the requirement for an event if the event already exists. 

+

109 

+

110 Arguments: 

+

111 event - an Event object or id 

+

112 requirement - a CertificationRequirement object or id 

+

113 """ 

+

114 # delete existing matches for our event 

+

115 for match in RequirementMatch.select().where(RequirementMatch.event == event): 

+

116 match.delete_instance() 

+

117 

+

118 RequirementMatch.create(event=event, requirement=requirement) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_config_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_config_py.html new file mode 100644 index 000000000..5bfe984cf --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_config_py.html @@ -0,0 +1,136 @@ + + + + + Coverage for app/logic/config.py: 91% + + + + + +
+
+

+ Coverage for app/logic/config.py: + 91% +

+ +

+ 23 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1import yaml 

+

2 

+

3import collections.abc as collections 

+

4 

+

5def deep_update(d, u): 

+

6 """ 

+

7 Update old_dict in place with the values from new_dict, respecting nested dictionaries. 

+

8 Adapted from this stackoverflow answer: https://stackoverflow.com/a/32357112 

+

9 """ 

+

10 if d is None: d = {} 

+

11 if not u: return d 

+

12 

+

13 for key, val in u.items(): 

+

14 if isinstance(d, collections.Mapping): 

+

15 if isinstance(val, collections.Mapping): 

+

16 r = deep_update(d.get(key, {}), val) 

+

17 d[key] = r 

+

18 else: 

+

19 d[key] = u[key] 

+

20 else: 

+

21 d = {key: u[key]} 

+

22 return d 

+

23 

+

24def load_config_files(app, env): 

+

25 

+

26 update_config_from_yaml(app, "default.yml") 

+

27 update_config_from_yaml(app, f"{env}.yml") 

+

28 update_config_from_yaml(app, "local-override.yml") 

+

29 

+

30def update_config_from_yaml(app, configFile): 

+

31 """ 

+

32 Update the application config with a yml file based on the Flask environment. 

+

33 """ 

+

34 with open(f"app/config/{configFile}", 'r') as ymlfile: 

+

35 try: 

+

36 app.config.update(deep_update(app.config, yaml.load(ymlfile, Loader=yaml.FullLoader))) 

+

37 except TypeError: 

+

38 print(F"There was an error loading the override config file {configFile}.") 

+

39 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_courseManagement_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_courseManagement_py.html new file mode 100644 index 000000000..6a07d131e --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_courseManagement_py.html @@ -0,0 +1,195 @@ + + + + + Coverage for app/logic/courseManagement.py: 79% + + + + + +
+
+

+ Coverage for app/logic/courseManagement.py: + 79% +

+ +

+ 47 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from flask import flash 

+

2from peewee import fn, JOIN 

+

3 

+

4from app.models import mainDB 

+

5from app.models.courseInstructor import CourseInstructor 

+

6from app.models.courseQuestion import CourseQuestion 

+

7from app.models.courseStatus import CourseStatus 

+

8from app.logic.createLogs import createAdminLog 

+

9from app.logic.fileHandler import FileHandler 

+

10from app.logic.utils import getFilesFromRequest 

+

11from app.models.course import Course 

+

12from app.models.term import Term 

+

13from app.models.user import User 

+

14 

+

15 

+

16def unapprovedCourses(termId): 

+

17 ''' 

+

18 Queries the database to get all the neccessary information for submitted courses. 

+

19 ''' 

+

20 

+

21 unapprovedCourses = (Course.select(Course, Term, CourseStatus, fn.GROUP_CONCAT(" " ,User.firstName, " ", User.lastName).alias('instructors')) 

+

22 .join(CourseInstructor, JOIN.LEFT_OUTER) 

+

23 .join(User, JOIN.LEFT_OUTER).switch(Course) 

+

24 .join(CourseStatus).switch(Course) 

+

25 .join(Term) 

+

26 .where(Term.id == termId, 

+

27 Course.status.in_([CourseStatus.SUBMITTED, CourseStatus.IN_PROGRESS])) 

+

28 .group_by(Course, Term, CourseStatus) 

+

29 .order_by(Course.status)) 

+

30 

+

31 return unapprovedCourses 

+

32def approvedCourses(termId): 

+

33 ''' 

+

34 Queries the database to get all the neccessary information for 

+

35 approved courses. 

+

36 ''' 

+

37 

+

38 approvedCourses = (Course.select(Course, Term, CourseStatus, fn.GROUP_CONCAT(" " ,User.firstName, " ", User.lastName).alias('instructors')) 

+

39 .join(CourseInstructor, JOIN.LEFT_OUTER) 

+

40 .join(User, JOIN.LEFT_OUTER).switch(Course) 

+

41 .join(CourseStatus).switch(Course) 

+

42 .join(Term) 

+

43 .where(Term.id == termId, Course.status == CourseStatus.APPROVED) 

+

44 .group_by(Course, Term, CourseStatus)) 

+

45 

+

46 return approvedCourses 

+

47 

+

48def createCourse(creator="No user provided"): 

+

49 """ Create an empty, in progress course """ 

+

50 course = Course.create(status=CourseStatus.IN_PROGRESS, createdBy=creator) 

+

51 for i in range(1, 7): 

+

52 CourseQuestion.create( course=course, questionNumber=i) 

+

53 

+

54 return course 

+

55 

+

56def updateCourse(courseData, attachments=None): 

+

57 """ 

+

58 This function will take in courseData for the SLC proposal page and a dictionary 

+

59 of instuctors assigned to the course and update the information in the db. 

+

60 """ 

+

61 with mainDB.atomic() as transaction: 

+

62 try: 

+

63 course = Course.get_by_id(courseData['courseID']) 

+

64 for toggler in ["slSectionsToggle", "permanentDesignation"]: 

+

65 courseData.setdefault(toggler, "off") 

+

66 (Course.update(courseName=courseData["courseName"], 

+

67 courseAbbreviation=courseData["courseAbbreviation"], 

+

68 sectionDesignation=courseData["sectionDesignation"], 

+

69 courseCredit=courseData["credit"], 

+

70 isRegularlyOccurring=int(courseData["isRegularlyOccurring"]), 

+

71 term=courseData['term'], 

+

72 status=CourseStatus.SUBMITTED, 

+

73 isPreviouslyApproved=int(courseData["isPreviouslyApproved"]), 

+

74 previouslyApprovedDescription = courseData["previouslyApprovedDescription"], 

+

75 isAllSectionsServiceLearning=("on" in courseData["slSectionsToggle"]), 

+

76 serviceLearningDesignatedSections=courseData["slDesignation"], 

+

77 isPermanentlyDesignated=("on" in courseData["permanentDesignation"]), 

+

78 hasSlcComponent = int(courseData["hasSlcComponent"])) 

+

79 .where(Course.id == course.id).execute()) 

+

80 for i in range(1, 7): 

+

81 (CourseQuestion.update(questionContent=courseData[f"{i}"]) 

+

82 .where((CourseQuestion.questionNumber == i) & 

+

83 (CourseQuestion.course==course)).execute()) 

+

84 instructorList = [] 

+

85 if 'instructor[]' in courseData: 

+

86 instructorList = courseData.getlist('instructor[]') 

+

87 CourseInstructor.delete().where(CourseInstructor.course == course).execute() 

+

88 for instructor in instructorList: 

+

89 CourseInstructor.create(course=course, user=instructor) 

+

90 createAdminLog(f"Saved SLC proposal: {courseData['courseName']}") 

+

91 if attachments: 

+

92 addFile= FileHandler(attachments, courseId=course.id) 

+

93 addFile.saveFiles() 

+

94 return Course.get_by_id(course.id) 

+

95 except Exception as e: 

+

96 print(e) 

+

97 transaction.rollback() 

+

98 return False 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_createLogs_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_createLogs_py.html new file mode 100644 index 000000000..8be22db02 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_createLogs_py.html @@ -0,0 +1,110 @@ + + + + + Coverage for app/logic/createLogs.py: 100% + + + + + +
+
+

+ Coverage for app/logic/createLogs.py: + 100% +

+ +

+ 10 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from flask import g 

+

2from datetime import datetime 

+

3from app.models.adminLog import AdminLog 

+

4from app.models.eventRsvpLog import EventRsvpLog 

+

5 

+

6def createRsvpLog(eventId, content): 

+

7 date = datetime.now() 

+

8 EventRsvpLog.create(createdBy=g.current_user,createdOn=date,rsvpLogContent=content,event_id=eventId) 

+

9 

+

10 

+

11def createAdminLog(content): 

+

12 date = datetime.now() 

+

13 AdminLog.create(createdBy=g.current_user,createdOn=date,logContent=content) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_downloadFile_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_downloadFile_py.html new file mode 100644 index 000000000..f825ab970 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_downloadFile_py.html @@ -0,0 +1,139 @@ + + + + + Coverage for app/logic/downloadFile.py: 93% + + + + + +
+
+

+ Coverage for app/logic/downloadFile.py: + 93% +

+ +

+ 27 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app import app 

+

2from app.models.courseInstructor import CourseInstructor 

+

3from app.models.courseStatus import CourseStatus 

+

4 

+

5import csv 

+

6 

+

7class fileMaker: 

+

8 ''' 

+

9 Create the file for the download buttons 

+

10 

+

11 requestedInfo: Query object to be formatted and input to the file as text. 

+

12 fileType: Specifies what type of file is going to be made. Currently implemented: (CSV) 

+

13 fileFormat (optional): The format of the file, primarily for CSV headers. Type: (dictionary of lists) 

+

14 ''' 

+

15 def __init__(self, designator, requestedInfo, fileType, fileFormat = None): 

+

16 self.relativePath = app.config['files']['base_path'] 

+

17 self.designator = designator 

+

18 self.requestedInfo = requestedInfo 

+

19 self.fileType = fileType 

+

20 self.fileFormat = fileFormat 

+

21 self.makeFile(fileType) 

+

22 

+

23 

+

24 def makeFile(self, fileType): 

+

25 ''' 

+

26 Creates the file 

+

27 ''' 

+

28 try: 

+

29 if self.designator == "downloadApprovedCourses": 

+

30 if fileType == "CSV": 

+

31 with open(self.relativePath + "/ApprovedCourses.csv", 'w', encoding='utf-8', errors="backslashreplace") as csvfile: 

+

32 self.filewriter = csv.writer(csvfile, delimiter = ',') 

+

33 headers = self.fileFormat.get("headers") 

+

34 self.filewriter.writerow(headers) 

+

35 csvWriteList = [] 

+

36 for approvedCourse in self.requestedInfo: 

+

37 csvWriteList = [approvedCourse.courseName, approvedCourse.courseAbbreviation, approvedCourse.instructors, approvedCourse.term.description] 

+

38 self.filewriter.writerow(csvWriteList) 

+

39 return "File Downloaded Created Successfully" 

+

40 

+

41 except Exception as e: 

+

42 return e 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_emailHandler_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_emailHandler_py.html new file mode 100644 index 000000000..3bc5172a5 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_emailHandler_py.html @@ -0,0 +1,380 @@ + + + + + Coverage for app/logic/emailHandler.py: 82% + + + + + +
+
+

+ Coverage for app/logic/emailHandler.py: + 82% +

+ +

+ 166 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from datetime import datetime 

+

2from peewee import DoesNotExist, JOIN 

+

3from flask_mail import Mail, Message, Attachment 

+

4import os 

+

5 

+

6from app import app 

+

7from app.models.interest import Interest 

+

8from app.models.user import User 

+

9from app.models.program import Program 

+

10from app.models.eventRsvp import EventRsvp 

+

11from app.models.emailTemplate import EmailTemplate 

+

12from app.models.emailLog import EmailLog 

+

13from app.models.event import Event 

+

14from app.models.eventParticipant import EventParticipant 

+

15from app.models.programBan import ProgramBan 

+

16from app.models.term import Term 

+

17 

+

18class EmailHandler: 

+

19 def __init__(self, raw_form_data, url_domain, attachment_file=[]): 

+

20 

+

21 self.mail = Mail(app) 

+

22 self.raw_form_data = raw_form_data 

+

23 self.url_domain = url_domain 

+

24 self.override_all_mail = app.config['MAIL_OVERRIDE_ALL'] 

+

25 self.sender_username = None 

+

26 self.sender_name = None 

+

27 self.sender_address = None 

+

28 self.reply_to = app.config['MAIL_REPLY_TO_ADDRESS'] 

+

29 self.template_identifier = None 

+

30 self.subject = None 

+

31 self.body = None 

+

32 self.event = None 

+

33 self.program = None 

+

34 self.recipients = None 

+

35 self.sl_course_id = None 

+

36 self.attachment_path = app.config['files']['base_path'] + app.config['files']['email_attachment_path'] 

+

37 self.attachment_filepaths = [] 

+

38 self.attachment_file = attachment_file 

+

39 

+

40 def process_data(self): 

+

41 """ Processes raw data and stores it in class variables to be used by other methods """ 

+

42 # Email Template Data 

+

43 # Template Identifier 

+

44 if 'templateIdentifier' in self.raw_form_data: 

+

45 self.template_identifier = self.raw_form_data['templateIdentifier'] 

+

46 

+

47 if 'subject' in self.raw_form_data: 

+

48 self.subject = self.raw_form_data['subject'] 

+

49 

+

50 # Event 

+

51 if 'eventID' in self.raw_form_data: 

+

52 event = Event.get_by_id(self.raw_form_data['eventID']) 

+

53 self.event = event 

+

54 

+

55 # Program 

+

56 if self.event: 

+

57 self.program = self.event.program 

+

58 

+

59 if 'emailSender' in self.raw_form_data: 

+

60 self.sender_username = self.raw_form_data['emailSender'] 

+

61 self.sender_name, self.sender_address, self.reply_to = self.getSenderInfo() 

+

62 

+

63 if 'body' in self.raw_form_data: 

+

64 self.body = self.raw_form_data['body'] 

+

65 

+

66 # Recipients 

+

67 if 'recipientsCategory' in self.raw_form_data: 

+

68 self.recipients_category = self.raw_form_data['recipientsCategory'] 

+

69 self.recipients = self.retrieve_recipients(self.recipients_category) 

+

70 

+

71 # Service-Learning Course 

+

72 if 'slCourseId' in self.raw_form_data: 

+

73 self.sl_course_id = self.raw_form_data['slCourseId'] 

+

74 

+

75 def getSenderInfo(self): 

+

76 programObject = Program.get_or_none(Program.programName == self.sender_username) 

+

77 userObj = User.get_or_none(User.username == self.sender_username) 

+

78 senderInfo = [None, None, None] 

+

79 if programObject: 

+

80 programEmail = programObject.contactEmail 

+

81 senderInfo = [programObject.programName, programEmail, programEmail] 

+

82 elif self.sender_username.upper() == "CELTS": 

+

83 senderInfo = ["CELTS", "celts@berea.edu", "celts@berea.edu"] 

+

84 elif userObj: 

+

85 senderInfo = [f"{userObj.fullName}", userObj.email, userObj.email] 

+

86 # overwrite the sender info with intentional keys in the raw form data. 

+

87 get = self.raw_form_data.get 

+

88 senderInfo = [get('sender_name') or senderInfo[0], get('sender_address') or senderInfo[1], get('reply_to') or senderInfo[2]] 

+

89 

+

90 return senderInfo # If the email is not being sent from a program or user, use default values. 

+

91 

+

92 def update_sender_config(self): 

+

93 # We might need this. 

+

94 # This functionality should be moved somewhere else. 

+

95 # The function in another file would receive email_info[sender] 

+

96 # and update the config based on that and wherever we will end up saving emails and passwords 

+

97 #The sender information should be saved like so: {"name": [email, password], } or in the database 

+

98 pass 

+

99 

+

100 def retrieve_recipients(self, recipients_category): 

+

101 """ Retrieves recipient based on which category is chosen in the 'To' section of the email modal """ 

+

102 # Other potential recipients: 

+

103 # - course instructors 

+

104 # - course Participants 

+

105 # - outside participants' 

+

106 if recipients_category == "Interested": 

+

107 recipients = (User.select() 

+

108 .join(Interest) 

+

109 .join(Program, on=(Program.id==Interest.program)) 

+

110 .where(Interest.program == self.program)) 

+

111 if recipients_category == "RSVP'd": 

+

112 recipients = (User.select() 

+

113 .join(EventRsvp) 

+

114 .where(EventRsvp.event==self.event.id)) 

+

115 

+

116 if recipients_category == "Eligible Students": 

+

117 # all terms with the same accademic year as the current term, 

+

118 # the allVolunteer training term then needs to be in that query 

+

119 Term2 = Term.alias() 

+

120 

+

121 sameYearTerms = Term.select().join(Term2, on=(Term.academicYear == Term2.academicYear)).where(Term2.isCurrentTerm == True) 

+

122 

+

123 bannedUsers = ProgramBan.select(ProgramBan.user).where((ProgramBan.endDate > datetime.now()) | (ProgramBan.endDate is None), ProgramBan.program == (self.program if self.program else ProgramBan.program)) 

+

124 allVolunteer = Event.select().where(Event.isAllVolunteerTraining == True, Event.term.in_(sameYearTerms)) 

+

125 recipients = User.select().join(EventParticipant).where(User.username.not_in(bannedUsers), EventParticipant.event.in_(allVolunteer)) 

+

126 return list(recipients) 

+

127 

+

128 

+

129 

+

130 def replaceDynamicPlaceholders(self, email_body, *, name): 

+

131 """ Replaces placeholders that cannot be predetermined on the front-end """ 

+

132 event_link = f"{self.url_domain}/event/{self.event.id}/view" 

+

133 new_body = email_body.format(recipient_name=name, event_link=event_link) 

+

134 return new_body 

+

135 

+

136 def retrieve_and_modify_email_template(self): 

+

137 """ Retrieves email template based on idenitifer and calls replace_general_template_placeholders""" 

+

138 

+

139 email_template = EmailTemplate.get(EmailTemplate.purpose==self.template_identifier) # --Q: should we keep purpose as the identifier? 

+

140 template_id = email_template.id 

+

141 

+

142 body = EmailHandler.replaceStaticPlaceholders(self.event.id, self.body) 

+

143 

+

144 self.reply_to = email_template.replyToAddress 

+

145 return (template_id, self.subject, body) 

+

146 

+

147 def getAttachmentFullPath(self, newfile=None): 

+

148 """ 

+

149 This creates the directory/path for the object from the "Choose File" input in the emailModal.html file. 

+

150 :returns: directory path for attachment 

+

151 """ 

+

152 attachmentFullPath = None 

+

153 try: 

+

154 # tries to create the full path of the files location and passes if 

+

155 # the directories already exist or there is no attachment 

+

156 attachmentFullPath = os.path.join(self.attachment_path, newfile.filename) 

+

157 if attachmentFullPath[:-1] == self.attachment_path: 

+

158 return None 

+

159 os.mkdir(self.attachment_path) 

+

160 

+

161 except AttributeError: # will pass if there is no attachment to save 

+

162 pass 

+

163 except FileExistsError: # will pass if the file already exists 

+

164 pass 

+

165 return attachmentFullPath 

+

166 

+

167 def saveAttachment(self): 

+

168 """ Saves the attachment in the app/static/files/attachments/ directory """ 

+

169 try: 

+

170 for file in self.attachment_file: 

+

171 attachmentFullPath = self.getAttachmentFullPath(newfile = file) 

+

172 if attachmentFullPath: 

+

173 file.save(attachmentFullPath) # saves attachment in directory 

+

174 self.attachment_filepaths.append(attachmentFullPath) 

+

175 

+

176 except AttributeError: # will pass if there is no attachment to save 

+

177 pass 

+

178 

+

179 def store_sent_email(self, subject, template_id): 

+

180 """ Stores sent email in the email log """ 

+

181 date_sent = datetime.now() 

+

182 

+

183 attachmentNames = [] 

+

184 for file in self.attachment_file: 

+

185 attachmentNames.append(file.filename) 

+

186 

+

187 EmailLog.create( 

+

188 event = self.event.id, 

+

189 subject = subject, 

+

190 templateUsed = template_id, 

+

191 recipientsCategory = self.recipients_category, 

+

192 recipients = ", ".join(recipient.email for recipient in self.recipients), 

+

193 dateSent = date_sent, 

+

194 sender = self.sender_username, 

+

195 attachmentNames = attachmentNames) 

+

196 

+

197 def build_email(self): 

+

198 # Most General Scenario 

+

199 self.saveAttachment() 

+

200 self.process_data() 

+

201 template_id, subject, body = self.retrieve_and_modify_email_template() 

+

202 return (template_id, subject, body) 

+

203 

+

204 def send_email(self): 

+

205 defaultEmailInfo = {"senderName":"CELTS", "replyTo":app.config['celts_admin_contact'], "senderAddress":app.config['celts_admin_contact']} 

+

206 template_id, subject, body = self.build_email() 

+

207 

+

208 attachmentList = [] 

+

209 for i, filepath in enumerate(self.attachment_filepaths): 

+

210 with app.open_resource(filepath[4:]) as file: 

+

211 attachmentList.append(Attachment(filename=filepath.split('/')[-1], content_type=self.attachment_file[i].content_type, data=file.read())) 

+

212 

+

213 try: 

+

214 with self.mail.connect() as conn: 

+

215 for recipient in self.recipients: 

+

216 full_name = f'{recipient.firstName} {recipient.lastName}' 

+

217 email_body = self.replaceDynamicPlaceholders(body, name=full_name) 

+

218 conn.send(Message( 

+

219 subject, 

+

220 # [recipient.email], 

+

221 [self.override_all_mail], 

+

222 email_body, 

+

223 attachments = attachmentList, 

+

224 reply_to = self.reply_to or defaultEmailInfo["replyTo"], 

+

225 sender = (self.sender_name or defaultEmailInfo["senderName"], self.sender_address or defaultEmailInfo["senderAddress"]) 

+

226 )) 

+

227 self.store_sent_email(subject, template_id) 

+

228 return True 

+

229 except Exception as e: 

+

230 print("Error on sending email: ", e) 

+

231 return False 

+

232 

+

233 def update_email_template(self): 

+

234 try: 

+

235 self.process_data() 

+

236 (EmailTemplate.update({ 

+

237 EmailTemplate.subject: self.subject, 

+

238 EmailTemplate.body: self.body, 

+

239 EmailTemplate.replyToAddress: self.reply_to 

+

240 }).where(EmailTemplate.purpose==self.template_identifier)).execute() 

+

241 return True 

+

242 except Exception as e: 

+

243 print("Error updating email template record: ", e) 

+

244 return False 

+

245 

+

246 def retrieve_last_email(event_id): 

+

247 try: 

+

248 last_email = EmailLog.select().where(EmailLog.event==event_id).order_by(EmailLog.dateSent.desc()).get() 

+

249 return last_email 

+

250 except DoesNotExist: 

+

251 return None 

+

252 

+

253 

+

254 @staticmethod 

+

255 def retrievePlaceholderList(eventId): 

+

256 event = Event.get_by_id(eventId) 

+

257 return [ 

+

258 ["Recipient Name", "{recipient_name}"], 

+

259 ["Event Name", event.name], 

+

260 ["Start Date", (event.startDate).strftime('%m/%d/%Y')], 

+

261 ["End Date", (event.endDate).strftime('%m/%d/%Y')], 

+

262 ["Start Time", (event.timeStart).strftime('%I:%M')], 

+

263 ["End Time", (event.timeEnd).strftime('%I:%M')], 

+

264 ["Location", event.location], 

+

265 ["Event Link", "{event_link}"], 

+

266 ["Relative Time", event.relativeTime] 

+

267 ] 

+

268 

+

269 @staticmethod 

+

270 def replaceStaticPlaceholders(eventId, email_body): 

+

271 """ Replaces all template placeholders except for those that can't be known until just before Send-time """ 

+

272 event = Event.get_by_id(eventId) 

+

273 

+

274 new_body = email_body.format(event_name=event.name, 

+

275 location=event.location, 

+

276 start_date=(event.startDate).strftime('%m/%d/%Y'), 

+

277 end_date=(event.endDate).strftime('%m/%d/%Y'), 

+

278 start_time=(event.timeStart).strftime('%I:%M'), 

+

279 end_time=(event.timeEnd).strftime('%I:%M'), 

+

280 event_link="{event_link}", 

+

281 recipient_name="{recipient_name}", 

+

282 relative_time=event.relativeTime) 

+

283 return new_body 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_events_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_events_py.html new file mode 100644 index 000000000..7fe40e9be --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_events_py.html @@ -0,0 +1,600 @@ + + + + + Coverage for app/logic/events.py: 92% + + + + + +
+
+

+ Coverage for app/logic/events.py: + 92% +

+ +

+ 231 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from flask import url_for 

+

2from peewee import DoesNotExist, fn, JOIN 

+

3from dateutil import parser 

+

4from datetime import timedelta, date 

+

5import datetime 

+

6from werkzeug.datastructures import MultiDict 

+

7from app.models import mainDB 

+

8from app.models.user import User 

+

9from app.models.event import Event 

+

10from app.models.eventParticipant import EventParticipant 

+

11from app.models.program import Program 

+

12from app.models.term import Term 

+

13from app.models.programBan import ProgramBan 

+

14from app.models.interest import Interest 

+

15from app.models.eventRsvp import EventRsvp 

+

16from app.models.requirementMatch import RequirementMatch 

+

17from app.models.certificationRequirement import CertificationRequirement 

+

18from app.models.eventViews import EventView 

+

19 

+

20from app.logic.createLogs import createAdminLog 

+

21from app.logic.utils import format24HourTime 

+

22from app.logic.fileHandler import FileHandler 

+

23from app.logic.certification import updateCertRequirementForEvent 

+

24 

+

25def cancelEvent(eventId): 

+

26 """ 

+

27 Cancels an event. 

+

28 """ 

+

29 event = Event.get_or_none(Event.id == eventId) 

+

30 if event: 

+

31 event.isCanceled = True 

+

32 event.save() 

+

33 

+

34 program = event.program 

+

35 createAdminLog(f"Canceled <a href= \"{url_for('admin.eventDisplay', eventId = event)}\" >{event.name}</a> for {program.programName}, which had a start date of {datetime.datetime.strftime(event.startDate, '%m/%d/%Y')}.") 

+

36 

+

37 

+

38def deleteEvent(eventId): 

+

39 """ 

+

40 Deletes an event, if it is a recurring event, rename all following events 

+

41 to make sure there is no gap in weeks. 

+

42 """ 

+

43 event = Event.get_or_none(Event.id == eventId) 

+

44 

+

45 if event: 

+

46 if event.recurringId: 

+

47 recurringId = event.recurringId 

+

48 recurringEvents = list(Event.select().where(Event.recurringId==recurringId).order_by(Event.id)) # orders for tests 

+

49 eventDeleted = False 

+

50 

+

51 # once the deleted event is detected, change all other names to the previous event's name 

+

52 for recurringEvent in recurringEvents: 

+

53 if eventDeleted: 

+

54 Event.update({Event.name:newEventName}).where(Event.id==recurringEvent.id).execute() 

+

55 newEventName = recurringEvent.name 

+

56 

+

57 if recurringEvent == event: 

+

58 newEventName = recurringEvent.name 

+

59 eventDeleted = True 

+

60 

+

61 program = event.program 

+

62 

+

63 if program: 

+

64 createAdminLog(f"Deleted \"{event.name}\" for {program.programName}, which had a start date of {datetime.datetime.strftime(event.startDate, '%m/%d/%Y')}.") 

+

65 else: 

+

66 createAdminLog(f"Deleted a non-program event, \"{event.name}\", which had a start date of {datetime.datetime.strftime(event.startDate, '%m/%d/%Y')}.") 

+

67 

+

68 event.delete_instance(recursive = True, delete_nullable = True) 

+

69 

+

70def deleteEventAndAllFollowing(eventId): 

+

71 """ 

+

72 Deletes a recurring event and all the recurring events after it. 

+

73 """ 

+

74 event = Event.get_or_none(Event.id == eventId) 

+

75 if event: 

+

76 if event.recurringId: 

+

77 recurringId = event.recurringId 

+

78 recurringSeries = list(Event.select().where((Event.recurringId == recurringId) & (Event.startDate >= event.startDate))) 

+

79 for seriesEvent in recurringSeries: 

+

80 seriesEvent.delete_instance(recursive = True) 

+

81 

+

82def deleteAllRecurringEvents(eventId): 

+

83 """ 

+

84 Deletes all recurring events. 

+

85 """ 

+

86 event = Event.get_or_none(Event.id == eventId) 

+

87 if event: 

+

88 if event.recurringId: 

+

89 recurringId = event.recurringId 

+

90 allRecurringEvents = list(Event.select().where(Event.recurringId == recurringId)) 

+

91 for aRecurringEvent in allRecurringEvents: 

+

92 aRecurringEvent.delete_instance(recursive = True) 

+

93 

+

94 

+

95def attemptSaveEvent(eventData, attachmentFiles = None): 

+

96 """ 

+

97 Tries to save an event to the database: 

+

98 Checks that the event data is valid and if it is it continus to saves the new 

+

99 event to the database and adds files if there are any. 

+

100 If it is not valid it will return a validation error. 

+

101 

+

102 Returns: 

+

103 Created events and an error message. 

+

104 """ 

+

105 

+

106 # Manually set the value of RSVP Limit if it is and empty string since it is 

+

107 # automatically changed from "" to 0 

+

108 if eventData["rsvpLimit"] == "": 

+

109 eventData["rsvpLimit"] = None 

+

110 newEventData = preprocessEventData(eventData) 

+

111 isValid, validationErrorMessage = validateNewEventData(newEventData) 

+

112 

+

113 if not isValid: 

+

114 return False, validationErrorMessage 

+

115 

+

116 try: 

+

117 events = saveEventToDb(newEventData) 

+

118 if attachmentFiles: 

+

119 for event in events: 

+

120 addFile= FileHandler(attachmentFiles, eventId=event.id) 

+

121 addFile.saveFiles(saveOriginalFile=events[0]) 

+

122 

+

123 return events, " " 

+

124 except Exception as e: 

+

125 print(f'Failed attemptSaveEvent() with Exception:{e}') 

+

126 return False, e 

+

127 

+

128def saveEventToDb(newEventData): 

+

129 if not newEventData.get('valid', False): 

+

130 raise Exception("Unvalidated data passed to saveEventToDb") 

+

131 

+

132 isNewEvent = ('id' not in newEventData) 

+

133 

+

134 

+

135 eventsToCreate = [] 

+

136 recurringSeriesId = None 

+

137 if isNewEvent and newEventData['isRecurring']: 

+

138 eventsToCreate = calculateRecurringEventFrequency(newEventData) 

+

139 recurringSeriesId = calculateNewrecurringId() 

+

140 else: 

+

141 eventsToCreate.append({'name': f"{newEventData['name']}", 

+

142 'date':newEventData['startDate'], 

+

143 "week":1}) 

+

144 eventRecords = [] 

+

145 

+

146 for eventInstance in eventsToCreate: 

+

147 with mainDB.atomic(): 

+

148 

+

149 eventData = { 

+

150 "term": newEventData['term'], 

+

151 "name": eventInstance['name'], 

+

152 "description": newEventData['description'], 

+

153 "timeStart": newEventData['timeStart'], 

+

154 "timeEnd": newEventData['timeEnd'], 

+

155 "location": newEventData['location'], 

+

156 "isFoodProvided" : newEventData['isFoodProvided'], 

+

157 "isTraining": newEventData['isTraining'], 

+

158 "isRsvpRequired": newEventData['isRsvpRequired'], 

+

159 "isService": newEventData['isService'], 

+

160 "startDate": eventInstance['date'], 

+

161 "rsvpLimit": newEventData['rsvpLimit'], 

+

162 "endDate": eventInstance['date'], 

+

163 "contactEmail": newEventData['contactEmail'], 

+

164 "contactName": newEventData['contactName'] 

+

165 } 

+

166 

+

167 # The three fields below are only relevant during event creation so we only set/change them when  

+

168 # it is a new event.  

+

169 if isNewEvent: 

+

170 eventData['program'] = newEventData['program'] 

+

171 eventData['recurringId'] = recurringSeriesId 

+

172 eventData["isAllVolunteerTraining"] = newEventData['isAllVolunteerTraining'] 

+

173 eventRecord = Event.create(**eventData) 

+

174 else: 

+

175 eventRecord = Event.get_by_id(newEventData['id']) 

+

176 Event.update(**eventData).where(Event.id == eventRecord).execute() 

+

177 

+

178 if 'certRequirement' in newEventData and newEventData['certRequirement'] != "": 

+

179 updateCertRequirementForEvent(eventRecord, newEventData['certRequirement']) 

+

180 

+

181 eventRecords.append(eventRecord) 

+

182 

+

183 return eventRecords 

+

184 

+

185def getStudentLedEvents(term): 

+

186 studentLedEvents = list(Event.select(Event, Program) 

+

187 .join(Program) 

+

188 .where(Program.isStudentLed, 

+

189 Event.term == term) 

+

190 .order_by(Event.startDate, Event.timeStart) 

+

191 .execute()) 

+

192 

+

193 programs = {} 

+

194 

+

195 for event in studentLedEvents: 

+

196 programs.setdefault(event.program, []).append(event) 

+

197 

+

198 return programs 

+

199 

+

200def getUpcomingStudentLedCount(term, currentTime): 

+

201 """ 

+

202 Return a count of all upcoming events for each student led program. 

+

203 """ 

+

204 

+

205 upcomingCount = (Program.select(Program.id, fn.COUNT(Event.id).alias("eventCount")) 

+

206 .join(Event, on=(Program.id == Event.program_id)) 

+

207 .where(Program.isStudentLed, 

+

208 Event.term == term, 

+

209 (Event.endDate > currentTime) | ((Event.endDate == currentTime) & (Event.timeEnd >= currentTime)), 

+

210 Event.isCanceled == False) 

+

211 .group_by(Program.id)) 

+

212 

+

213 programCountDict = {} 

+

214 

+

215 for programCount in upcomingCount: 

+

216 programCountDict[programCount.id] = programCount.eventCount 

+

217 return programCountDict 

+

218 

+

219def getTrainingEvents(term, user): 

+

220 """ 

+

221 The allTrainingsEvent query is designed to select and count eventId's after grouping them 

+

222 together by id's of similiar value. The query will then return the event that is associated 

+

223 with the most programs (highest count) by doing this we can ensure that the event being 

+

224 returned is the All Trainings Event. 

+

225 term: expected to be the ID of a term 

+

226 user: expected to be the current user 

+

227 return: a list of all trainings the user can view 

+

228 """ 

+

229 trainingQuery = (Event.select(Event).distinct() 

+

230 .join(Program, JOIN.LEFT_OUTER) 

+

231 .where(Event.isTraining == True, 

+

232 Event.term == term) 

+

233 .order_by(Event.isAllVolunteerTraining.desc(), Event.startDate, Event.timeStart)) 

+

234 

+

235 hideBonner = (not user.isAdmin) and not (user.isStudent and user.isBonnerScholar) 

+

236 if hideBonner: 

+

237 trainingQuery = trainingQuery.where(Program.isBonnerScholars == False) 

+

238 

+

239 return list(trainingQuery.execute()) 

+

240 

+

241def getBonnerEvents(term): 

+

242 bonnerScholarsEvents = list(Event.select(Event, Program.id.alias("program_id")) 

+

243 .join(Program) 

+

244 .where(Program.isBonnerScholars, 

+

245 Event.term == term) 

+

246 .order_by(Event.startDate, Event.timeStart) 

+

247 .execute()) 

+

248 return bonnerScholarsEvents 

+

249 

+

250def getOtherEvents(term): 

+

251 """ 

+

252 Get the list of the events not caught by other functions to be displayed in 

+

253 the Other Events section of the Events List page. 

+

254 :return: A list of Other Event objects 

+

255 """ 

+

256 # Gets all events that are not associated with a program and are not trainings 

+

257 # Gets all events that have a program but don't fit anywhere 

+

258 

+

259 otherEvents = list(Event.select(Event, Program) 

+

260 .join(Program, JOIN.LEFT_OUTER) 

+

261 .where(Event.term == term, 

+

262 Event.isTraining == False, 

+

263 Event.isAllVolunteerTraining == False, 

+

264 ((Program.isOtherCeltsSponsored) | 

+

265 ((Program.isStudentLed == False) & 

+

266 (Program.isBonnerScholars == False)))) 

+

267 .order_by(Event.startDate, Event.timeStart, Event.id) 

+

268 .execute()) 

+

269 

+

270 return otherEvents 

+

271 

+

272def getUpcomingEventsForUser(user, asOf=datetime.datetime.now(), program=None): 

+

273 """ 

+

274 Get the list of upcoming events that the user is interested in as long 

+

275 as they are not banned from the program that the event is a part of. 

+

276 :param user: a username or User object 

+

277 :param asOf: The date to use when determining future and past events. 

+

278 Used in testing, defaults to the current timestamp. 

+

279 :return: A list of Event objects 

+

280 """ 

+

281 

+

282 events = (Event.select().distinct() 

+

283 .join(ProgramBan, JOIN.LEFT_OUTER, on=((ProgramBan.program == Event.program) & (ProgramBan.user == user))) 

+

284 .join(Interest, JOIN.LEFT_OUTER, on=(Event.program == Interest.program)) 

+

285 .join(EventRsvp, JOIN.LEFT_OUTER, on=(Event.id == EventRsvp.event)) 

+

286 .where(Event.startDate >= asOf, 

+

287 (Interest.user == user) | (EventRsvp.user == user), 

+

288 ProgramBan.user.is_null(True) | (ProgramBan.endDate < asOf))) 

+

289 

+

290 if program: 

+

291 events = events.where(Event.program == program) 

+

292 

+

293 events = events.order_by(Event.startDate, Event.name) 

+

294 

+

295 events_list = [] 

+

296 shown_recurring_event_list = [] 

+

297 

+

298 # removes all recurring events except for the next upcoming one 

+

299 for event in events: 

+

300 if event.recurringId: 

+

301 if not event.isCanceled: 

+

302 if event.recurringId not in shown_recurring_event_list: 

+

303 events_list.append(event) 

+

304 shown_recurring_event_list.append(event.recurringId) 

+

305 else: 

+

306 if not event.isCanceled: 

+

307 events_list.append(event) 

+

308 

+

309 return events_list 

+

310 

+

311def getParticipatedEventsForUser(user): 

+

312 """ 

+

313 Get all the events a user has participated in. 

+

314 :param user: a username or User object 

+

315 :param asOf: The date to use when determining future and past events. 

+

316 Used in testing, defaults to the current timestamp. 

+

317 :return: A list of Event objects 

+

318 """ 

+

319 

+

320 participatedEvents = (Event.select(Event, Program.programName) 

+

321 .join(Program, JOIN.LEFT_OUTER).switch() 

+

322 .join(EventParticipant) 

+

323 .where(EventParticipant.user == user, 

+

324 Event.isAllVolunteerTraining == False) 

+

325 .order_by(Event.startDate, Event.name)) 

+

326 

+

327 allVolunteer = (Event.select(Event, "") 

+

328 .join(EventParticipant) 

+

329 .where(Event.isAllVolunteerTraining == True, 

+

330 EventParticipant.user == user)) 

+

331 union = participatedEvents.union_all(allVolunteer) 

+

332 unionParticipationWithVolunteer = list(union.select_from(union.c.id, union.c.programName, union.c.startDate, union.c.name).order_by(union.c.startDate, union.c.name).execute()) 

+

333 

+

334 return unionParticipationWithVolunteer 

+

335 

+

336def validateNewEventData(data): 

+

337 """ 

+

338 Confirm that the provided data is valid for an event. 

+

339 

+

340 Assumes the event data has been processed with `preprocessEventData`. NOT raw form data 

+

341 

+

342 Returns 3 values: (boolean success, the validation error message, the data object) 

+

343 """ 

+

344 

+

345 if 'on' in [data['isFoodProvided'], data['isRsvpRequired'], data['isTraining'], data['isService'], data['isRecurring']]: 

+

346 return (False, "Raw form data passed to validate method. Preprocess first.") 

+

347 

+

348 if data['isRecurring'] and data['endDate'] < data['startDate']: 

+

349 return (False, "Event start date is after event end date.") 

+

350 

+

351 if data['timeEnd'] <= data['timeStart']: 

+

352 return (False, "Event end time must be after start time.") 

+

353 

+

354 # Validation if we are inserting a new event 

+

355 if 'id' not in data: 

+

356 

+

357 event = (Event.select() 

+

358 .where((Event.name == data['name']) & 

+

359 (Event.location == data['location']) & 

+

360 (Event.startDate == data['startDate']) & 

+

361 (Event.timeStart == data['timeStart']))) 

+

362 

+

363 try: 

+

364 Term.get_by_id(data['term']) 

+

365 except DoesNotExist as e: 

+

366 return (False, f"Not a valid term: {data['term']}") 

+

367 

+

368 if event.exists(): 

+

369 return (False, "This event already exists") 

+

370 

+

371 data['valid'] = True 

+

372 return (True, "All inputs are valid.") 

+

373 

+

374def calculateNewrecurringId(): 

+

375 """ 

+

376 Gets the highest recurring Id so that a new recurring Id can be assigned 

+

377 """ 

+

378 recurringId = Event.select(fn.MAX(Event.recurringId)).scalar() 

+

379 if recurringId: 

+

380 return recurringId + 1 

+

381 else: 

+

382 return 1 

+

383 

+

384def getPreviousRecurringEventData(recurringId): 

+

385 """ 

+

386 Joins the User db table and Event Participant db table so that we can get the information of a participant if they attended an event 

+

387 """ 

+

388 previousEventVolunteers = (User.select(User).distinct() 

+

389 .join(EventParticipant) 

+

390 .join(Event) 

+

391 .where(Event.recurringId==recurringId)) 

+

392 return previousEventVolunteers 

+

393 

+

394def calculateRecurringEventFrequency(event): 

+

395 """ 

+

396 Calculate the events to create based on a recurring event start and end date. Takes a 

+

397 dictionary of event data. 

+

398 

+

399 Assumes that the data has been processed with `preprocessEventData`. NOT raw form data. 

+

400 

+

401 Return a list of events to create from the event data. 

+

402 """ 

+

403 if not isinstance(event['endDate'], datetime.date) or not isinstance(event['startDate'], datetime.date): 

+

404 raise Exception("startDate and endDate must be datetime.date objects.") 

+

405 

+

406 if event['endDate'] == event['startDate']: 

+

407 raise Exception("This event is not a recurring event") 

+

408 return [ {'name': f"{event['name']} Week {counter+1}", 

+

409 'date': event['startDate'] + datetime.timedelta(days=7*counter), 

+

410 "week": counter+1} 

+

411 for counter in range(0, ((event['endDate']-event['startDate']).days//7)+1)] 

+

412 

+

413def preprocessEventData(eventData): 

+

414 """ 

+

415 Ensures that the event data dictionary is consistent before it reaches the template or event logic. 

+

416 

+

417 - dates should exist and be date objects if there is a value 

+

418 - checkboxes should be True or False 

+

419 - if term is given, convert it to a model object 

+

420 - times should exist be strings in 24 hour format example: 14:40 

+

421 - Look up matching certification requirement if necessary 

+

422 """ 

+

423 ## Process checkboxes 

+

424 eventCheckBoxes = ['isFoodProvided', 'isRsvpRequired', 'isService', 'isTraining', 'isRecurring', 'isAllVolunteerTraining'] 

+

425 

+

426 for checkBox in eventCheckBoxes: 

+

427 if checkBox not in eventData: 

+

428 eventData[checkBox] = False 

+

429 else: 

+

430 eventData[checkBox] = bool(eventData[checkBox]) 

+

431 

+

432 ## Process dates 

+

433 eventDates = ['startDate', 'endDate'] 

+

434 for date in eventDates: 

+

435 if date not in eventData: 

+

436 eventData[date] = '' 

+

437 elif type(eventData[date]) is str and eventData[date]: 

+

438 eventData[date] = parser.parse(eventData[date]) 

+

439 elif not isinstance(eventData[date], datetime.date): 

+

440 eventData[date] = '' 

+

441 

+

442 # If we aren't recurring, all of our events are single-day 

+

443 if not eventData['isRecurring']: 

+

444 eventData['endDate'] = eventData['startDate'] 

+

445 

+

446 # Process terms 

+

447 if 'term' in eventData: 

+

448 try: 

+

449 eventData['term'] = Term.get_by_id(eventData['term']) 

+

450 except DoesNotExist: 

+

451 eventData['term'] = '' 

+

452 

+

453 # Process requirement 

+

454 if 'certRequirement' in eventData: 

+

455 try: 

+

456 eventData['certRequirement'] = CertificationRequirement.get_by_id(eventData['certRequirement']) 

+

457 except DoesNotExist: 

+

458 eventData['certRequirement'] = '' 

+

459 elif 'id' in eventData: 

+

460 # look up requirement 

+

461 match = RequirementMatch.get_or_none(event=eventData['id']) 

+

462 if match: 

+

463 eventData['certRequirement'] = match.requirement 

+

464 

+

465 if 'timeStart' in eventData: 

+

466 eventData['timeStart'] = format24HourTime(eventData['timeStart']) 

+

467 

+

468 if 'timeEnd' in eventData: 

+

469 eventData['timeEnd'] = format24HourTime(eventData['timeEnd']) 

+

470 

+

471 return eventData 

+

472 

+

473def getTomorrowsEvents(): 

+

474 """Grabs each event that occurs tomorrow""" 

+

475 tomorrowDate = date.today() + timedelta(days=1) 

+

476 events = list(Event.select().where(Event.startDate==tomorrowDate)) 

+

477 return events 

+

478 

+

479def addEventView(viewer,event): 

+

480 """This checks if the current user already viewed the event. If not, insert a recored to EventView table""" 

+

481 if not viewer.isCeltsAdmin: 

+

482 EventView.get_or_create(user = viewer, event = event) 

+

483 

+

484def getEventRsvpCountsForTerm(term): 

+

485 """ 

+

486 Get all of the RSVPs for the events that exist in the term. 

+

487 Returns a dictionary with the event id as the key and the amount of 

+

488 current RSVPs to that event as the pair. 

+

489 """ 

+

490 amount = (Event.select(Event, fn.COUNT(EventRsvp.event_id).alias('count')) 

+

491 .join(EventRsvp, JOIN.LEFT_OUTER) 

+

492 .where(Event.term == term) 

+

493 .group_by(Event.id)) 

+

494 

+

495 amountAsDict = {event.id: event.count for event in amount} 

+

496 

+

497 return amountAsDict 

+

498 

+

499def getEventRsvpCount(eventId): 

+

500 """ 

+

501 Returns the number of RSVP'd participants for a given eventId. 

+

502 """ 

+

503 return len(EventRsvp.select().where(EventRsvp.event_id == eventId)) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_fileHandler_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_fileHandler_py.html new file mode 100644 index 000000000..385c90017 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_fileHandler_py.html @@ -0,0 +1,193 @@ + + + + + Coverage for app/logic/fileHandler.py: 87% + + + + + +
+
+

+ Coverage for app/logic/fileHandler.py: + 87% +

+ +

+ 62 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1import os 

+

2from flask import redirect, url_for 

+

3from app import app 

+

4from app.models.attachmentUpload import AttachmentUpload 

+

5 

+

6class FileHandler: 

+

7 def __init__(self,files=None, courseId=None, eventId=None): 

+

8 self.files=files 

+

9 self.path = app.config['files']['base_path'] 

+

10 self.courseId = courseId 

+

11 self.eventId = eventId 

+

12 if courseId: 

+

13 self.path = os.path.join(self.path, app.config['files']['course_attachment_path'], str(courseId)) 

+

14 elif eventId: 

+

15 # eventID is not included in the path, because it is now a part of the attachment filename. 

+

16 self.path = os.path.join(self.path, app.config['files']['event_attachment_path']) 

+

17 

+

18 def makeDirectory(self): 

+

19 # This creates a directory.  

+

20 # Created to remove duplicates when an event is recurring. 

+

21 try: 

+

22 extraDir = str(self.eventId) if self.eventId else "" 

+

23 os.makedirs(os.path.join(self.path, extraDir)) 

+

24 # Error 17 Occurs when we try to create a directory that already exists 

+

25 except OSError as e: 

+

26 if e.errno != 17: 

+

27 print(f'Fail to create directory: {e}') 

+

28 raise e 

+

29 

+

30 def getFileFullPath(self, newfilename = ''): 

+

31 """ 

+

32 This creates the directory/path for the object from the "Choose File" input in the create event and edit event. 

+

33 :returns: directory path for attachment 

+

34 """ 

+

35 

+

36 # Added the eventID of the first recurring event to track the file path for subsequent recurring events. 

+

37 try: 

+

38 # tries to create the full path of the files location and passes if 

+

39 # the directories already exist or there is no attachment 

+

40 filePath=(os.path.join(self.path, newfilename)) 

+

41 except AttributeError: # will pass if there is no attachment to save 

+

42 pass 

+

43 except FileExistsError: 

+

44 pass 

+

45 

+

46 return filePath 

+

47 

+

48 def saveFiles(self, saveOriginalFile=None): 

+

49 """ Saves the attachment in the app/static/files/eventattachments/ or courseattachements/ directory """ 

+

50 try: 

+

51 for file in self.files: 

+

52 saveFileToFilesystem = None 

+

53 if self.eventId: 

+

54 attachmentName = str(saveOriginalFile.id) + "/" + file.filename 

+

55 

+

56 # isFileInEvent checks if the attachment exists in the database under that eventId and filename. 

+

57 isFileInEvent = AttachmentUpload.select().where(AttachmentUpload.event_id == self.eventId, 

+

58 AttachmentUpload.fileName == attachmentName).exists() 

+

59 if not isFileInEvent: 

+

60 AttachmentUpload.create(event = self.eventId, fileName = attachmentName) 

+

61 

+

62 # Only save the file if our event is on its own, or the first of a recurring series 

+

63 if saveOriginalFile and saveOriginalFile.id == self.eventId: 

+

64 saveFileToFilesystem = attachmentName 

+

65 

+

66 elif self.courseId: 

+

67 isFileInCourse = AttachmentUpload.select().where(AttachmentUpload.course == self.courseId, AttachmentUpload.fileName == file.filename).exists() 

+

68 if not isFileInCourse: 

+

69 AttachmentUpload.create(course = self.courseId, fileName = file.filename) 

+

70 saveFileToFilesystem = file.filename 

+

71 

+

72 if saveFileToFilesystem: 

+

73 self.makeDirectory() 

+

74 file.save(self.getFileFullPath(newfilename = saveFileToFilesystem)) 

+

75 

+

76 except AttributeError: # will pass if there is no attachment to save 

+

77 pass 

+

78 

+

79 def retrievePath(self,files): 

+

80 pathDict={} 

+

81 for file in files: 

+

82 pathDict[file.fileName] = ((self.path+"/"+ file.fileName)[3:], file) 

+

83 

+

84 return pathDict 

+

85 

+

86 def deleteFile(self, fileId): 

+

87 """ 

+

88 Deletes attachmant from the app/static/files/eventattachments/ or courseattachments/ directory 

+

89 """ 

+

90 file = AttachmentUpload.get_by_id(fileId) 

+

91 file.delete_instance() 

+

92 

+

93 # checks if there are other instances with the same filename in the AttachmentUpload table 

+

94 if not AttachmentUpload.select().where(AttachmentUpload.fileName == file.fileName).exists(): 

+

95 path = os.path.join(self.path, file.fileName) 

+

96 os.remove(path) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_landingPage_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_landingPage_py.html new file mode 100644 index 000000000..fe98957db --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_landingPage_py.html @@ -0,0 +1,134 @@ + + + + + Coverage for app/logic/landingPage.py: 93% + + + + + +
+
+

+ Coverage for app/logic/landingPage.py: + 93% +

+ +

+ 30 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1import os 

+

2from flask import g 

+

3from app.models.programManager import ProgramManager 

+

4from app.models.program import Program 

+

5 

+

6 

+

7def getManagerProgramDict(user): 

+

8 

+

9 managerRows = ProgramManager.select() 

+

10 programs = Program.select().order_by(Program.programName) 

+

11 if not (user.isAdmin or user.isBonnerScholar): 

+

12 programs = programs.where(Program.isBonnerScholars == False) 

+

13 managerRows = managerRows.join(Program).where(ProgramManager.program.isBonnerScholars == False) 

+

14 managerProgramDict = {} 

+

15 

+

16 for program in programs: 

+

17 managerProgramDict[program] = {"managers": "", "image": os.path.join('static', 'images/logos/celts_symbol.png')} 

+

18 with os.scandir("./app/static/images/landingPage") as it: 

+

19 for entry in it: 

+

20 if entry.name.split('.')[0] == f'{program.programName}': 

+

21 managerProgramDict[program]["image"] = os.path.join('static', f'images/landingPage/{entry.name}') 

+

22 break 

+

23 for row in managerRows: 

+

24 if managerProgramDict[row.program]["managers"] == "": 

+

25 managerProgramDict[row.program]["managers"] = f'{row.user.firstName} {row.user.lastName}' 

+

26 else: 

+

27 managerProgramDict[row.program]["managers"] = f'{managerProgramDict[row.program]["managers"]}, {row.user.firstName} {row.user.lastName}' 

+

28 return managerProgramDict 

+

29 

+

30def getActiveEventTab(programID): 

+

31 program = Program.get_by_id(programID) 

+

32 if program.isBonnerScholars: 

+

33 return "bonnerScholarsEvents" 

+

34 elif program.isStudentLed: 

+

35 return "studentLedEvents" 

+

36 else: 

+

37 return "otherEvents" 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_loginManager_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_loginManager_py.html new file mode 100644 index 000000000..618668f10 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_loginManager_py.html @@ -0,0 +1,157 @@ + + + + + Coverage for app/logic/loginManager.py: 25% + + + + + +
+
+

+ Coverage for app/logic/loginManager.py: + 25% +

+ +

+ 36 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from flask import request, session, abort 

+

2from peewee import DoesNotExist 

+

3 

+

4from app import app 

+

5from app.models.user import User 

+

6from app.models.term import Term 

+

7 

+

8 

+

9def logout(): 

+

10 """ 

+

11 Erases the session and returns the URL for redirection 

+

12 """ 

+

13 if 'username' in session: 

+

14 print("Logging out", session['username']) 

+

15 session.clear() 

+

16 

+

17 url ="/" 

+

18 if app.config['use_shibboleth']: 

+

19 url = "/Shibboleth.sso/Logout" 

+

20 return url 

+

21 

+

22def getUsernameFromEnvironment(): 

+

23 if "username" in session: 

+

24 username = session["username"] 

+

25 

+

26 shibKey = "eppn" 

+

27 if app.config['use_shibboleth']: 

+

28 if not shibKey in request.environ: 

+

29 print("No Shibboleth session present! Aborting") 

+

30 abort(403) 

+

31 

+

32 username = request.environ[shibKey].split("@")[0].split('/')[-1].lower() 

+

33 return username 

+

34 

+

35 else: 

+

36 return app.config['default_user'] 

+

37 

+

38def getLoginUser(): 

+

39 username = getUsernameFromEnvironment() 

+

40 

+

41 try: 

+

42 user = User.get_by_id(username) 

+

43 except DoesNotExist as e: 

+

44 # Create the user from Shibboleth 

+

45 # FIXME We need to identify the proper shibboleth attributes to insert into user 

+

46 user = User.create( 

+

47 username=username, 

+

48 firstName="Not", 

+

49 lastName="Yet", 

+

50 email=f"{username}@berea.edu", 

+

51 bnumber="B00055555") 

+

52 

+

53 if 'username' not in session: 

+

54 print("Logging in as", user.username) 

+

55 session['username'] = user.username 

+

56 

+

57 return user 

+

58 

+

59def getCurrentTerm(): 

+

60 return Term.get_or_none(isCurrentTerm = True) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_manageSLFaculty_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_manageSLFaculty_py.html new file mode 100644 index 000000000..80a47dbcd --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_manageSLFaculty_py.html @@ -0,0 +1,116 @@ + + + + + Coverage for app/logic/manageSLFaculty.py: 100% + + + + + +
+
+

+ Coverage for app/logic/manageSLFaculty.py: + 100% +

+ +

+ 11 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models.user import User 

+

2from app.models.courseInstructor import CourseInstructor 

+

3from app.models.course import Course 

+

4 

+

5def getInstructorCourses(): 

+

6 """ 

+

7 This function selects all the Instructors Name and the previous courses 

+

8 """ 

+

9 instructors = (CourseInstructor.select(CourseInstructor, User, Course) 

+

10 .join(User).switch() 

+

11 .join(Course)) 

+

12 result = {} 

+

13 

+

14 for instructor in instructors: 

+

15 result.setdefault(instructor.user, []) 

+

16 if instructor.course.courseName not in result[instructor.user]: 

+

17 result[instructor.user].append(instructor.course.courseName) 

+

18 

+

19 return result 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_participants_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_participants_py.html new file mode 100644 index 000000000..0de5c267d --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_participants_py.html @@ -0,0 +1,260 @@ + + + + + Coverage for app/logic/participants.py: 89% + + + + + +
+
+

+ Coverage for app/logic/participants.py: + 89% +

+ +

+ 91 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from flask import g 

+

2from peewee import fn, JOIN 

+

3from datetime import date 

+

4from app.models.user import User 

+

5from app.models.event import Event 

+

6from app.models.term import Term 

+

7from app.models.eventRsvp import EventRsvp 

+

8from app.models.program import Program 

+

9from app.models.eventParticipant import EventParticipant 

+

10from app.logic.users import isEligibleForProgram 

+

11from app.logic.volunteers import getEventLengthInHours 

+

12from app.logic.events import getEventRsvpCountsForTerm 

+

13from app.logic.createLogs import createRsvpLog 

+

14 

+

15def trainedParticipants(programID, targetTerm): 

+

16 """ 

+

17 This function tracks the users who have attended every Prerequisite 

+

18 event and adds them to a list that will not flag them when tracking hours. 

+

19 Returns a list of user objects who've completed all training events. 

+

20 """ 

+

21 

+

22 # Reset program eligibility each term for all other trainings 

+

23 isRelevantAllVolunteer = (Event.isAllVolunteerTraining) & (Event.term.academicYear == targetTerm.academicYear) 

+

24 isRelevantProgramTraining = (Event.program == programID) & (Event.term == targetTerm) & (Event.isTraining) 

+

25 allTrainings = (Event.select() 

+

26 .join(Term) 

+

27 .where(isRelevantAllVolunteer | isRelevantProgramTraining, 

+

28 Event.isCanceled == False)) 

+

29 

+

30 fullyTrainedUsers = (User.select() 

+

31 .join(EventParticipant) 

+

32 .where(EventParticipant.event.in_(allTrainings)) 

+

33 .group_by(EventParticipant.user) 

+

34 .having(fn.Count(EventParticipant.user) == len(allTrainings)).order_by(User.username)) 

+

35 

+

36 return list(fullyTrainedUsers) 

+

37 

+

38def addBnumberAsParticipant(bnumber, eventId): 

+

39 """Accepts scan input and signs in the user. If user exists or is already 

+

40 signed in will return user and login status""" 

+

41 try: 

+

42 kioskUser = User.get(User.bnumber == bnumber) 

+

43 except Exception as e: 

+

44 print(e) 

+

45 return None, "does not exist" 

+

46 

+

47 event = Event.get_by_id(eventId) 

+

48 if not isEligibleForProgram(event.program, kioskUser): 

+

49 userStatus = "banned" 

+

50 

+

51 elif checkUserVolunteer(kioskUser, event): 

+

52 userStatus = "already signed in" 

+

53 

+

54 else: 

+

55 userStatus = "success" 

+

56 # We are not using addPersonToEvent to do this because  

+

57 # that function checks if the event is in the past, but 

+

58 # someone could start signing people up via the kiosk 

+

59 # before an event has started 

+

60 totalHours = getEventLengthInHours(event.timeStart, event.timeEnd, event.startDate) 

+

61 EventParticipant.create (user=kioskUser, event=event, hoursEarned=totalHours) 

+

62 

+

63 return kioskUser, userStatus 

+

64 

+

65def checkUserRsvp(user, event): 

+

66 return EventRsvp.select().where(EventRsvp.user==user, EventRsvp.event == event).exists() 

+

67 

+

68def checkUserVolunteer(user, event): 

+

69 return EventParticipant.select().where(EventParticipant.user == user, EventParticipant.event == event).exists() 

+

70 

+

71def addPersonToEvent(user, event): 

+

72 """ 

+

73 Add a user to an event. 

+

74 If the event is in the past, add the user as a volunteer (EventParticipant) including hours worked. 

+

75 If the event is in the future, rsvp for the user (EventRsvp) 

+

76 

+

77 Returns True if the operation was successful, false otherwise 

+

78 """ 

+

79 try: 

+

80 volunteerExists = checkUserVolunteer(user, event) 

+

81 rsvpExists = checkUserRsvp(user, event) 

+

82 if event.isPast: 

+

83 if not volunteerExists: 

+

84 # We duplicate these two lines in addBnumberAsParticipant 

+

85 eventHours = getEventLengthInHours(event.timeStart, event.timeEnd, event.startDate) 

+

86 EventParticipant.create(user = user, event = event, hoursEarned = eventHours) 

+

87 else: 

+

88 if not rsvpExists: 

+

89 currentRsvp = getEventRsvpCountsForTerm(event.term) 

+

90 waitlist = currentRsvp[event.id] >= event.rsvpLimit if event.rsvpLimit is not None else 0 

+

91 EventRsvp.create(user = user, event = event, rsvpWaitlist = waitlist) 

+

92 

+

93 targetList = "the waitlist" if waitlist else "the RSVP list" 

+

94 if g.current_user.username == user.username: 

+

95 createRsvpLog(event.id, f"{user.fullName} joined {targetList}.") 

+

96 else: 

+

97 createRsvpLog(event.id, f"Added {user.fullName} to {targetList}.") 

+

98 

+

99 if volunteerExists or rsvpExists: 

+

100 return "already in" 

+

101 except Exception as e: 

+

102 print(e) 

+

103 return False 

+

104 

+

105 return True 

+

106 

+

107def unattendedRequiredEvents(program, user): 

+

108 

+

109 # Check for events that are prerequisite for program 

+

110 requiredEvents = (Event.select(Event) 

+

111 .where(Event.isTraining == True, Event.program == program)) 

+

112 

+

113 if requiredEvents: 

+

114 attendedRequiredEventsList = [] 

+

115 for event in requiredEvents: 

+

116 attendedRequirement = (EventParticipant.select().where(EventParticipant.user == user, EventParticipant.event == event)) 

+

117 if not attendedRequirement: 

+

118 attendedRequiredEventsList.append(event.name) 

+

119 if attendedRequiredEventsList is not None: 

+

120 return attendedRequiredEventsList 

+

121 else: 

+

122 return [] 

+

123 

+

124 

+

125def getEventParticipants(event): 

+

126 eventParticipants = (EventParticipant.select(EventParticipant, User) 

+

127 .join(User) 

+

128 .where(EventParticipant.event == event)) 

+

129 

+

130 return {p.user: p.hoursEarned for p in eventParticipants} 

+

131 

+

132def getParticipationStatusForTrainings(program, userList, term): 

+

133 """ 

+

134 This function returns a dictionary of all trainings for a program and 

+

135 whether the current user participated in them. 

+

136 

+

137 :returns: trainings for program and if the user participated 

+

138 """ 

+

139 isRelevantAllVolunteer = (Event.isAllVolunteerTraining) & (Event.term.academicYear == term.academicYear) 

+

140 isRelevantProgramTraining = (Event.program == program) & (Event.term == term) & (Event.isTraining) 

+

141 programTrainings = (Event.select(Event, Term, EventParticipant, EventRsvp) 

+

142 .join(EventParticipant, JOIN.LEFT_OUTER).switch() 

+

143 .join(EventRsvp, JOIN.LEFT_OUTER).switch() 

+

144 .join(Term) 

+

145 .where(isRelevantAllVolunteer | isRelevantProgramTraining, (Event.isCanceled != True)).order_by(Event.startDate)) 

+

146 

+

147 # Create a dictionary where the keys are trainings and values are a list of those who attended 

+

148 trainingData = {} 

+

149 for training in programTrainings: 

+

150 try: 

+

151 if training.isPast: 

+

152 trainingData[training] = trainingData.get(training, []) + [training.eventparticipant.user_id] 

+

153 else: # The training has yet to happen 

+

154 trainingData[training] = trainingData.get(training, []) + [training.eventrsvp.user_id] 

+

155 except AttributeError: 

+

156 trainingData[training] = trainingData.get(training, []) 

+

157 # Create a dictionary binding usernames to tuples. The tuples consist of the training (event object) and whether or not they attended it (bool) 

+

158 userParticipationStatus = {} 

+

159 for user in userList: 

+

160 for training, attendeeList in trainingData.items(): 

+

161 userParticipationStatus[user.username] = userParticipationStatus.get(user.username, []) + [(training, user.username in attendeeList)] 

+

162 

+

163 return userParticipationStatus 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_searchUsers_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_searchUsers_py.html new file mode 100644 index 000000000..ceee7e6f2 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_searchUsers_py.html @@ -0,0 +1,130 @@ + + + + + Coverage for app/logic/searchUsers.py: 100% + + + + + +
+
+

+ Coverage for app/logic/searchUsers.py: + 100% +

+ +

+ 20 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from playhouse.shortcuts import model_to_dict 

+

2from app.models.user import User 

+

3def searchUsers(query, category=None): 

+

4 ''' 

+

5 Search the User table based on the search query and category 

+

6 

+

7 MySQL LIKE is case insensitive 

+

8 ''' 

+

9 # add wildcards to each piece of the query 

+

10 splitSearch = query.strip().split() 

+

11 firstName = splitSearch[0] + "%" 

+

12 lastName = " ".join(splitSearch[1:]) +"%" 

+

13 

+

14 if len(splitSearch) == 1: # search for query in first OR last name 

+

15 searchWhere = (User.firstName ** firstName | User.lastName ** firstName | User.username ** splitSearch) 

+

16 else: # search for first AND last name 

+

17 searchWhere = (User.firstName ** firstName & User.lastName ** lastName) 

+

18 

+

19 if category == "instructor": 

+

20 userWhere = (User.isFaculty | User.isStaff) 

+

21 elif category == "admin": 

+

22 userWhere = (User.isCeltsAdmin) 

+

23 elif category == "studentstaff": 

+

24 userWhere = (User.isCeltsStudentStaff) 

+

25 elif category == "celtsLinkAdmin": 

+

26 userWhere = (User.isFaculty | User.isStaff | User.isCeltsStudentStaff) 

+

27 else: 

+

28 userWhere = (User.isStudent) 

+

29 

+

30 # Combine into query 

+

31 searchResults = User.select().where(searchWhere, userWhere) 

+

32 

+

33 return { user.username : model_to_dict(user) for user in searchResults } 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_serviceLearningCoursesData_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_serviceLearningCoursesData_py.html new file mode 100644 index 000000000..352cea15b --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_serviceLearningCoursesData_py.html @@ -0,0 +1,361 @@ + + + + + Coverage for app/logic/serviceLearningCoursesData.py: 86% + + + + + +
+
+

+ Coverage for app/logic/serviceLearningCoursesData.py: + 86% +

+ +

+ 130 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from flask import session, g 

+

2import re as regex 

+

3from openpyxl import load_workbook 

+

4from app.models.course import Course 

+

5from app.models.user import User 

+

6from app.models.term import Term 

+

7from app.models.courseInstructor import CourseInstructor 

+

8from app.models.courseParticipant import CourseParticipant 

+

9from app.models.courseStatus import CourseStatus 

+

10from app.models.courseQuestion import CourseQuestion 

+

11from app.models.questionNote import QuestionNote 

+

12from app.models.note import Note 

+

13from app.models.attachmentUpload import AttachmentUpload 

+

14from app.models.term import Term 

+

15from app.models import DoesNotExist 

+

16from app.logic.createLogs import createAdminLog 

+

17from app.logic.fileHandler import FileHandler 

+

18from app.logic.term import addPastTerm 

+

19 

+

20def getServiceLearningCoursesData(user): 

+

21 """Returns dictionary with data used to populate Service-Learning proposal table""" 

+

22 courses = (Course.select(Course, Term, User, CourseStatus) 

+

23 .join(CourseInstructor).switch() 

+

24 .join(Term).switch() 

+

25 .join(CourseStatus).switch() 

+

26 .join(User) 

+

27 .where((CourseInstructor.user==user)|(Course.createdBy==user)) 

+

28 .order_by(Course.term.desc(), Course.status)) 

+

29 

+

30 courseDict = {} 

+

31 for course in courses: 

+

32 otherInstructors = (CourseInstructor.select(CourseInstructor, User).join(User).where(CourseInstructor.course==course)) 

+

33 faculty = [f"{instructor.user.firstName} {instructor.user.lastName}" for instructor in otherInstructors] 

+

34 

+

35 

+

36 courseDict[course.id] = {"id":course.id, 

+

37 "creator":f"{course.createdBy.firstName} {course.createdBy.lastName}", 

+

38 "name":course.courseName, 

+

39 "faculty": faculty, 

+

40 "term": course.term, 

+

41 "status": course.status.status} 

+

42 return courseDict 

+

43 

+

44def withdrawProposal(courseID): 

+

45 """Withdraws proposal of ID passed in. Removes foreign keys first. 

+

46 Key Dependencies: QuestionNote, CourseQuestion, CourseParticipant, 

+

47 CourseInstructor, Note""" 

+

48 

+

49 # delete syllabus 

+

50 try: 

+

51 syllabi = AttachmentUpload.select().where(AttachmentUpload.course==courseID) 

+

52 for syllabus in syllabi: 

+

53 FileHandler(courseId = courseID).deleteFile(syllabus.id) 

+

54 

+

55 except DoesNotExist: 

+

56 print(f"File, {AttachmentUpload.fileName}, does not exist.") 

+

57 

+

58 # delete course object 

+

59 course = Course.get(Course.id == courseID) 

+

60 courseName = course.courseName 

+

61 questions = CourseQuestion.select().where(CourseQuestion.course == course) 

+

62 notes = list(Note.select(Note.id) 

+

63 .join(QuestionNote) 

+

64 .where(QuestionNote.question.in_(questions)) 

+

65 .distinct()) 

+

66 course.delete_instance(recursive=True) 

+

67 for note in notes: 

+

68 note.delete_instance() 

+

69 

+

70 createAdminLog(f"Withdrew SLC proposal: {courseName}") 

+

71 

+

72def renewProposal(courseID, term): 

+

73 """ 

+

74 Renews proposal of ID passed in for the selected term. 

+

75 Sets status to in progress. 

+

76 """ 

+

77 oldCourse = Course.get_by_id(courseID) 

+

78 newCourse = Course.get_by_id(courseID) 

+

79 newCourse.id = None 

+

80 newCourse.term = Term.get_by_id(term) 

+

81 newCourse.status = CourseStatus.IN_PROGRESS 

+

82 newCourse.isPreviouslyApproved = True 

+

83 newCourse.save() 

+

84 questions = CourseQuestion.select().where(CourseQuestion.course==oldCourse) 

+

85 for question in questions: 

+

86 CourseQuestion.create(course=newCourse.id, 

+

87 questionContent=question.questionContent, 

+

88 questionNumber=question.questionNumber) 

+

89 

+

90 instructors = CourseInstructor.select().where(CourseInstructor.course==oldCourse.id) 

+

91 for instructor in instructors: 

+

92 CourseInstructor.create(course=newCourse.id, 

+

93 user=instructor.user) 

+

94 

+

95 return newCourse 

+

96 

+

97def parseUploadedFile(filePath): 

+

98 """ 

+

99 Parse an Excel document at the given `filePath` for courses and 

+

100 course participants. 

+

101 

+

102 The return value will be a tuple. The second value is a list of  

+

103 error message tuples. The first tuple value is the error message,  

+

104 and the second is a 0 or 1 indicating whether the error is a  

+

105 'general' error - 1 - or an error on a specific course, term, or  

+

106 person. The first value is a dictionary keyed by the term  

+

107 description. Each value is another dictionary, with a key for  

+

108 'displayMsg' and 'errorMsg', and a 'courses' key whose value is  

+

109 a dictionary with keys for the courses in the term. Each course  

+

110 has a 'displayMsg' and 'errorMsg' key, and a 'students' key  

+

111 that has a list of dictionaries with 'user', 'displayMsg', and  

+

112 'errorMsg' keys. 

+

113 E.g., 

+

114 { 

+

115 "Fall 2021": { 

+

116 "displayMsg": "", 

+

117 "errorMsg": "", 

+

118 "courses": { 

+

119 "CSC 330": { 

+

120 "displayMsg: "CSC 330 will be created", 

+

121 "errorMsg: "", 

+

122 "students": [ 

+

123 {'user':'ramsayb2',  

+

124 'displayMsg': 'Brian Ramsay', 

+

125 'errorMsg': ''}, 

+

126 {'user':'B0073235',  

+

127 'displayMsg': '', 

+

128 'errorMsg': 'ERROR: B0073235 does not exist!'}] 

+

129 }, 

+

130 "CSC 226": { 

+

131 "displayMsg": "CSC 226 matched to existing course 'Data Structures'.", 

+

132 "errorMsg": "", 

+

133 "students": [ 

+

134 {'user':'ramsayb2',  

+

135 'displayMsg': 'Brian Ramsay', 

+

136 'errorMsg': ''}, 

+

137 {'user':'lamichhanes',  

+

138 'displayMsg': 'Sandesh Lamichhane', 

+

139 'errorMsg': ''}] 

+

140 } 

+

141 } 

+

142 } 

+

143 } 

+

144 """ 

+

145 excelData = load_workbook(filename=filePath) 

+

146 excelSheet = excelData.active 

+

147 

+

148 result= {} 

+

149 errors = [] 

+

150 term = '' 

+

151 course = '' 

+

152 cellRow = 0 

+

153 

+

154 for row in excelSheet.iter_rows(): 

+

155 cellRow += 1 

+

156 cellVal = row[0].value 

+

157 if not cellVal: 

+

158 continue 

+

159 

+

160 # Look for a Term. Examples: Fall 2020 or Spring B 2021 

+

161 if regex.search(r"\b[a-zA-Z]{3,}( [AB])? \d{4}\b", str(cellVal)): 

+

162 errorMsg = '' 

+

163 if "Spring A" in cellVal or "Spring B" in cellVal: 

+

164 cellVal = "Spring " + cellVal.split()[-1] 

+

165 if "Fall A" in cellVal or "Fall B" in cellVal: 

+

166 cellVal = "Fall " + cellVal.split()[-1] 

+

167 

+

168 if cellVal.split()[0] not in ["Summer", "Spring", "Fall", "May"]: 

+

169 errorMsg = f"ERROR: '{cellVal}' is not a valid term in row {cellRow}." 

+

170 else: 

+

171 latestTerm = Term.select().order_by(Term.termOrder.desc()).get() 

+

172 isFutureTerm = latestTerm.termOrder < Term.convertDescriptionToTermOrder(cellVal) 

+

173 if isFutureTerm: 

+

174 errors.append(f"ERROR: '{cellVal}' is a future term in row {cellRow}.") 

+

175 else: 

+

176 validTerm = Term.get_or_none(Term.description == cellVal) 

+

177 

+

178 term = cellVal 

+

179 result[term] = { 

+

180 'displayMsg': term, 

+

181 'errorMsg': errorMsg, 

+

182 'courses': {} 

+

183 } 

+

184 if errorMsg: 

+

185 errors.append((errorMsg,0)) 

+

186 

+

187 # Look for a Course. Examples: FRN134 CSC 226 

+

188 elif regex.search(r"\b[A-Z]{2,4} ?\d{3}\b", str(cellVal)): 

+

189 errorMsg = displayMsg = '' 

+

190 if not term: 

+

191 displayMsg = cellVal 

+

192 errorMsg = "ERROR: No term was given for this course" 

+

193 else: 

+

194 existingCourse = Course.get_or_none(Course.courseAbbreviation == cellVal) 

+

195 displayMsg = f'{cellVal} will be created.' 

+

196 if existingCourse: 

+

197 displayMsg = f"{cellVal} matched to the existing course {existingCourse.courseName}." 

+

198 

+

199 course = cellVal 

+

200 result[term]['courses'][course] = { 

+

201 'displayMsg': displayMsg, 

+

202 'errorMsg': errorMsg, 

+

203 'students': [] 

+

204 } 

+

205 if errorMsg: 

+

206 errors.append((errorMsg,0)) 

+

207 

+

208 # Look for a B-Number. Example: B00123456 

+

209 elif regex.search(r"\b[B]\d{8}\b", str(cellVal)): 

+

210 errorMsg = displayMsg = '' 

+

211 if not course: 

+

212 errorMsg = "ERROR: No course is connected to this student" 

+

213 else: 

+

214 existingUser = User.get_or_none(User.bnumber == cellVal) 

+

215 if existingUser: 

+

216 displayMsg = f"{existingUser.firstName} {existingUser.lastName}" 

+

217 existingUser = existingUser.username 

+

218 else: 

+

219 errorMsg = f'ERROR: {row[1].value} with B# "{row[0].value}" does not exist.' 

+

220 

+

221 result[term]['courses'][course]['students'].append({ 

+

222 'user': (existingUser or cellVal), 

+

223 'displayMsg': displayMsg, 

+

224 'errorMsg': errorMsg}) 

+

225 if errorMsg: 

+

226 errors.append((errorMsg,0)) 

+

227 

+

228 elif cellVal: # but didn't match the regex 

+

229 errors.append((f'ERROR: "{cellVal}" in row {cellRow} of the Excel document does not appear to be a term, course, or valid B#.',1)) 

+

230 

+

231 

+

232 return result, errors 

+

233 

+

234def saveCourseParticipantsToDatabase(cpPreview): 

+

235 for term,terminfo in cpPreview.items(): 

+

236 termObj = Term.get_or_none(description = term) or addPastTerm(term) 

+

237 if not termObj: 

+

238 print(f"Unable to find or create term {term}") 

+

239 continue 

+

240 

+

241 for course, courseinfo in terminfo['courses'].items(): 

+

242 if 'errorMsg' in courseinfo and courseinfo['errorMsg']: 

+

243 print(f"Unable to save course {course}. {courseinfo['errorMsg']}") 

+

244 continue 

+

245 

+

246 courseObj = Course.get_or_create( 

+

247 courseAbbreviation = course, 

+

248 term = termObj, 

+

249 defaults = {"CourseName" : "", 

+

250 "sectionDesignation" : "", 

+

251 "courseCredit" : "1", 

+

252 "term" : termObj, 

+

253 "status" : 4, 

+

254 "createdBy" : g.current_user, 

+

255 "serviceLearningDesignatedSections" : "", 

+

256 "previouslyApprovedDescription" : "" })[0] 

+

257 

+

258 for userDict in courseinfo['students']: 

+

259 if userDict['errorMsg']: 

+

260 print(f"Unable to save student. {userDict['errorMsg']}") 

+

261 continue 

+

262 

+

263 CourseParticipant.get_or_create(user=userDict['user'], 

+

264 course=courseObj) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_term_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_term_py.html new file mode 100644 index 000000000..ae92808d6 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_term_py.html @@ -0,0 +1,159 @@ + + + + + Coverage for app/logic/term.py: 74% + + + + + +
+
+

+ Coverage for app/logic/term.py: + 74% +

+ +

+ 43 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from flask import session, g 

+

2from playhouse.shortcuts import model_to_dict 

+

3from app.logic.createLogs import createAdminLog 

+

4from app.models.term import Term 

+

5 

+

6def addNextTerm(): 

+

7 newSemesterMap = {"Spring":"Summer", 

+

8 "Summer":"Fall", 

+

9 "Fall":"Spring"} 

+

10 terms = list(Term.select().order_by(Term.termOrder)) 

+

11 prevTerm = terms[-1] 

+

12 prevSemester, prevYear = prevTerm.description.split() 

+

13 

+

14 newYear = int(prevYear) + 1 if prevSemester == "Fall" else int(prevYear) 

+

15 

+

16 newDescription = newSemesterMap[prevSemester] + " " + str(newYear) 

+

17 newAY = prevTerm.academicYear 

+

18 if prevSemester == "Summer ": # we only change academic year when the latest term in the table is Summer 

+

19 year1, year2 = prevTerm.academicYear.split("-") 

+

20 newAY = year2 + "-" + str(int(year2)+1) 

+

21 

+

22 semester = newDescription.split()[0] 

+

23 summer= "Summer" in semester 

+

24 newTerm = Term.create(description=newDescription, 

+

25 year=newYear, 

+

26 academicYear=newAY, 

+

27 isSummer= summer, 

+

28 termOrder=Term.convertDescriptionToTermOrder(newDescription)) 

+

29 newTerm.save() 

+

30 

+

31 return newTerm 

+

32 

+

33def addPastTerm(description): 

+

34 semester, year = description.split() 

+

35 if 'May' in semester: 

+

36 semester = "Summer" 

+

37 if semester == "Fall": 

+

38 academicYear = year + "-" + str(int(year) + 1) 

+

39 elif semester == "Summer" or "Spring": 

+

40 academicYear= str(int(year) - 1) + "-" + year 

+

41 

+

42 isSummer = "Summer" in semester 

+

43 newDescription=f"{semester} {year}" 

+

44 orderTerm = Term.convertDescriptionToTermOrder(newDescription) 

+

45 

+

46 createdOldTerm = Term.create(description= newDescription, 

+

47 year=year, 

+

48 academicYear=academicYear, 

+

49 isSummer=isSummer, 

+

50 termOrder=orderTerm) 

+

51 createdOldTerm.save() 

+

52 return createdOldTerm 

+

53 

+

54def changeCurrentTerm(term): 

+

55 oldCurrentTerm = Term.get_by_id(g.current_term) 

+

56 oldCurrentTerm.isCurrentTerm = False 

+

57 oldCurrentTerm.save() 

+

58 newCurrentTerm = Term.get_by_id(term) 

+

59 newCurrentTerm.isCurrentTerm = True 

+

60 newCurrentTerm.save() 

+

61 session["current_term"] = model_to_dict(newCurrentTerm) 

+

62 createAdminLog(f"Changed Current Term from {oldCurrentTerm.description} to {newCurrentTerm.description}") 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_transcript_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_transcript_py.html new file mode 100644 index 000000000..4798bafe8 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_transcript_py.html @@ -0,0 +1,174 @@ + + + + + Coverage for app/logic/transcript.py: 97% + + + + + +
+
+

+ Coverage for app/logic/transcript.py: + 97% +

+ +

+ 30 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from peewee import fn 

+

2 

+

3from app.models.course import Course 

+

4from app.models.courseParticipant import CourseParticipant 

+

5from app.models.program import Program 

+

6from app.models.courseInstructor import CourseInstructor 

+

7from app.models.user import User 

+

8from app.models.term import Term 

+

9from app.models.eventParticipant import EventParticipant 

+

10from app.models.event import Event 

+

11 

+

12def getProgramTranscript(username): 

+

13 """ 

+

14 Returns a Program query object containing all the programs for 

+

15 current user. 

+

16 """ 

+

17 # Add up hours earned in a term for each program they've participated in 

+

18 

+

19 EventData = (Event.select(Event, fn.SUM(EventParticipant.hoursEarned).alias("hoursEarned")) 

+

20 .join(EventParticipant) 

+

21 .where(EventParticipant.user == username) 

+

22 .group_by(Event.program, Event.term) 

+

23 .order_by(Event.term) 

+

24 .having(fn.SUM(EventParticipant.hoursEarned > 0))) 

+

25 transcriptData = {} 

+

26 for event in EventData: 

+

27 if event.program in transcriptData: 

+

28 transcriptData[event.program].append([event.term.description, event.hoursEarned]) 

+

29 else: 

+

30 transcriptData[event.program] = [[event.term.description, event.hoursEarned]] 

+

31 return transcriptData 

+

32 

+

33def getSlCourseTranscript(username): 

+

34 """ 

+

35 Returns a SLCourse query object containing all the training events for 

+

36 current user. 

+

37 """ 

+

38 

+

39 slCourses = (Course.select(Course, fn.SUM(CourseParticipant.hoursEarned).alias("hoursEarned")) 

+

40 .join(CourseParticipant, on=(Course.id == CourseParticipant.course)) 

+

41 .where(CourseParticipant.user == username) 

+

42 .group_by(Course.courseName, Course.term)) 

+

43 

+

44 return slCourses 

+

45 

+

46def getTotalHours(username): 

+

47 """ 

+

48 Get the toal hours from events and courses combined. 

+

49 """ 

+

50 eventHours = (EventParticipant.select(fn.SUM(EventParticipant.hoursEarned)) 

+

51 .where(EventParticipant.user == username)).scalar() 

+

52 courseHours = (CourseParticipant.select(fn.SUM(CourseParticipant.hoursEarned)) 

+

53 .where(CourseParticipant.user == username)).scalar() 

+

54 

+

55 allHours = {"totalEventHours": (eventHours or 0), 

+

56 "totalCourseHours": (courseHours or 0), 

+

57 "totalHours": (eventHours or 0) + (courseHours or 0)} 

+

58 return allHours 

+

59 

+

60def getStartYear(username): 

+

61 """ 

+

62 Returns the users start term for participation in the CELTS organization 

+

63 """ 

+

64 

+

65 startDate = (EventParticipant.select(Term.year) 

+

66 .join(Event) 

+

67 .join(Term).where(EventParticipant.user == username) 

+

68 + CourseParticipant.select(Term.year) 

+

69 .join(Course) 

+

70 .join(Term) 

+

71 .where(CourseParticipant.user == username) 

+

72 ).order_by(Event.term.year).first() 

+

73 

+

74 if startDate: 

+

75 return startDate.event.term.year 

+

76 

+

77 return "N/A" 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_userManagement_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_userManagement_py.html new file mode 100644 index 000000000..4872314f8 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_userManagement_py.html @@ -0,0 +1,164 @@ + + + + + Coverage for app/logic/userManagement.py: 100% + + + + + +
+
+

+ Coverage for app/logic/userManagement.py: + 100% +

+ +

+ 49 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models.user import User 

+

2from app.models.term import Term 

+

3from app.models.programManager import ProgramManager 

+

4from app.models.program import Program 

+

5from app.models.eventTemplate import EventTemplate 

+

6from flask import g, session 

+

7from app.logic.createLogs import createAdminLog 

+

8from playhouse.shortcuts import model_to_dict 

+

9 

+

10def addCeltsAdmin(user): 

+

11 user = User.get_by_id(user) 

+

12 user.isCeltsAdmin = True 

+

13 user.save() 

+

14 createAdminLog(f'Made {user.firstName} {user.lastName} a CELTS admin member.') 

+

15 

+

16 

+

17def addCeltsStudentStaff(user): 

+

18 user = User.get_by_id(user) 

+

19 user.isCeltsStudentStaff = True 

+

20 user.save() 

+

21 createAdminLog(f'Made {user.firstName} {user.lastName} a CELTS student staff member.') 

+

22 

+

23 

+

24def removeCeltsAdmin(user): 

+

25 user = User.get_by_id(user) 

+

26 user.isCeltsAdmin = False 

+

27 user.save() 

+

28 createAdminLog(f'Removed {user.firstName} {user.lastName} from CELTS admins.') 

+

29 

+

30 

+

31def removeCeltsStudentStaff(user): 

+

32 user = User.get_by_id(user) 

+

33 user.isCeltsStudentStaff = False 

+

34 user.save() 

+

35 createAdminLog(f'Removed {user.firstName} {user.lastName} from a CELTS student staff member.') 

+

36 

+

37def changeProgramInfo(newProgramName, newContactEmail, newContactName, newLocation, programId): 

+

38 """Updates the program info with a new sender and email.""" 

+

39 program = Program.get_by_id(programId) 

+

40 updatedProgram = Program.update({Program.programName:newProgramName, Program.contactEmail: newContactEmail, Program.contactName:newContactName, Program.defaultLocation:newLocation}).where(Program.id==programId) 

+

41 updatedProgram.execute() 

+

42 if newProgramName != program.programName: 

+

43 createAdminLog(f"{program.programName} Program Name was changed to: {newProgramName}") 

+

44 if newContactEmail != program.contactEmail: 

+

45 createAdminLog(f"{program.programName} Contact Email was changed to: {newContactEmail}") 

+

46 if newContactName != program.contactName: 

+

47 createAdminLog(f"{program.programName} Contact Name was changed to: {newContactName}") 

+

48 if newLocation != program.defaultLocation: 

+

49 createAdminLog(f"{program.programName} Location was changed to: {newLocation}") 

+

50 

+

51 return (f'Program email info updated') 

+

52 

+

53def getAllowedPrograms(currentUser): 

+

54 """Returns a list of all visible programs depending on who the current user is.""" 

+

55 if currentUser.isCeltsAdmin: 

+

56 return Program.select().order_by(Program.programName) 

+

57 else: 

+

58 return Program.select().join(ProgramManager).where(ProgramManager.user==currentUser).order_by(Program.programName) 

+

59 

+

60 

+

61 

+

62def getAllowedTemplates(currentUser): 

+

63 """Returns a list of all visible templates depending on who the current user is. If they are not an admin it should always be none.""" 

+

64 if currentUser.isCeltsAdmin: 

+

65 return EventTemplate.select().where(EventTemplate.isVisible==True).order_by(EventTemplate.name) 

+

66 else: 

+

67 return [] 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_users_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_users_py.html new file mode 100644 index 000000000..0540f1bf5 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_users_py.html @@ -0,0 +1,246 @@ + + + + + Coverage for app/logic/users.py: 100% + + + + + +
+
+

+ Coverage for app/logic/users.py: + 100% +

+ +

+ 56 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models.user import User 

+

2from app.models.event import Event 

+

3from app.models.programBan import ProgramBan 

+

4from app.models.interest import Interest 

+

5from app.models.note import Note 

+

6from app.models.user import User 

+

7from app.models.profileNote import ProfileNote 

+

8from app.models.backgroundCheck import BackgroundCheck 

+

9from app.models.backgroundCheckType import BackgroundCheckType 

+

10from app.logic.volunteers import addUserBackgroundCheck 

+

11import datetime 

+

12from peewee import JOIN 

+

13from dateutil import parser 

+

14from flask import g 

+

15 

+

16 

+

17def isEligibleForProgram(program, user): 

+

18 """ 

+

19 Verifies if a given user is eligible for a program by checking if they are 

+

20 banned from a program. 

+

21 

+

22 :param program: accepts a Program object or a valid programid 

+

23 :param user: accepts a User object or userid 

+

24 :return: True if the user is not banned and meets the requirements, and False otherwise 

+

25 """ 

+

26 now = datetime.datetime.now() 

+

27 if (ProgramBan.select().where(ProgramBan.user == user, ProgramBan.program == program, ProgramBan.endDate > now, ProgramBan.unbanNote == None).exists()): 

+

28 return False 

+

29 return True 

+

30 

+

31def addUserInterest(program_id, username): 

+

32 """ 

+

33 This function is used to add an interest to . 

+

34 Parameters: 

+

35 program_id: id of the program the user is interested in 

+

36 username: username of the user showing interest 

+

37 """ 

+

38 Interest.get_or_create(program = program_id, user = username) 

+

39 return True 

+

40 

+

41def removeUserInterest(program_id, username): 

+

42 """ 

+

43 This function is used to add or remove interest from the interest table. 

+

44 Parameters: 

+

45 program_id: id of the program the user is interested in 

+

46 username: username of the user showing disinterest 

+

47 

+

48 """ 

+

49 interestToDelete = Interest.get_or_none(Interest.program == program_id, Interest.user == username) 

+

50 if interestToDelete: 

+

51 interestToDelete.delete_instance() 

+

52 return True 

+

53 

+

54def getBannedUsers(program): 

+

55 """ 

+

56 This function returns users banned from a program. 

+

57 """ 

+

58 return ProgramBan.select().where(ProgramBan.program == program, ProgramBan.unbanNote == None) 

+

59 

+

60def isBannedFromEvent(username, eventId): 

+

61 """ 

+

62 This function returns whether the user is banned from the program associated with an event. 

+

63 """ 

+

64 program = Event.get_by_id(eventId).program 

+

65 user = User.get(User.username == username) 

+

66 return not isEligibleForProgram(program, user) 

+

67 

+

68def banUser(program_id, username, note, banEndDate, creator): 

+

69 """ 

+

70 This function creates an entry in the note table and programBan table in order 

+

71 to ban the selected user. 

+

72 Parameters: 

+

73 program_id: primary id of the program the user has been banned from 

+

74 username: username of the user to be banned 

+

75 note: note left about the ban, expected to be a reason why the change is needed 

+

76 banEndDate: date when the ban will end 

+

77 creator: the admin or person with authority who created the ban 

+

78 """ 

+

79 noteForDb = Note.create(createdBy = creator, 

+

80 createdOn = datetime.datetime.now(), 

+

81 noteContent = note, 

+

82 isPrivate = 0, 

+

83 noteType = "ban") 

+

84 

+

85 ProgramBan.create(program = program_id, 

+

86 user = username, 

+

87 endDate = banEndDate, 

+

88 banNote = noteForDb) 

+

89 

+

90def unbanUser(program_id, username, note, creator): 

+

91 """ 

+

92 This function creates an entry in the note table and programBan table in order 

+

93 to unban the selected user. 

+

94 Parameters: 

+

95 program_id: primary id of the program the user has been unbanned from 

+

96 username: username of the user to be unbanned 

+

97 note: note left about the ban, expected to be a reason why the change is needed 

+

98 creator: the admin or person with authority who removed the ban 

+

99 """ 

+

100 noteForDb = Note.create(createdBy = creator, 

+

101 createdOn = datetime.datetime.now(), 

+

102 noteContent = note, 

+

103 isPrivate = 0, 

+

104 noteType = "unban") 

+

105 ProgramBan.update(endDate = datetime.datetime.now(), 

+

106 unbanNote = noteForDb).where(ProgramBan.program == program_id, 

+

107 ProgramBan.user == username, 

+

108 ProgramBan.endDate > datetime.datetime.now()).execute() 

+

109 

+

110def getUserBGCheckHistory(username): 

+

111 """ 

+

112 Get a users background check history 

+

113 """ 

+

114 bgHistory = {'CAN': [], 'FBI': [], 'SHS': [], 'BSL': []} 

+

115 

+

116 allBackgroundChecks = (BackgroundCheck.select(BackgroundCheck, BackgroundCheckType) 

+

117 .join(BackgroundCheckType) 

+

118 .where(BackgroundCheck.user == username) 

+

119 .order_by(BackgroundCheck.dateCompleted.desc())) 

+

120 for row in allBackgroundChecks: 

+

121 bgHistory[row.type_id].append(row) 

+

122 

+

123 return bgHistory 

+

124 

+

125def addProfileNote(visibility, bonner, noteTextbox, username): 

+

126 if bonner: 

+

127 visibility = 1 # bonner notes are always admins and the student 

+

128 

+

129 noteForDb = Note.create(createdBy = g.current_user, 

+

130 createdOn = datetime.datetime.now(), 

+

131 noteContent = noteTextbox, 

+

132 noteType = "profile") 

+

133 createProfileNote = ProfileNote.create(user = User.get(User.username == username), 

+

134 note = noteForDb, 

+

135 isBonnerNote = bonner, 

+

136 viewTier = visibility) 

+

137 return createProfileNote 

+

138 

+

139def deleteProfileNote(noteId): 

+

140 return ProfileNote.delete().where(ProfileNote.id == noteId).execute() 

+

141 

+

142def updateDietInfo(username, dietContent): 

+

143 """ 

+

144 Creates or update a user's diet information 

+

145 """ 

+

146 

+

147 User.update(dietRestriction = dietContent).where(User.username == username).execute() 

+

148 

+

149 return "" 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_utils_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_utils_py.html new file mode 100644 index 000000000..2c45c21b4 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_utils_py.html @@ -0,0 +1,183 @@ + + + + + Coverage for app/logic/utils.py: 59% + + + + + +
+
+

+ Coverage for app/logic/utils.py: + 59% +

+ +

+ 41 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from datetime import datetime 

+

2import collections.abc as collections 

+

3 

+

4from flask import session 

+

5from peewee import DoesNotExist 

+

6 

+

7from app.models.term import Term 

+

8 

+

9def selectSurroundingTerms(currentTerm, prevTerms=2): 

+

10 """ 

+

11 Returns a list of term objects around the provided Term object for the current term. 

+

12 Chooses the previous terms according to the prevTerms parameter (defaulting to 2), 

+

13 and then chooses terms for the next two years after the current term. 

+

14 

+

15 To get only the current and future terms, pass prevTerms=0. 

+

16 """ 

+

17 startTerm = max(1, currentTerm.id - prevTerms) 

+

18 surroundingTerms = (Term.select() 

+

19 .where(Term.id >= startTerm) 

+

20 .where((Term.year <= currentTerm.year + 2)) 

+

21 .order_by(Term.termOrder)) 

+

22 

+

23 return surroundingTerms 

+

24 

+

25def getStartofCurrentAcademicYear(currentTerm): 

+

26 if ("Summer" in currentTerm.description) or ("Spring" in currentTerm.description): 

+

27 fallTerm = Term.select().where(Term.year==currentTerm.year-1, Term.description == f"Fall {currentTerm.year-1}").get() 

+

28 return fallTerm 

+

29 return currentTerm 

+

30 

+

31def format24HourTime(unformattedTime): 

+

32 """ 

+

33 Turns a time string or datetime object into a string with a time in 24 hour format 

+

34 unformattedTime: expects a string with format HH:mm AM/PM or HH:mm OR a datetime object 

+

35 returns: a string in 24 hour format HH:mm 

+

36 """ 

+

37 if type(unformattedTime) == str: 

+

38 try: 

+

39 formattedTime = datetime.strptime(unformattedTime, "%I:%M %p").strftime("%H:%M") # Converts string to datetime then back to string and formats correctly 

+

40 return formattedTime 

+

41 except ValueError: 

+

42 # calling strptime here to explicitly raise an exception if it wasn't properly in 24 hour format 

+

43 formattedTime = datetime.strptime(unformattedTime, "%H:%M") 

+

44 return unformattedTime 

+

45 else: 

+

46 formattedTime = unformattedTime.strftime("%H:%M") 

+

47 return formattedTime 

+

48 

+

49def getUsernameFromEmail(email): 

+

50 return email.split("@")[0] 

+

51 

+

52def getFilesFromRequest(request): 

+

53 attachmentFiles = request.files.getlist("attachmentObject") 

+

54 fileDoesNotExist = attachmentFiles[0].content_type == "application/octet-stream" 

+

55 if fileDoesNotExist: 

+

56 attachmentFiles = None 

+

57 

+

58 return attachmentFiles 

+

59 

+

60def getRedirectTarget(popTarget=False): 

+

61 """ 

+

62 This function returns a string with the URL or route to a page in the Application 

+

63 saved with setRedirectTarget() and is able to pop the value from the session 

+

64 to make it an empty value 

+

65 popTarget: expects a bool value to determine whether or not to reset 

+

66 redirectTarget to an emtpy value 

+

67 return: a string with the URL or route to a page in the application that was 

+

68 saved in setRedirectTarget() 

+

69 """ 

+

70 if "redirectTarget" not in session: 

+

71 return '' 

+

72 

+

73 target = session["redirectTarget"] 

+

74 if popTarget: 

+

75 session.pop("redirectTarget") 

+

76 return target 

+

77 

+

78def setRedirectTarget(target): 

+

79 """ 

+

80 This function saves the target URL in the session for future redirection 

+

81 to said page 

+

82 target: expects a string that is a URL or a route to a page in the application 

+

83 return: None 

+

84 """ 

+

85 session["redirectTarget"] = target 

+

86 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_volunteers_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_volunteers_py.html new file mode 100644 index 000000000..684ebcd17 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_074bda25efadd8bd_volunteers_py.html @@ -0,0 +1,203 @@ + + + + + Coverage for app/logic/volunteers.py: 85% + + + + + +
+
+

+ Coverage for app/logic/volunteers.py: + 85% +

+ +

+ 55 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models.eventParticipant import EventParticipant 

+

2from app.models.user import User 

+

3from app.models.event import Event 

+

4from app.models.program import Program 

+

5from app.models.backgroundCheck import BackgroundCheck 

+

6from app.models.programManager import ProgramManager 

+

7from datetime import datetime, date 

+

8from app.logic.createLogs import createAdminLog 

+

9 

+

10def getEventLengthInHours(startTime, endTime, eventDate): 

+

11 """ 

+

12 Converts the event length hours into decimal 

+

13 parameters: startTime- start time event (type: time) 

+

14 endTime- end time event (type: time) 

+

15 eventDate- date of the event (type: datetime) 

+

16 """ 

+

17 #can only subtract datetime objects, not time objects. So convert time into datetime 

+

18 eventLength = datetime.combine(eventDate, endTime) - datetime.combine(eventDate, startTime) 

+

19 eventLengthInHours = round(eventLength.seconds/3600, 2) 

+

20 return eventLengthInHours 

+

21 

+

22 

+

23def updateEventParticipants(participantData): 

+

24 """ 

+

25 Create new entry in event participant table if user does not exist. Otherwise, updates the record. 

+

26 

+

27 param: participantData- an ImmutableMultiDict that contains data from every row of the page along with the associated username. 

+

28 """ 

+

29 event = Event.get_or_none(Event.id==participantData['event']) 

+

30 if not event: 

+

31 raise Exception("Event does not exist.") # ??? 

+

32 return False 

+

33 

+

34 

+

35 for username in participantData.getlist("username"): 

+

36 userObject = User.get_or_none(User.username==username) 

+

37 eventParticipant = EventParticipant.get_or_none(user=userObject, event=participantData['event']) 

+

38 if userObject: 

+

39 if participantData.get(f'checkbox_{username}'): #if the user is marked as present 

+

40 inputHours = participantData.get(f'inputHours_{username}') 

+

41 hoursEarned = float(inputHours) if inputHours else 0 

+

42 if eventParticipant: 

+

43 ((EventParticipant.update({EventParticipant.hoursEarned: hoursEarned}) 

+

44 .where(EventParticipant.event==event.id, EventParticipant.user==userObject.username)) 

+

45 .execute()) 

+

46 else: 

+

47 EventParticipant.create(user=userObject, event=event, hoursEarned=hoursEarned) 

+

48 else: 

+

49 ((EventParticipant.delete() 

+

50 .where(EventParticipant.user==userObject.username, EventParticipant.event==event.id)) 

+

51 .execute()) 

+

52 else: 

+

53 return False 

+

54 return True 

+

55 

+

56 

+

57def addVolunteerToEventRsvp(user, volunteerEventID): 

+

58 ''' 

+

59 Adds a volunteer to event rsvp table when a user rsvps and when they are 

+

60 added through the track volunteer page by an admin. 

+

61 

+

62 param: user - a string containing username 

+

63 volunteerEventID - id of the event the volunteer is being registered for 

+

64 ''' 

+

65 try: 

+

66 if not EventRsvp.get_or_none(user=user, event=volunteerEventID): 

+

67 EventRsvp.create(user=user, event=volunteerEventID) 

+

68 return True 

+

69 

+

70 except Exception as e: 

+

71 return False 

+

72 

+

73def addUserBackgroundCheck(user, bgType, bgStatus, dateCompleted): 

+

74 """ 

+

75 Changes the status of a users background check depending on what was marked 

+

76 on their volunteer profile. 

+

77 """ 

+

78 today = date.today() 

+

79 user = User.get_by_id(user) 

+

80 if bgStatus == '' and dateCompleted == '': 

+

81 createAdminLog(f"Marked {user.firstName} {user.lastName}'s background check for {bgType} as 'in progress'.") 

+

82 else: 

+

83 if not dateCompleted: 

+

84 dateCompleted = None 

+

85 update = BackgroundCheck.create(user=user, type=bgType, backgroundCheckStatus=bgStatus, dateCompleted=dateCompleted) 

+

86 if bgStatus == 'Submitted': 

+

87 createAdminLog(f"Marked {user.firstName} {user.lastName}'s background check for {bgType} as submitted.") 

+

88 elif bgStatus == 'Passed': 

+

89 createAdminLog(f"Marked {user.firstName} {user.lastName}'s background check for {bgType} as passed.") 

+

90 else: 

+

91 createAdminLog(f"Marked {user.firstName} {user.lastName}'s background check for {bgType} as failed.") 

+

92 

+

93def setProgramManager(username, program_id, action): 

+

94 ''' 

+

95 adds and removes the studentstaff from program that makes them student manager. 

+

96 

+

97 param: uername - a string 

+

98 program_id - id 

+

99 action: add, remove 

+

100 

+

101 ''' 

+

102 studentstaff=User.get(User.username==username) 

+

103 if action == "add" and studentstaff.isCeltsStudentStaff==True: 

+

104 studentstaff.addProgramManager(program_id) 

+

105 elif action == "remove": 

+

106 studentstaff.removeProgramManager(program_id) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_0e098e07e81a8f2f___init___py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_0e098e07e81a8f2f___init___py.html new file mode 100644 index 000000000..eccaa313e --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_0e098e07e81a8f2f___init___py.html @@ -0,0 +1,107 @@ + + + + + Coverage for app/controllers/serviceLearning/__init__.py: 100% + + + + + +
+
+

+ Coverage for app/controllers/serviceLearning/__init__.py: + 100% +

+ +

+ 3 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from flask import Blueprint 

+

2 

+

3# Blueprint Configuration 

+

4serviceLearning_bp = Blueprint( 

+

5 'serviceLearning', __name__, 

+

6 template_folder='templates', 

+

7 static_folder='static' 

+

8) 

+

9 

+

10from app.controllers.serviceLearning import routes 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_0e098e07e81a8f2f_routes_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_0e098e07e81a8f2f_routes_py.html new file mode 100644 index 000000000..b10c25417 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_0e098e07e81a8f2f_routes_py.html @@ -0,0 +1,392 @@ + + + + + Coverage for app/controllers/serviceLearning/routes.py: 27% + + + + + +
+
+

+ Coverage for app/controllers/serviceLearning/routes.py: + 27% +

+ +

+ 194 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from flask import request, render_template, g, url_for, abort, redirect, flash, session, send_from_directory, send_file, jsonify 

+

2from werkzeug.utils import safe_join 

+

3import os 

+

4from peewee import * 

+

5from app.models.user import User 

+

6from app.models.term import Term 

+

7from app.models.course import Course 

+

8from app.models.courseStatus import CourseStatus 

+

9from app.models.courseInstructor import CourseInstructor 

+

10from app.models.courseQuestion import CourseQuestion 

+

11from app.models.attachmentUpload import AttachmentUpload 

+

12from app.logic.utils import selectSurroundingTerms, getFilesFromRequest 

+

13from app.logic.fileHandler import FileHandler 

+

14from app.logic.serviceLearningCoursesData import getServiceLearningCoursesData, withdrawProposal, renewProposal 

+

15from app.logic.courseManagement import updateCourse, createCourse 

+

16from app.logic.downloadFile import * 

+

17from app.logic.courseManagement import approvedCourses 

+

18from app.logic.utils import getRedirectTarget, setRedirectTarget 

+

19from app.controllers.serviceLearning import serviceLearning_bp 

+

20 

+

21 

+

22@serviceLearning_bp.route('/serviceLearning/courseManagement', methods = ['GET']) 

+

23@serviceLearning_bp.route('/serviceLearning/courseManagement/<username>', methods = ['GET']) 

+

24def serviceCourseManagement(username=None): 

+

25 try: 

+

26 user = User.get(User.username==username) if username else g.current_user 

+

27 except DoesNotExist: 

+

28 abort(404) 

+

29 

+

30 isRequestingForSelf = g.current_user == user 

+

31 if g.current_user.isCeltsAdmin or (g.current_user.isFaculty and isRequestingForSelf): 

+

32 setRedirectTarget(request.full_path) 

+

33 courseDict = getServiceLearningCoursesData(user) 

+

34 termList = selectSurroundingTerms(g.current_term, prevTerms=0) 

+

35 return render_template('serviceLearning/slcManagement.html', 

+

36 user=user, 

+

37 courseDict=courseDict, 

+

38 termList=termList) 

+

39 else: 

+

40 abort(403) 

+

41 

+

42 

+

43@serviceLearning_bp.route('/serviceLearning/viewProposal/<courseID>', methods=['GET']) 

+

44@serviceLearning_bp.route('/serviceLearning/editProposal/upload/<courseID>', methods=['GET']) 

+

45@serviceLearning_bp.route('/serviceLearning/editProposal/<courseID>', methods=['GET']) 

+

46def slcEditProposal(courseID): 

+

47 """ 

+

48 Route for editing proposals, it will fill the form with the data found in the database 

+

49 given a courseID. 

+

50 """ 

+

51 instructors = CourseInstructor.select().where(CourseInstructor.course==courseID) 

+

52 courseInstructors = [instructor.user for instructor in instructors] 

+

53 isCourseCreator = Course.select().where(Course.createdBy == g.current_user, Course.id==courseID).exists() 

+

54 

+

55 if g.current_user.isCeltsAdmin or g.current_user in courseInstructors or isCourseCreator: 

+

56 course = Course.get_by_id(courseID) 

+

57 courseStatus = CourseStatus.get_by_id(course.status) 

+

58 courseStatusInt = courseStatus.get_id() 

+

59 approved = 3 

+

60 # Condition to check the route you are comming from 

+

61 if courseStatusInt==approved and request.path == f"/serviceLearning/editProposal/{courseID}": 

+

62 return redirect(f"/serviceLearning/viewProposal/{courseID}") 

+

63 else: 

+

64 statusOfCourse = Course.select(Course.status) 

+

65 questionData = (CourseQuestion.select().where(CourseQuestion.course == course)) 

+

66 questionanswers = [question.questionContent for question in questionData] 

+

67 courseInstructor = CourseInstructor.select().where(CourseInstructor.course == courseID) 

+

68 associatedAttachments = AttachmentUpload.select().where(AttachmentUpload.course == course.id) 

+

69 

+

70 filepaths = FileHandler(courseId=course.id).retrievePath(associatedAttachments) 

+

71 

+

72 terms = selectSurroundingTerms(g.current_term, 0) 

+

73 return render_template('serviceLearning/slcNewProposal.html', 

+

74 course = course, 

+

75 questionanswers = questionanswers, 

+

76 terms = terms, 

+

77 statusOfCourse = statusOfCourse, 

+

78 courseStatus = courseStatus, 

+

79 courseInstructor = courseInstructor, 

+

80 filepaths = filepaths, 

+

81 redirectTarget=getRedirectTarget()) 

+

82 else: 

+

83 abort(403) 

+

84 

+

85 

+

86@serviceLearning_bp.route('/serviceLearning/createCourse', methods=['POST']) 

+

87def slcCreateCourse(): 

+

88 """will give a new course ID so that it can redirect to an edit page""" 

+

89 course = createCourse(g.current_user) 

+

90 

+

91 return redirect(url_for('serviceLearning.slcEditProposal', courseID = course.id)) 

+

92 

+

93 

+

94@serviceLearning_bp.route('/serviceLearning/exit', methods=['GET']) 

+

95def slcExitView(): 

+

96 if getRedirectTarget(): 

+

97 return redirect(getRedirectTarget(True)) 

+

98 else: 

+

99 return redirect("/serviceLearning/courseManagement") 

+

100 

+

101 

+

102@serviceLearning_bp.route('/serviceLearning/saveExit', methods=['POST']) 

+

103@serviceLearning_bp.route('/serviceLearning/saveProposal', methods=['POST']) 

+

104def slcSaveContinue(): 

+

105 """Will update the the course proposal and return an empty string since ajax request needs a response 

+

106 Also, it updates the course status as 'in progress'""" 

+

107 course = updateCourse(request.form.copy(), attachments=getFilesFromRequest(request)) 

+

108 

+

109 if not course: 

+

110 flash("Error saving changes", "danger") 

+

111 else: 

+

112 course.status = CourseStatus.IN_PROGRESS 

+

113 course.save() 

+

114 flash(f"Proposal has been saved.", "success") 

+

115 if request.path == "/serviceLearning/saveExit": 

+

116 if getRedirectTarget(): 

+

117 return redirect(getRedirectTarget(True)) 

+

118 return redirect("/serviceLearning/courseManagement") 

+

119 return redirect(f'/serviceLearning/editProposal/{request.form["courseID"]}?tab=2') 

+

120 

+

121@serviceLearning_bp.route('/serviceLearning/newProposal', methods=['GET', 'POST']) 

+

122def slcCreateOrEdit(): 

+

123 if request.method == "POST": 

+

124 course = updateCourse(request.form.copy()) 

+

125 if not course: 

+

126 flash("Error saving changes", "danger") 

+

127 else: 

+

128 if getRedirectTarget(False): 

+

129 return redirect('' + getRedirectTarget(True) + '') 

+

130 return redirect('/serviceLearning/courseManagement') 

+

131 

+

132 terms = Term.select().where(Term.year >= g.current_term.year) 

+

133 courseData = None 

+

134 return render_template('serviceLearning/slcNewProposal.html', 

+

135 terms = terms, 

+

136 courseData = courseData, 

+

137 redirectTarget = getRedirectTarget(True)) 

+

138 

+

139@serviceLearning_bp.route('/serviceLearning/approveCourse', methods=['POST']) 

+

140def approveCourse(): 

+

141 """ 

+

142 This function updates and approves a Service-Learning Course when using the 

+

143 approve button. 

+

144 return: empty string because AJAX needs to receive something 

+

145 """ 

+

146 

+

147 try: 

+

148 # We are only approving, and not updating 

+

149 if len(request.form) == 1: 

+

150 course = Course.get_by_id(request.form['courseID']) 

+

151 

+

152 # We have data and need to update the course first 

+

153 else: 

+

154 course = updateCourse(request.form.copy()) 

+

155 

+

156 course.status = CourseStatus.APPROVED 

+

157 course.save() 

+

158 flash("Course approved!", "success") 

+

159 

+

160 except Exception as e: 

+

161 print(e) 

+

162 flash("Course not approved!", "danger") 

+

163 return "" 

+

164@serviceLearning_bp.route('/serviceLearning/unapproveCourse', methods=['POST']) 

+

165def unapproveCourse(): 

+

166 """ 

+

167 This function updates and unapproves a Service-Learning Course when using the 

+

168 unapprove button. 

+

169 return: empty string because AJAX needs to receive something 

+

170 """ 

+

171 

+

172 try: 

+

173 if len(request.form) == 1: 

+

174 course = Course.get_by_id(request.form['courseID']) 

+

175 else: 

+

176 course = updateCourse(request.form.copy()) 

+

177 

+

178 course.status = CourseStatus.SUBMITTED 

+

179 course.save() 

+

180 flash("Course unapproved!", "success") 

+

181 

+

182 except Exception as e: 

+

183 print(e) 

+

184 flash("Course was not unapproved!", "danger") 

+

185 

+

186 return "" 

+

187 

+

188@serviceLearning_bp.route('/updateInstructorPhone', methods=['POST']) 

+

189def updateInstructorPhone(): 

+

190 instructorData = request.get_json() 

+

191 (User.update(phoneNumber=instructorData[1]) 

+

192 .where(User.username == instructorData[0])).execute() 

+

193 return "success" 

+

194 

+

195@serviceLearning_bp.route('/serviceLearning/withdraw/<courseID>', methods = ['POST']) 

+

196def withdrawCourse(courseID): 

+

197 try: 

+

198 if g.current_user.isAdmin or g.current_user.isFaculty: 

+

199 withdrawProposal(courseID) 

+

200 flash("Course successfully withdrawn", 'success') 

+

201 else: 

+

202 flash("Unauthorized to perform this action", 'warning') 

+

203 except Exception as e: 

+

204 print(e) 

+

205 flash("Withdrawal Unsuccessful", 'warning') 

+

206 return "" 

+

207 

+

208@serviceLearning_bp.route('/serviceLearning/renew/<courseID>/<termID>/', methods = ['POST']) 

+

209def renewCourse(courseID, termID): 

+

210 """ 

+

211 This function checks to see if the user is a CELTS admin or is 

+

212 an instructor of a course (faculty) and allows courses to be renewed. 

+

213 :return: empty string because AJAX needs to receive something 

+

214 """ 

+

215 instructors = CourseInstructor.select().where(CourseInstructor.course==courseID) 

+

216 courseInstructors = [instructor.user for instructor in instructors] 

+

217 isCourseCreator = Course.select().where(Course.createdBy == g.current_user, Course.id==courseID).exists() 

+

218 try: 

+

219 if g.current_user.isCeltsAdmin or g.current_user in courseInstructors or isCourseCreator: 

+

220 renewedProposal = renewProposal(courseID, termID) 

+

221 flash("Course successfully renewed", 'success') 

+

222 return str(renewedProposal.id) 

+

223 else: 

+

224 flash("Unauthorized to perform this action", 'warning') 

+

225 except Exception as e: 

+

226 print(e) 

+

227 flash("Renewal Unsuccessful", 'warning') 

+

228 

+

229 return "", 500 

+

230 

+

231@serviceLearning_bp.route('/serviceLearning/print/<courseID>', methods=['GET']) 

+

232def printCourse(courseID): 

+

233 """ 

+

234 This function will print a PDF of an SLC proposal. 

+

235 """ 

+

236 instructors = CourseInstructor.select().where(CourseInstructor.course==courseID) 

+

237 courseInstructors = [instructor.user for instructor in instructors] 

+

238 isCreator = Course.select().where(Course.createdBy == g.current_user, Course.id==courseID).exists() 

+

239 if g.current_user.isCeltsAdmin or g.current_user in courseInstructors or isCreator: 

+

240 try: 

+

241 course = Course.get_by_id(courseID) 

+

242 pdfCourse = Course.select().where(Course.id == courseID) 

+

243 pdfInstructor = CourseInstructor.select().where(CourseInstructor.course == courseID) 

+

244 pdfQuestions = (CourseQuestion.select().where(CourseQuestion.course == course)) 

+

245 questionanswers = [question.questionContent for question in pdfQuestions] 

+

246 

+

247 return render_template('serviceLearning/slcFormPrint.html', 

+

248 course = course, 

+

249 pdfCourse = pdfCourse, 

+

250 pdfInstructor = pdfInstructor, 

+

251 pdfQuestions = pdfQuestions, 

+

252 questionanswers=questionanswers 

+

253 ) 

+

254 except Exception as e: 

+

255 flash("An error was encountered when printing, please try again.", 'warning') 

+

256 print(e) 

+

257 return "", 500 

+

258 else: 

+

259 abort(403) 

+

260 

+

261@serviceLearning_bp.route("/uploadCourseFile", methods=['GET', "POST"]) 

+

262def uploadCourseFile(): 

+

263 try: 

+

264 attachment = getFilesFromRequest(request) 

+

265 courseID = request.form["courseID"] 

+

266 addFile= FileHandler(attachment, courseId=courseID) 

+

267 addFile.saveFiles() 

+

268 except: 

+

269 flash("No file selected.", "warning") 

+

270 return redirect('/serviceLearning/editProposal/upload/'+courseID) 

+

271 

+

272 

+

273@serviceLearning_bp.route("/deleteCourseFile", methods=["POST"]) 

+

274def deleteCourseFile(): 

+

275 fileData= request.form 

+

276 courseFile=FileHandler(courseId=fileData["databaseId"]) 

+

277 courseFile.deleteFile(fileData["fileId"]) 

+

278 return "" 

+

279 

+

280@serviceLearning_bp.route('/serviceLearning/downloadApprovedCourses/<termID>', methods = ['GET']) 

+

281def downloadApprovedCourses(termID): 

+

282 """ 

+

283 This function allows the download of csv file 

+

284 """ 

+

285 try: 

+

286 designator = "downloadApprovedCourses" 

+

287 csvInfo = approvedCourses(termID) 

+

288 fileFormat = {"headers":["Course Name", "Course Number", "Faculty", "Term", "Previously Approved Course?"]} 

+

289 filePath = safe_join(os.getcwd(), app.config['files']['base_path']) 

+

290 newFile = fileMaker(designator, csvInfo, "CSV", fileFormat) 

+

291 return send_from_directory(filePath, 'ApprovedCourses.csv', as_attachment=True) 

+

292 

+

293 except Exception as e: 

+

294 print(e) 

+

295 return "" 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_122d09e411690e95_send_event_reminder_emails_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_122d09e411690e95_send_event_reminder_emails_py.html new file mode 100644 index 000000000..058cb9f47 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_122d09e411690e95_send_event_reminder_emails_py.html @@ -0,0 +1,150 @@ + + + + + Coverage for app/scripts/send_event_reminder_emails.py: 91% + + + + + +
+
+

+ Coverage for app/scripts/send_event_reminder_emails.py: + 91% +

+ +

+ 33 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1import os 

+

2import socket 

+

3 

+

4from app import app 

+

5from app.logic.emailHandler import EmailHandler 

+

6from app.logic.events import getTomorrowsEvents 

+

7from app.models.term import Term 

+

8from app.models.user import User 

+

9from app.models.emailTemplate import EmailTemplate 

+

10 

+

11def sendEventReminderEmail(events): 

+

12 """Function that sends an email for every event occuring the next day""" 

+

13 if not len(events): 

+

14 return 0 

+

15 

+

16 counter = 0 

+

17 currentTerm = Term.get(isCurrentTerm=1) 

+

18 

+

19 template = EmailTemplate.get(purpose = "Reminder") 

+

20 templateSubject = template.subject 

+

21 templateBody = template.body 

+

22 for event in events: 

+

23 programId = event.program 

+

24 emailData = {"eventID":event.id, # creates the email data 

+

25 "programID":programId, 

+

26 "term":currentTerm.id, 

+

27 "emailSender":"Reminder Automation", 

+

28 "sender_name":"Reminder Automation", 

+

29 "templateIdentifier":"Reminder", 

+

30 "recipientsCategory":"Interested", 

+

31 "subject":templateSubject, 

+

32 "body":templateBody} 

+

33 sendEmail = EmailHandler(emailData, gethost()) 

+

34 sendEmail.send_email() 

+

35 counter += 1 

+

36 return counter 

+

37 

+

38def main(): 

+

39 sendEventReminderEmail(getTomorrowsEvents()) 

+

40 

+

41def gethost(): 

+

42 host = "localhost:8080" 

+

43 if os.getenv('IP'): 

+

44 host = os.getenv('IP') + ":" + os.getenv('PORT') 

+

45 else: 

+

46 host = socket.gethostbyname(socket.gethostname()) + ":8080" 

+

47 

+

48 if app.env == "production": 

+

49 host = socket.getfqdn() 

+

50 

+

51 return host 

+

52 

+

53# main() 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_2e3eaab626e4e78a___init___py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_2e3eaab626e4e78a___init___py.html new file mode 100644 index 000000000..e5ced0422 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_2e3eaab626e4e78a___init___py.html @@ -0,0 +1,110 @@ + + + + + Coverage for app/controllers/__init__.py: 100% + + + + + +
+
+

+ Coverage for app/controllers/__init__.py: + 100% +

+ +

+ 2 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app import app 

+

2import os 

+

3#from app.login_manager import require_login 

+

4 

+

5 

+

6#@app.context_processor 

+

7#def injectGlobalData(): 

+

8 #currentUser = require_login() 

+

9 #lastStaticUpdate = str(max(os.path.getmtime(os.path.join(root_path, f)) 

+

10 # for root_path, dirs, files in os.walk('app/static') 

+

11 # for f in files)) 

+

12 #return {'currentUser': currentUser, 

+

13 # 'lastStaticUpdate': lastStaticUpdate} 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_5f5a17c013354698___init___py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_5f5a17c013354698___init___py.html new file mode 100644 index 000000000..91982262c --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_5f5a17c013354698___init___py.html @@ -0,0 +1,208 @@ + + + + + Coverage for app/__init__.py: 66% + + + + + +
+
+

+ Coverage for app/__init__.py: + 66% +

+ +

+ 74 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1import os 

+

2import pprint 

+

3 

+

4from flask import Flask, render_template 

+

5from flask.helpers import get_env 

+

6from playhouse.shortcuts import model_to_dict, dict_to_model 

+

7from app.logic.config import load_config_files 

+

8 

+

9# Initialize our application 

+

10app = Flask(__name__, template_folder="templates") 

+

11 

+

12# Set the correct configuration according to the environment 

+

13load_config_files(app, get_env()) 

+

14 

+

15# set the secret key after configuration is set up 

+

16app.secret_key = app.config['secret_key'] 

+

17 

+

18# These imports must happen after configuration 

+

19from app.models.term import Term 

+

20from app.models.user import User 

+

21 

+

22from peewee import BaseQuery 

+

23from flask import session 

+

24if app.config['show_queries']: 

+

25 old_execute = BaseQuery.execute 

+

26 def new_execute(*args, **kwargs): 

+

27 if session: 

+

28 if 'querycount' not in session: 

+

29 session['querycount'] = 0 

+

30 

+

31 session['querycount'] += 1 

+

32 print("**Running query {}**".format(session['querycount'])) 

+

33 print(args[0]) 

+

34 return old_execute(*args, **kwargs) 

+

35 BaseQuery.execute = new_execute 

+

36 

+

37 

+

38######### Blueprints ############# 

+

39from app.controllers.admin import admin_bp as admin_bp 

+

40app.register_blueprint(admin_bp) 

+

41 

+

42from app.controllers.events import events_bp as events_bp 

+

43app.register_blueprint(events_bp) 

+

44 

+

45from app.controllers.main import main_bp as main_bp 

+

46app.register_blueprint(main_bp) 

+

47 

+

48from app.controllers.serviceLearning import serviceLearning_bp as serviceLearning_bp 

+

49app.register_blueprint(serviceLearning_bp) 

+

50################################## 

+

51 

+

52# Make 'ENV' a variable everywhere 

+

53@app.context_processor 

+

54def inject_environment(): 

+

55 return dict( env=get_env() ) 

+

56 

+

57@app.before_request 

+

58def queryCount(): 

+

59 if session: 

+

60 session['querycount'] = 0 

+

61 

+

62from app.logic.loginManager import getLoginUser 

+

63from flask import g 

+

64@app.before_request 

+

65def load_user(): 

+

66 # An exception handles both current_user not being set and a mismatch between models 

+

67 try: 

+

68 g.current_user = dict_to_model(User,session['current_user']) 

+

69 except Exception as e: 

+

70 user = getLoginUser() 

+

71 session['current_user'] = model_to_dict(user) 

+

72 g.current_user = user 

+

73 

+

74from app.logic.loginManager import getCurrentTerm 

+

75@app.before_request 

+

76def load_currentTerm(): 

+

77 # An exception handles both current_term not being set and a mismatch between models 

+

78 try: 

+

79 g.current_term = dict_to_model(Term, session['current_term']) 

+

80 except Exception as e: 

+

81 term = getCurrentTerm() 

+

82 session['current_term'] = model_to_dict(term) 

+

83 g.current_term = term 

+

84 

+

85from flask import request 

+

86@app.context_processor 

+

87def load_visibleAccordion(): 

+

88 acc = request.args.get("accordion", default = False) 

+

89 return {"visibleAccordion": acc} 

+

90""" 

+

91Error handling for all 403, 404, 500 errors. Works by rendering a customm html 

+

92file located at templates/errors. All abort calls are automatically routed here 

+

93to be handled. 

+

94""" 

+

95 

+

96supportContactEmail = app.config["support_email_contact"] 

+

97 

+

98@app.errorhandler(403) 

+

99def handle_bad_request(e): 

+

100 return render_template("/errors/403error.html", 

+

101 supportEmail = supportContactEmail) 

+

102 

+

103@app.errorhandler(404) 

+

104def handle_bad_request(e): 

+

105 return render_template("/errors/404error.html", 

+

106 supportEmail = supportContactEmail) 

+

107 

+

108@app.errorhandler(500) 

+

109def handle_bad_request(e): 

+

110 return render_template("/errors/500error.html", 

+

111 supportEmail = supportContactEmail) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b___init___py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b___init___py.html new file mode 100644 index 000000000..1aeb4537a --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b___init___py.html @@ -0,0 +1,117 @@ + + + + + Coverage for app/models/__init__.py: 93% + + + + + +
+
+

+ Coverage for app/models/__init__.py: + 93% +

+ +

+ 14 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from peewee import * # import all so we don't have to import in each model file 

+

2import os 

+

3 

+

4# from app import login 

+

5from app import app 

+

6 

+

7def getMySQLDB(): 

+

8 if os.environ.get("USING_CONTAINER", False): 

+

9 app.config['db']['host'] = 'db' 

+

10 else: 

+

11 app.config["db"]["host"] = "localhost" 

+

12 db_cfg = app.config['db'] 

+

13 theDB = MySQLDatabase(db_cfg['name'], host = db_cfg['host'], user = db_cfg['username'], passwd = db_cfg['password']) 

+

14 return theDB 

+

15 

+

16mainDB = getMySQLDB() # MySQL (current) 

+

17 

+

18class baseModel(Model): 

+

19 class Meta: 

+

20 database = mainDB 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_adminLog_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_adminLog_py.html new file mode 100644 index 000000000..7eca6a6f2 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_adminLog_py.html @@ -0,0 +1,105 @@ + + + + + Coverage for app/models/adminLog.py: 100% + + + + + +
+
+

+ Coverage for app/models/adminLog.py: + 100% +

+ +

+ 6 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1 

+

2from app.models import* 

+

3from app.models.user import User 

+

4 

+

5class AdminLog(baseModel): 

+

6 createdBy = ForeignKeyField(User) 

+

7 createdOn = DateTimeField() 

+

8 logContent = CharField() 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_attachmentUpload_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_attachmentUpload_py.html new file mode 100644 index 000000000..7c3779cb8 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_attachmentUpload_py.html @@ -0,0 +1,106 @@ + + + + + Coverage for app/models/attachmentUpload.py: 100% + + + + + +
+
+

+ Coverage for app/models/attachmentUpload.py: + 100% +

+ +

+ 7 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import* 

+

2from app.models.event import Event 

+

3from app.models.course import Course 

+

4 

+

5 

+

6class AttachmentUpload(baseModel): 

+

7 event = ForeignKeyField(Event, null=True) 

+

8 course = ForeignKeyField(Course, null=True) 

+

9 fileName = CharField() 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_backgroundCheckType_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_backgroundCheckType_py.html new file mode 100644 index 000000000..b021b40bb --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_backgroundCheckType_py.html @@ -0,0 +1,102 @@ + + + + + Coverage for app/models/backgroundCheckType.py: 100% + + + + + +
+
+

+ Coverage for app/models/backgroundCheckType.py: + 100% +

+ +

+ 4 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import * 

+

2 

+

3class BackgroundCheckType(baseModel): 

+

4 id = CharField(primary_key=True) 

+

5 description = CharField() 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_backgroundCheck_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_backgroundCheck_py.html new file mode 100644 index 000000000..d6ad1c254 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_backgroundCheck_py.html @@ -0,0 +1,106 @@ + + + + + Coverage for app/models/backgroundCheck.py: 100% + + + + + +
+
+

+ Coverage for app/models/backgroundCheck.py: + 100% +

+ +

+ 8 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import * 

+

2from app.models.user import User 

+

3from app.models.backgroundCheckType import BackgroundCheckType 

+

4 

+

5class BackgroundCheck(baseModel): 

+

6 user = ForeignKeyField(User) 

+

7 type = ForeignKeyField(BackgroundCheckType) 

+

8 backgroundCheckStatus = CharField() 

+

9 dateCompleted = DateField(null=True) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_bonnerCohort_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_bonnerCohort_py.html new file mode 100644 index 000000000..fb09eec65 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_bonnerCohort_py.html @@ -0,0 +1,106 @@ + + + + + Coverage for app/models/bonnerCohort.py: 100% + + + + + +
+
+

+ Coverage for app/models/bonnerCohort.py: + 100% +

+ +

+ 7 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import * 

+

2from app.models.user import User 

+

3 

+

4class BonnerCohort(baseModel): 

+

5 year = IntegerField() 

+

6 user = ForeignKeyField(User) 

+

7 

+

8 class Meta: 

+

9 indexes = ( (('year','user'), True), ) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_certificationRequirement_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_certificationRequirement_py.html new file mode 100644 index 000000000..93cf9797e --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_certificationRequirement_py.html @@ -0,0 +1,106 @@ + + + + + Coverage for app/models/certificationRequirement.py: 100% + + + + + +
+
+

+ Coverage for app/models/certificationRequirement.py: + 100% +

+ +

+ 8 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import * 

+

2from app.models.certification import Certification 

+

3 

+

4class CertificationRequirement(baseModel): 

+

5 certification = ForeignKeyField(Certification) 

+

6 name = CharField() 

+

7 frequency = CharField() 

+

8 isRequired = BooleanField(default=True) 

+

9 order = SmallIntegerField(null=True) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_certification_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_certification_py.html new file mode 100644 index 000000000..768c4f8fe --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_certification_py.html @@ -0,0 +1,106 @@ + + + + + Coverage for app/models/certification.py: 100% + + + + + +
+
+

+ Coverage for app/models/certification.py: + 100% +

+ +

+ 7 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import * 

+

2from app.models.user import User 

+

3 

+

4class Certification(baseModel): 

+

5 name = CharField() 

+

6 isArchived = BooleanField(default=False) 

+

7 

+

8 BONNER = 1 

+

9 CESC = 2 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_courseInstructor_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_courseInstructor_py.html new file mode 100644 index 000000000..cf24b5f23 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_courseInstructor_py.html @@ -0,0 +1,104 @@ + + + + + Coverage for app/models/courseInstructor.py: 100% + + + + + +
+
+

+ Coverage for app/models/courseInstructor.py: + 100% +

+ +

+ 6 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import* 

+

2from app.models.course import Course 

+

3from app.models.user import User 

+

4 

+

5class CourseInstructor(baseModel): 

+

6 course = ForeignKeyField(Course, backref="courseInstructors") 

+

7 user = ForeignKeyField(User) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_courseParticipant_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_courseParticipant_py.html new file mode 100644 index 000000000..c3acfbf83 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_courseParticipant_py.html @@ -0,0 +1,105 @@ + + + + + Coverage for app/models/courseParticipant.py: 100% + + + + + +
+
+

+ Coverage for app/models/courseParticipant.py: + 100% +

+ +

+ 7 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import* 

+

2from app.models.course import Course 

+

3from app.models.user import User 

+

4 

+

5class CourseParticipant(baseModel): 

+

6 course = ForeignKeyField(Course) 

+

7 user = ForeignKeyField(User) 

+

8 hoursEarned = FloatField() 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_courseQuestion_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_courseQuestion_py.html new file mode 100644 index 000000000..72eb97dfe --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_courseQuestion_py.html @@ -0,0 +1,104 @@ + + + + + Coverage for app/models/courseQuestion.py: 100% + + + + + +
+
+

+ Coverage for app/models/courseQuestion.py: + 100% +

+ +

+ 6 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import * 

+

2from app.models.course import Course 

+

3 

+

4class CourseQuestion(baseModel): 

+

5 course = ForeignKeyField(Course) 

+

6 questionContent = TextField() 

+

7 questionNumber = IntegerField() 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_courseStatus_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_courseStatus_py.html new file mode 100644 index 000000000..774142e22 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_courseStatus_py.html @@ -0,0 +1,105 @@ + + + + + Coverage for app/models/courseStatus.py: 100% + + + + + +
+
+

+ Coverage for app/models/courseStatus.py: + 100% +

+ +

+ 7 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import* 

+

2 

+

3class CourseStatus(baseModel): 

+

4 status = CharField() 

+

5 IN_PROGRESS = 1 

+

6 SUBMITTED = 2 

+

7 APPROVED = 3 

+

8 IMPORTED = 4 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_course_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_course_py.html new file mode 100644 index 000000000..758086fd2 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_course_py.html @@ -0,0 +1,119 @@ + + + + + Coverage for app/models/course.py: 100% + + + + + +
+
+

+ Coverage for app/models/course.py: + 100% +

+ +

+ 20 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import * 

+

2from app.models.term import Term 

+

3from app.models.courseStatus import CourseStatus 

+

4from app.models.note import Note 

+

5from app.models.user import User 

+

6 

+

7class Course(baseModel): 

+

8 courseName = CharField() 

+

9 courseAbbreviation = CharField() 

+

10 sectionDesignation = CharField() 

+

11 courseCredit = FloatField() 

+

12 term = ForeignKeyField(Term, null = True) 

+

13 status = ForeignKeyField(CourseStatus) 

+

14 createdBy = ForeignKeyField(User) 

+

15 serviceLearningDesignatedSections = TextField() 

+

16 previouslyApprovedDescription = TextField() 

+

17 isPermanentlyDesignated = BooleanField(default=False) 

+

18 isAllSectionsServiceLearning = BooleanField(default=False) 

+

19 isRegularlyOccurring = BooleanField(default=False) 

+

20 isPreviouslyApproved = BooleanField(default=False) 

+

21 hasSlcComponent = BooleanField(default=False) 

+

22 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_emailLog_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_emailLog_py.html new file mode 100644 index 000000000..79b479905 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_emailLog_py.html @@ -0,0 +1,111 @@ + + + + + Coverage for app/models/emailLog.py: 100% + + + + + +
+
+

+ Coverage for app/models/emailLog.py: + 100% +

+ +

+ 13 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import * 

+

2from app.models.emailTemplate import EmailTemplate 

+

3from app.models.event import Event 

+

4from app.models.user import User 

+

5 

+

6class EmailLog(baseModel): 

+

7 event = ForeignKeyField(Event) 

+

8 subject = CharField() 

+

9 templateUsed = ForeignKeyField(EmailTemplate) 

+

10 recipientsCategory = CharField() 

+

11 recipients = CharField() 

+

12 dateSent = DateTimeField() 

+

13 sender = CharField() 

+

14 attachmentName = CharField(null=True) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_emailTemplate_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_emailTemplate_py.html new file mode 100644 index 000000000..34511ff78 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_emailTemplate_py.html @@ -0,0 +1,105 @@ + + + + + Coverage for app/models/emailTemplate.py: 100% + + + + + +
+
+

+ Coverage for app/models/emailTemplate.py: + 100% +

+ +

+ 7 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import* 

+

2 

+

3class EmailTemplate(baseModel): 

+

4 subject = CharField() 

+

5 body = TextField() 

+

6 action = CharField() 

+

7 purpose = CharField() 

+

8 replyToAddress = CharField() 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_emergencyContact_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_emergencyContact_py.html new file mode 100644 index 000000000..49178048c --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_emergencyContact_py.html @@ -0,0 +1,110 @@ + + + + + Coverage for app/models/emergencyContact.py: 100% + + + + + +
+
+

+ Coverage for app/models/emergencyContact.py: + 100% +

+ +

+ 11 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import * 

+

2from app.models.user import User 

+

3 

+

4class EmergencyContact(baseModel): 

+

5 user = ForeignKeyField(User) 

+

6 name = CharField(default='') 

+

7 relationship = CharField(default='') 

+

8 homePhone = CharField(default='') 

+

9 workPhone = CharField(default='') 

+

10 cellPhone = CharField(default='') 

+

11 emailAddress = CharField(default='') 

+

12 homeAddress = CharField(default='') 

+

13 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_eventParticipant_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_eventParticipant_py.html new file mode 100644 index 000000000..1af5479f0 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_eventParticipant_py.html @@ -0,0 +1,110 @@ + + + + + Coverage for app/models/eventParticipant.py: 90% + + + + + +
+
+

+ Coverage for app/models/eventParticipant.py: + 90% +

+ +

+ 10 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import* 

+

2from app.models.user import User 

+

3from app.models.event import Event 

+

4 

+

5class EventParticipant(baseModel): 

+

6 user = ForeignKeyField(User) 

+

7 event = ForeignKeyField(Event, backref="participants") 

+

8 hoursEarned = FloatField(null=True) 

+

9 

+

10 # Add this property so that we can combine these objects with EventRsvp objects in one array 

+

11 @property 

+

12 def rsvpWaitlist(self): 

+

13 return False 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_eventRsvpLog_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_eventRsvpLog_py.html new file mode 100644 index 000000000..c96858e9e --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_eventRsvpLog_py.html @@ -0,0 +1,106 @@ + + + + + Coverage for app/models/eventRsvpLog.py: 100% + + + + + +
+
+

+ Coverage for app/models/eventRsvpLog.py: + 100% +

+ +

+ 8 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import* 

+

2from app.models.user import User 

+

3from app.models.event import Event 

+

4 

+

5class EventRsvpLog(baseModel): 

+

6 createdBy = ForeignKeyField(User) 

+

7 createdOn = DateTimeField() 

+

8 rsvpLogContent = CharField() 

+

9 event = ForeignKeyField(Event, backref="rsvpLogs") 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_eventRsvp_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_eventRsvp_py.html new file mode 100644 index 000000000..9dc8c5f36 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_eventRsvp_py.html @@ -0,0 +1,111 @@ + + + + + Coverage for app/models/eventRsvp.py: 100% + + + + + +
+
+

+ Coverage for app/models/eventRsvp.py: + 100% +

+ +

+ 11 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from datetime import datetime 

+

2from app.models import* 

+

3from app.models.user import User 

+

4from app.models.event import Event 

+

5 

+

6class EventRsvp(baseModel): 

+

7 user = ForeignKeyField(User) 

+

8 event = ForeignKeyField(Event, backref="rsvps") 

+

9 rsvpTime = DateTimeField(default=datetime.now) 

+

10 rsvpWaitlist = BooleanField(default=False) 

+

11 

+

12 

+

13 class Meta: 

+

14 indexes = ( (('user', 'event'), True), ) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_eventTemplate_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_eventTemplate_py.html new file mode 100644 index 000000000..4f6dc5474 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_eventTemplate_py.html @@ -0,0 +1,121 @@ + + + + + Coverage for app/models/eventTemplate.py: 100% + + + + + +
+
+

+ Coverage for app/models/eventTemplate.py: + 100% +

+ +

+ 16 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1import json 

+

2 

+

3from app.models import * 

+

4 

+

5class EventTemplate(baseModel): 

+

6 name = CharField() 

+

7 tag = CharField() 

+

8 templateJSON = CharField() 

+

9 templateFile = CharField() 

+

10 isVisible = BooleanField(default=True) 

+

11 

+

12 def fetch(self, key, default=None): 

+

13 """ 

+

14 Get a key from the template data. Return the provided default value if the key is not found. 

+

15 """ 

+

16 return self.templateData.get(key, default) 

+

17 

+

18 @property 

+

19 def templateData(self): 

+

20 return json.loads(self.templateJSON) 

+

21 

+

22 @templateData.setter 

+

23 def templateData(self, value): 

+

24 self.templateJSON = json.dumps(value) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_eventViews_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_eventViews_py.html new file mode 100644 index 000000000..7d1238eee --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_eventViews_py.html @@ -0,0 +1,106 @@ + + + + + Coverage for app/models/eventViews.py: 100% + + + + + +
+
+

+ Coverage for app/models/eventViews.py: + 100% +

+ +

+ 8 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import* 

+

2from app.models.user import User 

+

3from app.models.event import Event 

+

4import datetime 

+

5 

+

6class EventView(baseModel): 

+

7 user = ForeignKeyField(User) 

+

8 event = ForeignKeyField(Event) 

+

9 viewedOn = DateTimeField(default=datetime.datetime.now) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_event_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_event_py.html new file mode 100644 index 000000000..ba36a5d43 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_event_py.html @@ -0,0 +1,165 @@ + + + + + Coverage for app/models/event.py: 86% + + + + + +
+
+

+ Coverage for app/models/event.py: + 86% +

+ +

+ 56 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import * 

+

2from app.models.term import Term 

+

3from app.models.program import Program 

+

4from datetime import datetime 

+

5 

+

6class Event(baseModel): 

+

7 name = CharField() 

+

8 term = ForeignKeyField(Term) 

+

9 description = TextField() 

+

10 timeStart = TimeField() 

+

11 timeEnd = TimeField() 

+

12 location = CharField() 

+

13 isFoodProvided = BooleanField(default=False) 

+

14 isTraining = BooleanField(default=False) 

+

15 isRsvpRequired = BooleanField(default=False) 

+

16 isService = BooleanField(default=False) 

+

17 isAllVolunteerTraining = BooleanField(default=False) 

+

18 rsvpLimit = IntegerField(null=True) 

+

19 startDate = DateField() 

+

20 endDate = DateField(null=True) 

+

21 recurringId = IntegerField(null=True) 

+

22 contactEmail = CharField(null=True) 

+

23 contactName = CharField(null=True) 

+

24 program = ForeignKeyField(Program) 

+

25 isCanceled = BooleanField(default=False) 

+

26 

+

27 _spCache = "Empty" 

+

28 

+

29 def __str__(self): 

+

30 return f"{self.id}: {self.description}" 

+

31 

+

32 @property 

+

33 def noProgram(self): 

+

34 return not self.program_id 

+

35 

+

36 @property 

+

37 def isPast(self): 

+

38 return datetime.now() >= datetime.combine(self.startDate, self.timeStart) 

+

39 

+

40 @property 

+

41 def isRecurring(self): 

+

42 return bool(self.recurringId) 

+

43 

+

44 @property 

+

45 def isFirstRecurringEvent(self): 

+

46 firstRecurringEvent = Event.select().where(Event.recurringId==self.recurringId).order_by(Event.id).get() 

+

47 return firstRecurringEvent.id == self.id 

+

48 

+

49 @property 

+

50 def relativeTime(self): 

+

51 relativeTime = datetime.combine(self.startDate, self.timeStart) - datetime.now() 

+

52 

+

53 secondsFromNow = relativeTime.seconds 

+

54 minutesFromNow = secondsFromNow // 60 

+

55 hoursFromNow = minutesFromNow // 60 

+

56 daysFromNow = relativeTime.days 

+

57 if self.isPast: 

+

58 return "" 

+

59 elif (daysFromNow): 

+

60 return f"{daysFromNow} day" + ("s" if daysFromNow > 1 else "") 

+

61 elif hoursFromNow: 

+

62 return f"{hoursFromNow} hour" + ("s" if hoursFromNow > 1 else "") 

+

63 elif minutesFromNow: 

+

64 return f"{minutesFromNow} minute" + ("s" if minutesFromNow > 1 else "") 

+

65 else: 

+

66 return f"happening now" 

+

67 

+

68 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_insuranceInfo_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_insuranceInfo_py.html new file mode 100644 index 000000000..62349838a --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_insuranceInfo_py.html @@ -0,0 +1,109 @@ + + + + + Coverage for app/models/insuranceInfo.py: 100% + + + + + +
+
+

+ Coverage for app/models/insuranceInfo.py: + 100% +

+ +

+ 11 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import * 

+

2from app.models.user import User 

+

3 

+

4class InsuranceInfo(baseModel): 

+

5 user = ForeignKeyField(User, unique=True) 

+

6 insuranceType = IntegerField(default=0) 

+

7 policyHolderName = CharField(default='') 

+

8 policyHolderRelationship = CharField(default='') 

+

9 insuranceCompany = CharField(default='') 

+

10 policyNumber = CharField(default='') 

+

11 groupNumber = CharField(default='') 

+

12 healthIssues = CharField(default='') 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_interest_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_interest_py.html new file mode 100644 index 000000000..9c226c552 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_interest_py.html @@ -0,0 +1,104 @@ + + + + + Coverage for app/models/interest.py: 100% + + + + + +
+
+

+ Coverage for app/models/interest.py: + 100% +

+ +

+ 6 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import* 

+

2from app.models.program import Program 

+

3from app.models.user import User 

+

4 

+

5class Interest(baseModel): 

+

6 program = ForeignKeyField(Program) 

+

7 user = ForeignKeyField(User) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_note_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_note_py.html new file mode 100644 index 000000000..c88419972 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_note_py.html @@ -0,0 +1,106 @@ + + + + + Coverage for app/models/note.py: 100% + + + + + +
+
+

+ Coverage for app/models/note.py: + 100% +

+ +

+ 8 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import* 

+

2from app.models.user import User 

+

3 

+

4class Note(baseModel): 

+

5 createdBy = ForeignKeyField(User) 

+

6 createdOn = DateTimeField() 

+

7 noteContent = CharField() 

+

8 isPrivate = BooleanField(default=False) 

+

9 noteType = CharField(null=True) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_partner_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_partner_py.html new file mode 100644 index 000000000..4524eda69 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_partner_py.html @@ -0,0 +1,101 @@ + + + + + Coverage for app/models/partner.py: 100% + + + + + +
+
+

+ Coverage for app/models/partner.py: + 100% +

+ +

+ 3 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import* 

+

2 

+

3class Partner(baseModel): 

+

4 partnerName = CharField() 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_profileNote_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_profileNote_py.html new file mode 100644 index 000000000..d774b10f0 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_profileNote_py.html @@ -0,0 +1,106 @@ + + + + + Coverage for app/models/profileNote.py: 100% + + + + + +
+
+

+ Coverage for app/models/profileNote.py: + 100% +

+ +

+ 8 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import * 

+

2from app.models.user import User 

+

3from app.models.note import Note 

+

4 

+

5class ProfileNote(baseModel): 

+

6 user = ForeignKeyField(User) 

+

7 note = ForeignKeyField(Note, null=False) 

+

8 isBonnerNote = BooleanField(default=False) 

+

9 viewTier = IntegerField(default=3) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_programBan_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_programBan_py.html new file mode 100644 index 000000000..e9894c199 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_programBan_py.html @@ -0,0 +1,108 @@ + + + + + Coverage for app/models/programBan.py: 100% + + + + + +
+
+

+ Coverage for app/models/programBan.py: + 100% +

+ +

+ 10 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import * 

+

2from app.models.program import Program 

+

3from app.models.user import User 

+

4from app.models.note import Note 

+

5 

+

6class ProgramBan(baseModel): 

+

7 user = ForeignKeyField(User) 

+

8 program = ForeignKeyField(Program) 

+

9 endDate = DateField(null=True) 

+

10 banNote = ForeignKeyField(Note, null=False) 

+

11 unbanNote = ForeignKeyField(Note, null=True) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_programManager_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_programManager_py.html new file mode 100644 index 000000000..bb42669dc --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_programManager_py.html @@ -0,0 +1,105 @@ + + + + + Coverage for app/models/programManager.py: 100% + + + + + +
+
+

+ Coverage for app/models/programManager.py: + 100% +

+ +

+ 6 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import * 

+

2from app.models.program import Program 

+

3from app.models.user import User 

+

4 

+

5 

+

6class ProgramManager(baseModel): 

+

7 user = ForeignKeyField(User) 

+

8 program = ForeignKeyField(Program) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_program_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_program_py.html new file mode 100644 index 000000000..c01b06a00 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_program_py.html @@ -0,0 +1,123 @@ + + + + + Coverage for app/models/program.py: 90% + + + + + +
+
+

+ Coverage for app/models/program.py: + 90% +

+ +

+ 21 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import* 

+

2from app.models.term import Term 

+

3from app.models.courseStatus import CourseStatus 

+

4from app.models.partner import Partner 

+

5 

+

6class Program(baseModel): 

+

7 programName = CharField() 

+

8 programUrl = TextField() 

+

9 programDescription = TextField() 

+

10 partner = ForeignKeyField(Partner, null=True) 

+

11 isStudentLed = BooleanField(default=False) 

+

12 isBonnerScholars = BooleanField(default=False) 

+

13 isOtherCeltsSponsored = BooleanField(default=False) 

+

14 contactName = CharField(null=True,default='') 

+

15 contactEmail = CharField(null=True,default='') 

+

16 defaultLocation = CharField(null=True,default='') 

+

17 

+

18 @property 

+

19 def url(self): 

+

20 

+

21 return self.programUrl 

+

22 

+

23 @property 

+

24 def description(self): 

+

25 

+

26 return self.programDescription 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_questionNote_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_questionNote_py.html new file mode 100644 index 000000000..4e611bcf5 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_questionNote_py.html @@ -0,0 +1,104 @@ + + + + + Coverage for app/models/questionNote.py: 100% + + + + + +
+
+

+ Coverage for app/models/questionNote.py: + 100% +

+ +

+ 6 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import * 

+

2from app.models.courseQuestion import CourseQuestion 

+

3from app.models.note import Note 

+

4 

+

5class QuestionNote(baseModel): 

+

6 question = ForeignKeyField(CourseQuestion) 

+

7 note = ForeignKeyField(Note) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_requirementMatch_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_requirementMatch_py.html new file mode 100644 index 000000000..6c2632a2c --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_requirementMatch_py.html @@ -0,0 +1,106 @@ + + + + + Coverage for app/models/requirementMatch.py: 100% + + + + + +
+
+

+ Coverage for app/models/requirementMatch.py: + 100% +

+ +

+ 8 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import * 

+

2from app.models.certificationRequirement import CertificationRequirement 

+

3from app.models.event import Event 

+

4from app.models.course import Course 

+

5 

+

6class RequirementMatch(baseModel): 

+

7 requirement = ForeignKeyField(CertificationRequirement) 

+

8 event = ForeignKeyField(Event, null=True) 

+

9 course = ForeignKeyField(Course, null=True) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_term_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_term_py.html new file mode 100644 index 000000000..79b6b3542 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_term_py.html @@ -0,0 +1,158 @@ + + + + + Coverage for app/models/term.py: 93% + + + + + +
+
+

+ Coverage for app/models/term.py: + 93% +

+ +

+ 45 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import * 

+

2class Term(baseModel): 

+

3 description = CharField() 

+

4 year = IntegerField() 

+

5 academicYear = CharField() 

+

6 isSummer = BooleanField(default=False) 

+

7 isCurrentTerm = BooleanField(default=False) 

+

8 termOrder = CharField() 

+

9 

+

10 _cache = None 

+

11 

+

12 @property 

+

13 def academicYearStartingTerm(self): 

+

14 """ 

+

15 Saves the term that starts the academic year of the chosen term in a cache 

+

16 to avoid doing multiple queries for the same information. 

+

17 """ 

+

18 if self._cache is None: 

+

19 if ("Summer" in self.description) or ("Spring" in self.description): 

+

20 try: 

+

21 self._cache = Term.select().where(Term.year==self.year-1, Term.description == f"Fall {self.year-1}").get() 

+

22 except DoesNotExist: 

+

23 self._cache = self 

+

24 

+

25 else: 

+

26 self._cache = self 

+

27 

+

28 return self._cache 

+

29 

+

30 @property 

+

31 def isFutureTerm(self): 

+

32 """ 

+

33 checks to see if the term selected is a current Term. 

+

34 If not, depending on the year and description, it determines whether it is a future term 

+

35 """ 

+

36 if not self.isCurrentTerm: 

+

37 currentTerm = Term.select().where(Term.isCurrentTerm == True).get() 

+

38 if currentTerm.year < self.year: 

+

39 return True 

+

40 elif currentTerm.year > self.year: 

+

41 return False 

+

42 else: 

+

43 if ("Fall" in currentTerm.description): 

+

44 return False 

+

45 elif ("Summer" in currentTerm.description) & ("Fall" in self.description): 

+

46 return True 

+

47 elif ("Summer" in currentTerm.description) & ("Spring" in self.description): 

+

48 return False 

+

49 elif ("Spring" in currentTerm.description): 

+

50 return True 

+

51 return False 

+

52 

+

53 @staticmethod 

+

54 def convertDescriptionToTermOrder(description): 

+

55 semester,year = description.split() 

+

56 if semester == "Spring": 

+

57 return year + "-1" 

+

58 elif semester == "Summer" or semester == "May": 

+

59 return year + "-2" 

+

60 elif semester == "Fall": 

+

61 return year + '-3' 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_user_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_user_py.html new file mode 100644 index 000000000..131bb7c6d --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_6c0e4b930745278b_user_py.html @@ -0,0 +1,168 @@ + + + + + Coverage for app/models/user.py: 98% + + + + + +
+
+

+ Coverage for app/models/user.py: + 98% +

+ +

+ 49 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models import * 

+

2 

+

3 

+

4class User(baseModel): 

+

5 username = CharField(primary_key = True) 

+

6 bnumber = CharField(unique = True) 

+

7 email = CharField() 

+

8 phoneNumber = CharField(null = True) 

+

9 firstName = CharField() 

+

10 lastName = CharField() 

+

11 isStudent = BooleanField(default = False) 

+

12 major = CharField(null = True) 

+

13 classLevel = CharField(null = True) 

+

14 isFaculty = BooleanField(default = False) 

+

15 isStaff = BooleanField(default = False) 

+

16 isCeltsAdmin = BooleanField(default =False) 

+

17 isCeltsStudentStaff = BooleanField(default = False) 

+

18 dietRestriction = TextField(null=True) 

+

19 

+

20 # override BaseModel's __init__ so that we can set up an instance attribute for cache 

+

21 def __init__(self,*args, **kwargs): 

+

22 super().__init__(*args,**kwargs) 

+

23 

+

24 self._pmCache = {} 

+

25 self._bsCache = None 

+

26 

+

27 @property 

+

28 def isAdmin(self): 

+

29 return (self.isCeltsAdmin or self.isCeltsStudentStaff) 

+

30 

+

31 @property 

+

32 def isBonnerScholar(self): 

+

33 from app.models.bonnerCohort import BonnerCohort 

+

34 if self._bsCache is None: 

+

35 # TODO should we exclude users who are banned from Bonner here? 

+

36 self._bsCache = BonnerCohort.select().where(BonnerCohort.user == self).exists() 

+

37 

+

38 return self._bsCache 

+

39 

+

40 @property 

+

41 def fullName(self): 

+

42 return f"{self.firstName} {self.lastName}" 

+

43 

+

44 def addProgramManager(self, program): 

+

45 # Makes a user a Program Manager 

+

46 from app.models.programManager import ProgramManager 

+

47 ProgramManager.create(user = self, program = program) 

+

48 

+

49 return (f' {self} added as Program Manager') 

+

50 

+

51 def removeProgramManager(self, program): 

+

52 # Removes an existing Program Manager from being a Program Manager 

+

53 from app.models.programManager import ProgramManager 

+

54 ProgramManager.delete().where(ProgramManager.user == self, ProgramManager.program == program).execute() 

+

55 

+

56 return (f'{self} removed from Program Manager') 

+

57 

+

58 def isProgramManagerFor(self, program): 

+

59 # Looks to see who is the Program Manager for a program 

+

60 from app.models.programManager import ProgramManager # Must defer import until now to avoid circular reference 

+

61 if not program: 

+

62 return False 

+

63 

+

64 if program not in self._pmCache: 

+

65 self._pmCache[program] = ProgramManager.select().where(ProgramManager.user == self, ProgramManager.program == program).exists() 

+

66 

+

67 return self._pmCache[program] 

+

68 

+

69 def isProgramManagerForEvent(self, event): 

+

70 # Looks to see who the Program Manager for a specific event is 

+

71 return self.isProgramManagerFor(event.program) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_82713a9719f5b640___init___py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_82713a9719f5b640___init___py.html new file mode 100644 index 000000000..75d6445a1 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_82713a9719f5b640___init___py.html @@ -0,0 +1,107 @@ + + + + + Coverage for app/controllers/events/__init__.py: 100% + + + + + +
+
+

+ Coverage for app/controllers/events/__init__.py: + 100% +

+ +

+ 3 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from flask import Blueprint 

+

2 

+

3# Blueprint Configuration 

+

4events_bp = Blueprint( 

+

5 'events', __name__, 

+

6 template_folder='templates', 

+

7 static_folder='static' 

+

8) 

+

9 

+

10from app.controllers.events import routes 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_82713a9719f5b640_email_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_82713a9719f5b640_email_py.html new file mode 100644 index 000000000..51e6a1ffe --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_82713a9719f5b640_email_py.html @@ -0,0 +1,175 @@ + + + + + Coverage for app/controllers/events/email.py: 36% + + + + + +
+
+

+ Coverage for app/controllers/events/email.py: + 36% +

+ +

+ 55 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from app.models.emailTemplate import EmailTemplate 

+

2from app.models.emailLog import EmailLog 

+

3from app.models.event import Event 

+

4from app.controllers.main import main_bp 

+

5from app.logic.emailHandler import EmailHandler 

+

6from app.models.program import Program 

+

7from flask import request, flash, g, redirect, url_for 

+

8from urllib.parse import urlparse 

+

9 

+

10@main_bp.route('/email', methods=['POST']) 

+

11def email(): 

+

12 raw_form_data = request.form.copy() 

+

13 attachments = request.files.getlist('attachmentObject') 

+

14 if "@" in raw_form_data['emailSender']: 

+

15 # when people are sending emails as themselves (using mailto) --- Q: are we still going with the mailto option? 

+

16 pass 

+

17 else: 

+

18 url_domain = urlparse(request.base_url).netloc 

+

19 mail = EmailHandler(raw_form_data, url_domain, attachment_file=attachments) 

+

20 mail_sent = mail.send_email() 

+

21 

+

22 if mail_sent: 

+

23 message, status = 'Email successfully sent!', 'success' 

+

24 else: 

+

25 message, status = 'Error sending email', 'danger' 

+

26 flash(message, status) 

+

27 return redirect(url_for("main.events", selectedTerm = raw_form_data['selectedTerm'])) 

+

28 

+

29 

+

30@main_bp.route('/retrieveSenderList/<eventId>', methods=['GET']) 

+

31def retrieveSenderList(eventId): 

+

32 senderOptions = [["CELTS (celts@berea.edu)", "Celts"]] 

+

33 

+

34 event = Event.get_by_id(eventId) 

+

35 if event.program_id: 

+

36 programEmail = event.program.contactEmail if event.program.contactEmail else "No Program Email Found" 

+

37 programOption = [f"{event.program.programName} ({programEmail})", event.program.programName] 

+

38 senderOptions.append(programOption) 

+

39 

+

40 studentStaffOptions = [] 

+

41 senderOptions.extend(studentStaffOptions) 

+

42 

+

43 currentUserOption = [f"Current User ({g.current_user.email})", g.current_user.username] 

+

44 senderOptions.append(currentUserOption) 

+

45 

+

46 return senderOptions 

+

47 

+

48 

+

49@main_bp.route('/retrieveEmailTemplate/<eventId>', methods=['GET']) 

+

50def retrieveEmailTemplate(eventId): 

+

51 templateInfo = {} 

+

52 emailTemplates = EmailTemplate.select() 

+

53 

+

54 for index, template in enumerate(emailTemplates): 

+

55 templateInfo[index] = { 

+

56 'purpose': template.purpose, 

+

57 'subject':template.subject, 

+

58 'body': EmailHandler.replaceStaticPlaceholders(eventId, template.body) 

+

59 } 

+

60 return templateInfo 

+

61 

+

62@main_bp.route('/retrievePlaceholderList/<eventId>', methods=['GET']) 

+

63def retrievePlaceholderList(eventId): 

+

64 return EmailHandler.retrievePlaceholderList(eventId) 

+

65 

+

66 

+

67@main_bp.route('/fetchEmailLogData/<eventId>', methods=['GET']) 

+

68def fetchEmailLogData(eventId): 

+

69 last_email = EmailHandler.retrieve_last_email(eventId) 

+

70 if last_email: 

+

71 return {'last_log': "The last email was sent to " + last_email.recipientsCategory + " on " + last_email.dateSent.strftime('%m/%d/%Y') + " by " + last_email.sender + "." , 'last_log2': " Subject: " + last_email.subject} 

+

72 else: 

+

73 return {'exists': False} 

+

74 

+

75@main_bp.route("/getProgramSender/", methods=['GET']) 

+

76def getProgramSender(): 

+

77 programId = request.args.get("programId") 

+

78 return Program.get_by_id(programId).contactName 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_82713a9719f5b640_routes_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_82713a9719f5b640_routes_py.html new file mode 100644 index 000000000..70ccb41c8 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_82713a9719f5b640_routes_py.html @@ -0,0 +1,147 @@ + + + + + Coverage for app/controllers/events/routes.py: 44% + + + + + +
+
+

+ Coverage for app/controllers/events/routes.py: + 44% +

+ +

+ 36 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from flask import Flask, redirect, flash, url_for, request, render_template, g, json, abort 

+

2from datetime import datetime 

+

3from peewee import DoesNotExist 

+

4 

+

5from app.models.term import Term 

+

6from app.models.program import Program 

+

7from app.models.event import Event 

+

8from app.models.eventParticipant import EventParticipant 

+

9from app.models.user import User 

+

10from app.controllers.events import events_bp 

+

11from app.controllers.events import email 

+

12from app.logic.emailHandler import EmailHandler 

+

13from app.logic.participants import addBnumberAsParticipant 

+

14 

+

15@events_bp.route('/event/<eventid>/kiosk', methods=['GET']) 

+

16def loadKiosk(eventid): 

+

17 """Renders kiosk for specified event.""" 

+

18 event = Event.get_by_id(eventid) 

+

19 return render_template("/events/eventKiosk.html", 

+

20 event = event, 

+

21 eventid = eventid) 

+

22 

+

23@events_bp.route('/signintoEvent', methods=['POST']) 

+

24def kioskSignin(): 

+

25 """Utilizes form data and sign in function. Returns correct flasher message.""" 

+

26 eventid = request.form["eventid"] 

+

27 bnumber = request.form["bNumber"] 

+

28 

+

29 if not bnumber: # Avoids string index out of range error 

+

30 return "", 500 

+

31 

+

32 # scanned bNumber starts with ";" and ends with "?" 

+

33 if bnumber[0]==";" and bnumber[-1]=="?": 

+

34 bnumber = "B"+ bnumber[1:9] 

+

35 else: 

+

36 # regular bnumber with or without a 'B' 

+

37 if bnumber[0].isdigit(): 

+

38 bnumber = "B"+ bnumber[0:8] 

+

39 elif bnumber[0].upper() != "B": 

+

40 return "", 500 

+

41 try: 

+

42 kioskUser, userStatus = addBnumberAsParticipant(bnumber, eventid) 

+

43 if kioskUser: 

+

44 return {"user": f"{kioskUser.firstName} {kioskUser.lastName}", "status": userStatus} 

+

45 else: 

+

46 return {"user": None, "status": userStatus} 

+

47 

+

48 except Exception as e: 

+

49 print("Error in Kiosk Page", e) 

+

50 return "", 500 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_beb112d5d893d27f___init___py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_beb112d5d893d27f___init___py.html new file mode 100644 index 000000000..519da726e --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_beb112d5d893d27f___init___py.html @@ -0,0 +1,107 @@ + + + + + Coverage for app/controllers/main/__init__.py: 100% + + + + + +
+
+

+ Coverage for app/controllers/main/__init__.py: + 100% +

+ +

+ 3 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from flask import Blueprint 

+

2 

+

3# Blueprint Configuration 

+

4main_bp = Blueprint( 

+

5 'main', __name__, 

+

6 template_folder='templates', 

+

7 static_folder='static' 

+

8) 

+

9 

+

10from app.controllers.main import routes 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_beb112d5d893d27f_routes_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_beb112d5d893d27f_routes_py.html new file mode 100644 index 000000000..044cad311 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_beb112d5d893d27f_routes_py.html @@ -0,0 +1,583 @@ + + + + + Coverage for app/controllers/main/routes.py: 26% + + + + + +
+
+

+ Coverage for app/controllers/main/routes.py: + 26% +

+ +

+ 306 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from flask import request, render_template, g, abort, flash, redirect, url_for 

+

2from peewee import JOIN 

+

3from playhouse.shortcuts import model_to_dict 

+

4import datetime 

+

5import json 

+

6from http import cookies 

+

7 

+

8from app import app 

+

9from app.models.program import Program 

+

10from app.models.event import Event 

+

11from app.models.backgroundCheck import BackgroundCheck 

+

12from app.models.backgroundCheckType import BackgroundCheckType 

+

13from app.models.user import User 

+

14from app.models.eventParticipant import EventParticipant 

+

15from app.models.interest import Interest 

+

16from app.models.programBan import ProgramBan 

+

17from app.models.term import Term 

+

18from app.models.eventRsvp import EventRsvp 

+

19from app.models.note import Note 

+

20from app.models.profileNote import ProfileNote 

+

21from app.models.programManager import ProgramManager 

+

22from app.models.courseInstructor import CourseInstructor 

+

23from app.models.certification import Certification 

+

24from app.models.emergencyContact import EmergencyContact 

+

25from app.models.insuranceInfo import InsuranceInfo 

+

26 

+

27from app.controllers.main import main_bp 

+

28from app.logic.loginManager import logout 

+

29from app.logic.users import addUserInterest, removeUserInterest, banUser, unbanUser, isEligibleForProgram, getUserBGCheckHistory, addProfileNote, deleteProfileNote, updateDietInfo 

+

30from app.logic.participants import unattendedRequiredEvents, trainedParticipants, getParticipationStatusForTrainings, checkUserRsvp, addPersonToEvent 

+

31from app.logic.events import * 

+

32from app.logic.searchUsers import searchUsers 

+

33from app.logic.transcript import * 

+

34from app.logic.landingPage import getManagerProgramDict, getActiveEventTab 

+

35from app.logic.utils import selectSurroundingTerms 

+

36from app.logic.certification import getCertRequirementsWithCompletion 

+

37from app.logic.createLogs import createRsvpLog, createAdminLog 

+

38 

+

39@main_bp.route('/logout', methods=['GET']) 

+

40def redirectToLogout(): 

+

41 return redirect(logout()) 

+

42 

+

43@main_bp.route('/', methods=['GET']) 

+

44def landingPage(): 

+

45 managerProgramDict = getManagerProgramDict(g.current_user) 

+

46 eventsInTerm = list(Event.select().where(Event.term == g.current_term, Event.isCanceled == False)) 

+

47 programsWithEventsList = [event.program for event in eventsInTerm if not event.isPast] 

+

48 

+

49 return render_template("/main/landingPage.html", managerProgramDict = managerProgramDict, 

+

50 term = g.current_term, 

+

51 programsWithEventsList = programsWithEventsList) 

+

52 

+

53@main_bp.route('/goToEventsList/<programID>', methods=['GET']) 

+

54def goToEventsList(programID): 

+

55 return {"activeTab": getActiveEventTab(programID)} 

+

56 

+

57@main_bp.route('/eventsList/<selectedTerm>', methods=['GET'], defaults={'activeTab': "studentLedEvents", 'programID': 0}) 

+

58@main_bp.route('/eventsList/<selectedTerm>/<activeTab>', methods=['GET'], defaults={'programID': 0}) 

+

59@main_bp.route('/eventsList/<selectedTerm>/<activeTab>/<programID>', methods=['GET']) 

+

60def events(selectedTerm, activeTab, programID): 

+

61 currentTerm = g.current_term 

+

62 if selectedTerm: 

+

63 currentTerm = selectedTerm 

+

64 currentTime = datetime.datetime.now() 

+

65 

+

66 listOfTerms = Term.select() 

+

67 participantRSVP = EventRsvp.select(EventRsvp, Event).join(Event).where(EventRsvp.user == g.current_user) 

+

68 rsvpedEventsID = [event.event.id for event in participantRSVP] 

+

69 

+

70 term = Term.get_by_id(currentTerm) 

+

71 

+

72 currentEventRsvpAmount = getEventRsvpCountsForTerm(term) 

+

73 studentLedEvents = getStudentLedEvents(term) 

+

74 countUpcomingStudentLedEvents = getUpcomingStudentLedCount(term, currentTime) 

+

75 trainingEvents = getTrainingEvents(term, g.current_user) 

+

76 bonnerEvents = getBonnerEvents(term) 

+

77 otherEvents = getOtherEvents(term) 

+

78 

+

79 managersProgramDict = getManagerProgramDict(g.current_user) 

+

80 

+

81 return render_template("/events/event_list.html", 

+

82 selectedTerm = term, 

+

83 studentLedEvents = studentLedEvents, 

+

84 trainingEvents = trainingEvents, 

+

85 bonnerEvents = bonnerEvents, 

+

86 otherEvents = otherEvents, 

+

87 listOfTerms = listOfTerms, 

+

88 rsvpedEventsID = rsvpedEventsID, 

+

89 currentEventRsvpAmount = currentEventRsvpAmount, 

+

90 currentTime = currentTime, 

+

91 user = g.current_user, 

+

92 activeTab = activeTab, 

+

93 programID = int(programID), 

+

94 managersProgramDict = managersProgramDict, 

+

95 countUpcomingStudentLedEvents = countUpcomingStudentLedEvents 

+

96 ) 

+

97 

+

98@main_bp.route('/profile/<username>', methods=['GET']) 

+

99def viewUsersProfile(username): 

+

100 """ 

+

101 This function displays the information of a volunteer to the user 

+

102 """ 

+

103 try: 

+

104 volunteer = User.get(User.username == username) 

+

105 except Exception as e: 

+

106 if g.current_user.isAdmin: 

+

107 flash(f"{username} does not exist! ", category='danger') 

+

108 return redirect(url_for('admin.studentSearchPage')) 

+

109 else: 

+

110 abort(403) # Error 403 if non admin/student-staff user trys to access via url 

+

111 

+

112 if (g.current_user == volunteer) or g.current_user.isAdmin: 

+

113 upcomingEvents = getUpcomingEventsForUser(volunteer) 

+

114 participatedEvents = getParticipatedEventsForUser(volunteer) 

+

115 programs = Program.select() 

+

116 if not g.current_user.isBonnerScholar and not g.current_user.isAdmin: 

+

117 programs = programs.where(Program.isBonnerScholars == False) 

+

118 interests = Interest.select(Interest, Program).join(Program).where(Interest.user == volunteer) 

+

119 programsInterested = [interest.program for interest in interests] 

+

120 

+

121 rsvpedEventsList = EventRsvp.select(EventRsvp, Event).join(Event).where(EventRsvp.user == volunteer) 

+

122 rsvpedEvents = [event.event.id for event in rsvpedEventsList] 

+

123 

+

124 programManagerPrograms = ProgramManager.select(ProgramManager, Program).join(Program).where(ProgramManager.user == volunteer) 

+

125 permissionPrograms = [entry.program.id for entry in programManagerPrograms] 

+

126 

+

127 allBackgroundHistory = getUserBGCheckHistory(volunteer) 

+

128 backgroundTypes = list(BackgroundCheckType.select()) 

+

129 

+

130 eligibilityTable = [] 

+

131 for program in programs: 

+

132 banNotes = list(ProgramBan.select(ProgramBan, Note) 

+

133 .join(Note, on=(ProgramBan.banNote == Note.id)) 

+

134 .where(ProgramBan.user == volunteer, 

+

135 ProgramBan.program == program, 

+

136 ProgramBan.endDate > datetime.datetime.now()).execute()) 

+

137 userParticipatedTrainingEvents = getParticipationStatusForTrainings(program, [volunteer], g.current_term) 

+

138 try: 

+

139 allTrainingsComplete = False not in [attended for event, attended in userParticipatedTrainingEvents[username]] # Did volunteer attend all events 

+

140 except KeyError: 

+

141 allTrainingsComplete = False 

+

142 noteForDict = banNotes[-1].banNote.noteContent if banNotes else "" 

+

143 eligibilityTable.append({"program": program, 

+

144 "completedTraining": allTrainingsComplete, 

+

145 "trainingList": userParticipatedTrainingEvents, 

+

146 "isNotBanned": (not banNotes), 

+

147 "banNote": noteForDict}) 

+

148 profileNotes = ProfileNote.select().where(ProfileNote.user == volunteer) 

+

149 

+

150 bonnerRequirements = getCertRequirementsWithCompletion(certification=Certification.BONNER, username=volunteer) 

+

151 

+

152 managersProgramDict = getManagerProgramDict(g.current_user) 

+

153 managersList = [id[1] for id in managersProgramDict.items()] 

+

154 

+

155 return render_template ("/main/userProfile.html", 

+

156 programs = programs, 

+

157 programsInterested = programsInterested, 

+

158 upcomingEvents = upcomingEvents, 

+

159 participatedEvents = participatedEvents, 

+

160 rsvpedEvents = rsvpedEvents, 

+

161 permissionPrograms = permissionPrograms, 

+

162 eligibilityTable = eligibilityTable, 

+

163 volunteer = volunteer, 

+

164 backgroundTypes = backgroundTypes, 

+

165 allBackgroundHistory = allBackgroundHistory, 

+

166 currentDateTime = datetime.datetime.now(), 

+

167 profileNotes = profileNotes, 

+

168 bonnerRequirements = bonnerRequirements, 

+

169 managersList = managersList 

+

170 ) 

+

171 abort(403) 

+

172 

+

173@main_bp.route('/profile/<username>/emergencyContact', methods=['GET', 'POST']) 

+

174def emergencyContactInfo(username): 

+

175 """ 

+

176 This loads the Emergency Contact Page 

+

177 """ 

+

178 if not (g.current_user.username == username or g.current_user.isCeltsAdmin): 

+

179 abort(403) 

+

180 

+

181 

+

182 if request.method == 'GET': 

+

183 readOnly = g.current_user.username != username 

+

184 contactInfo = EmergencyContact.get_or_none(EmergencyContact.user_id == username) 

+

185 return render_template ("/main/emergencyContactInfo.html", 

+

186 username=username, 

+

187 contactInfo=contactInfo, 

+

188 readOnly=readOnly 

+

189 ) 

+

190 

+

191 elif request.method == 'POST': 

+

192 if g.current_user.username != username: 

+

193 abort(403) 

+

194 

+

195 rowsUpdated = EmergencyContact.update(**request.form).where(EmergencyContact.user == username).execute() 

+

196 if not rowsUpdated: 

+

197 EmergencyContact.create(user = username, **request.form) 

+

198 createAdminLog(f"{g.current_user} updated {username}'s emergency contact information.") 

+

199 flash('Emergency contact information saved successfully!', 'success') 

+

200 

+

201 if request.args.get('action') == 'exit': 

+

202 return redirect (f"/profile/{username}") 

+

203 else: 

+

204 return redirect (f"/profile/{username}/insuranceInfo") 

+

205 

+

206@main_bp.route('/profile/<username>/insuranceInfo', methods=['GET', 'POST']) 

+

207def insuranceInfo(username): 

+

208 """ 

+

209 This loads the Insurance Information Page 

+

210 """ 

+

211 if not (g.current_user.username == username or g.current_user.isCeltsAdmin): 

+

212 abort(403) 

+

213 

+

214 if request.method == 'GET': 

+

215 readOnly = g.current_user.username != username 

+

216 userInsuranceInfo = InsuranceInfo.get_or_none(InsuranceInfo.user == username) 

+

217 return render_template ("/main/insuranceInfo.html", 

+

218 username=username, 

+

219 userInsuranceInfo=userInsuranceInfo, 

+

220 readOnly=readOnly 

+

221 ) 

+

222 

+

223 # Save the form data 

+

224 elif request.method == 'POST': 

+

225 if g.current_user.username != username: 

+

226 abort(403) 

+

227 

+

228 rowsUpdated = InsuranceInfo.update(**request.form).where(InsuranceInfo.user == username).execute() 

+

229 if not rowsUpdated: 

+

230 InsuranceInfo.create(user = username, **request.form) 

+

231 createAdminLog(f"{g.current_user} updated {username}'s emergency contact information.") 

+

232 flash('Insurance information saved successfully!', 'success') 

+

233 

+

234 if request.args.get('action') == 'exit': 

+

235 return redirect (f"/profile/{username}") 

+

236 else: 

+

237 return redirect (f"/profile/{username}/emergencyContact") 

+

238 

+

239@main_bp.route('/profile/<username>/travelForm', methods=['GET', 'POST']) 

+

240def travelForm(username): 

+

241 if not (g.current_user.username == username or g.current_user.isCeltsAdmin): 

+

242 abort(403) 

+

243 

+

244 user = (User.select(User, EmergencyContact, InsuranceInfo) 

+

245 .join(EmergencyContact, JOIN.LEFT_OUTER).switch() 

+

246 .join(InsuranceInfo, JOIN.LEFT_OUTER) 

+

247 .where(User.username == username).limit(1)) 

+

248 if not list(user): 

+

249 abort(404) 

+

250 userData = list(user.dicts())[0] 

+

251 userData = {key: value if value else '' for (key, value) in userData.items()} 

+

252 

+

253 return render_template ('/main/travelForm.html', 

+

254 userData = userData 

+

255 ) 

+

256 

+

257 

+

258@main_bp.route('/profile/addNote', methods=['POST']) 

+

259def addNote(): 

+

260 """ 

+

261 This function adds a note to the user's profile. 

+

262 """ 

+

263 postData = request.form 

+

264 try: 

+

265 note = addProfileNote(postData["visibility"], postData["bonner"] == "yes", postData["noteTextbox"], postData["username"]) 

+

266 flash("Successfully added profile note", "success") 

+

267 return redirect(url_for("main.viewUsersProfile", username=postData["username"])) 

+

268 except Exception as e: 

+

269 print("Error adding note", e) 

+

270 flash("Failed to add profile note", "danger") 

+

271 return "Failed to add profile note", 500 

+

272 

+

273@main_bp.route('/<username>/deleteNote', methods=['POST']) 

+

274def deleteNote(username): 

+

275 """ 

+

276 This function deletes a note from the user's profile. 

+

277 """ 

+

278 try: 

+

279 deleteProfileNote(request.form["id"]) 

+

280 flash("Successfully deleted profile note", "success") 

+

281 except Exception as e: 

+

282 print("Error deleting note", e) 

+

283 flash("Failed to delete profile note", "danger") 

+

284 return "success" 

+

285 

+

286# ===========================Ban=============================================== 

+

287@main_bp.route('/<username>/ban/<program_id>', methods=['POST']) 

+

288def ban(program_id, username): 

+

289 """ 

+

290 This function updates the ban status of a username either when they are banned from a program. 

+

291 program_id: the primary id of the program the student is being banned from 

+

292 username: unique value of a user to correctly identify them 

+

293 """ 

+

294 postData = request.form 

+

295 banNote = postData["note"] # This contains the note left about the change 

+

296 banEndDate = postData["endDate"] # Contains the date the ban will no longer be effective 

+

297 try: 

+

298 banUser(program_id, username, banNote, banEndDate, g.current_user) 

+

299 programInfo = Program.get(int(program_id)) 

+

300 flash("Successfully banned the volunteer", "success") 

+

301 createAdminLog(f'Banned {username} from {programInfo.programName} until {banEndDate}.') 

+

302 return "Successfully banned the volunteer." 

+

303 except Exception as e: 

+

304 print("Error while updating ban", e) 

+

305 flash("Failed to ban the volunteer", "danger") 

+

306 return "Failed to ban the volunteer", 500 

+

307 

+

308# ===========================Unban=============================================== 

+

309@main_bp.route('/<username>/unban/<program_id>', methods=['POST']) 

+

310def unban(program_id, username): 

+

311 """ 

+

312 This function updates the ban status of a username either when they are unbanned from a program. 

+

313 program_id: the primary id of the program the student is being unbanned from 

+

314 username: unique value of a user to correctly identify them 

+

315 """ 

+

316 postData = request.form 

+

317 unbanNote = postData["note"] # This contains the note left about the change 

+

318 try: 

+

319 unbanUser(program_id, username, unbanNote, g.current_user) 

+

320 programInfo = Program.get(int(program_id)) 

+

321 createAdminLog(f'Unbanned {username} from {programInfo.programName}.') 

+

322 flash("Successfully unbanned the volunteer", "success") 

+

323 return "Successfully unbanned the volunteer" 

+

324 

+

325 except Exception as e: 

+

326 print("Error while updating Unban", e) 

+

327 flash("Failed to unban the volunteer", "danger") 

+

328 return "Failed to unban the volunteer", 500 

+

329 

+

330 

+

331@main_bp.route('/<username>/addInterest/<program_id>', methods=['POST']) 

+

332def addInterest(program_id, username): 

+

333 """ 

+

334 This function adds a program to the list of programs a user interested in 

+

335 program_id: the primary id of the program the student is adding interest of 

+

336 username: unique value of a user to correctly identify them 

+

337 """ 

+

338 try: 

+

339 success = addUserInterest(program_id, username) 

+

340 if success: 

+

341 flash("Successfully added " + Program.get_by_id(program_id).programName + " as an interest", "success") 

+

342 return "" 

+

343 else: 

+

344 flash("Was unable to remove " + Program.get_by_id(program_id).programName + " as an interest.", "danger") 

+

345 

+

346 except Exception as e: 

+

347 print(e) 

+

348 return "Error Updating Interest", 500 

+

349 

+

350@main_bp.route('/<username>/removeInterest/<program_id>', methods=['POST']) 

+

351def removeInterest(program_id, username): 

+

352 """ 

+

353 This function removes a program to the list of programs a user interested in 

+

354 program_id: the primary id of the program the student is adding interest of 

+

355 username: unique value of a user to correctly identify them 

+

356 """ 

+

357 try: 

+

358 removed = removeUserInterest(program_id, username) 

+

359 if removed: 

+

360 flash("Successfully removed " + Program.get_by_id(program_id).programName + " as an interest.", "success") 

+

361 return "" 

+

362 else: 

+

363 flash("Was unable to remove " + Program.get_by_id(program_id).programName + " as an interest.", "danger") 

+

364 except Exception as e: 

+

365 print(e) 

+

366 return "Error Updating Interest", 500 

+

367 

+

368@main_bp.route('/rsvpForEvent', methods = ['POST']) 

+

369def volunteerRegister(): 

+

370 """ 

+

371 This function selects the user ID and event ID and registers the user 

+

372 for the event they have clicked register for. 

+

373 """ 

+

374 event = Event.get_by_id(request.form['id']) 

+

375 program = event.program 

+

376 user = g.current_user 

+

377 

+

378 isAdded = checkUserRsvp(user, event) 

+

379 isEligible = isEligibleForProgram(program, user) 

+

380 listOfRequirements = unattendedRequiredEvents(program, user) 

+

381 

+

382 personAdded = False 

+

383 if isEligible: 

+

384 personAdded = addPersonToEvent(user, event) 

+

385 if personAdded and listOfRequirements: 

+

386 reqListToString = ', '.join(listOfRequirements) 

+

387 flash(f"{user.firstName} {user.lastName} successfully registered. However, the following training may be required: {reqListToString}.", "success") 

+

388 elif personAdded: 

+

389 flash("Successfully registered for event!","success") 

+

390 else: 

+

391 flash(f"RSVP Failed due to an unknown error.", "danger") 

+

392 else: 

+

393 flash(f"Cannot RSVP. Contact CELTS administrators: {app.config['celts_admin_contact']}.", "danger") 

+

394 

+

395 

+

396 if 'from' in request.form: 

+

397 if request.form['from'] == 'ajax': 

+

398 return '' 

+

399 return redirect(url_for("admin.eventDisplay", eventId=event.id)) 

+

400 

+

401@main_bp.route('/rsvpRemove', methods = ['POST']) 

+

402def RemoveRSVP(): 

+

403 """ 

+

404 This function deletes the user ID and event ID from database when RemoveRSVP is clicked 

+

405 """ 

+

406 eventData = request.form 

+

407 event = Event.get_by_id(eventData['id']) 

+

408 

+

409 currentRsvpParticipant = EventRsvp.get(EventRsvp.user == g.current_user, EventRsvp.event == event) 

+

410 logBody = "withdrew from the waitlist" if currentRsvpParticipant.rsvpWaitlist else "un-RSVP'd" 

+

411 currentRsvpParticipant.delete_instance() 

+

412 createRsvpLog(event.id, f"{g.current_user.fullName} {logBody}.") 

+

413 flash("Successfully unregistered for event!", "success") 

+

414 if 'from' in eventData: 

+

415 if eventData['from'] == 'ajax': 

+

416 return '' 

+

417 return redirect(url_for("admin.eventDisplay", eventId=event.id)) 

+

418 

+

419@main_bp.route('/profile/<username>/serviceTranscript', methods = ['GET']) 

+

420def serviceTranscript(username): 

+

421 user = User.get_or_none(User.username == username) 

+

422 if user is None: 

+

423 abort(404) 

+

424 if user != g.current_user and not g.current_user.isAdmin: 

+

425 abort(403) 

+

426 

+

427 slCourses = getSlCourseTranscript(username) 

+

428 totalHours = getTotalHours(username) 

+

429 allEventTranscript = getProgramTranscript(username) 

+

430 startDate = getStartYear(username) 

+

431 

+

432 return render_template('main/serviceTranscript.html', 

+

433 allEventTranscript = allEventTranscript, 

+

434 slCourses = slCourses.objects(), 

+

435 totalHours = totalHours, 

+

436 startDate = startDate, 

+

437 userData = user) 

+

438 

+

439@main_bp.route('/searchUser/<query>', methods = ['GET']) 

+

440def searchUser(query): 

+

441 

+

442 category= request.args.get("category") 

+

443 

+

444 '''Accepts user input and queries the database returning results that matches user search''' 

+

445 try: 

+

446 query = query.strip() 

+

447 search = query.upper() 

+

448 splitSearch = search.split() 

+

449 searchResults = searchUsers(query,category) 

+

450 return searchResults 

+

451 except Exception as e: 

+

452 print(e) 

+

453 return "Error in searching for user", 500 

+

454 

+

455@main_bp.route('/contributors',methods = ['GET']) 

+

456def contributors(): 

+

457 return render_template("/contributors.html") 

+

458 

+

459@main_bp.route('/proposalReview/', methods = ['GET', 'POST']) 

+

460def reviewProposal(): 

+

461 """ 

+

462 this function gets the submitted course id and returns the its data to the review proposal modal 

+

463 """ 

+

464 courseID=request.form 

+

465 course=Course.get_by_id(courseID["course_id"]) 

+

466 instructors_data=course.courseInstructors 

+

467 return render_template('/main/reviewproposal.html', 

+

468 course=course, 

+

469 instructors_data=instructors_data) 

+

470 

+

471@main_bp.route('/updateDietInformation', methods = ['GET', 'POST']) 

+

472def getDietInfo(): 

+

473 dietaryInfo = request.form 

+

474 user = dietaryInfo["user"] 

+

475 dietInfo = dietaryInfo["dietInfo"] 

+

476 

+

477 if (g.current_user.username == user) or g.current_user.isAdmin: 

+

478 updateDietInfo(user, dietInfo) 

+

479 userInfo = User.get(User.username == user) 

+

480 if len(dietInfo) > 0: 

+

481 createAdminLog(f"Updated {userInfo.fullName}'s dietary restrictions to {dietInfo}.") if dietInfo.strip() else None 

+

482 else: 

+

483 createAdminLog(f"Deleted all {userInfo.fullName}'s dietary restrictions dietary restrictions.") 

+

484 

+

485 

+

486 return " " 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_c86a23c356556db1___init___py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_c86a23c356556db1___init___py.html new file mode 100644 index 000000000..ad8d33a85 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_c86a23c356556db1___init___py.html @@ -0,0 +1,109 @@ + + + + + Coverage for app/controllers/admin/__init__.py: 100% + + + + + +
+
+

+ Coverage for app/controllers/admin/__init__.py: + 100% +

+ +

+ 5 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from flask import Blueprint 

+

2 

+

3# Blueprint Configuration 

+

4admin_bp = Blueprint( 

+

5 'admin', __name__, 

+

6 template_folder='templates', 

+

7 static_folder='static' 

+

8) 

+

9 

+

10from app.controllers.admin import routes 

+

11from app.controllers.admin import userManagement 

+

12from app.controllers.admin import volunteers 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_c86a23c356556db1_routes_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_c86a23c356556db1_routes_py.html new file mode 100644 index 000000000..45c10f049 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_c86a23c356556db1_routes_py.html @@ -0,0 +1,555 @@ + + + + + Coverage for app/controllers/admin/routes.py: 26% + + + + + +
+
+

+ Coverage for app/controllers/admin/routes.py: + 26% +

+ +

+ 308 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from flask import request, render_template, url_for, g, redirect 

+

2from flask import flash, abort, jsonify, session, send_file 

+

3from peewee import DoesNotExist, fn, IntegrityError 

+

4from playhouse.shortcuts import model_to_dict 

+

5import json 

+

6from datetime import datetime 

+

7import os 

+

8 

+

9from app import app 

+

10from app.models.program import Program 

+

11from app.models.event import Event 

+

12from app.models.user import User 

+

13from app.models.eventTemplate import EventTemplate 

+

14from app.models.adminLog import AdminLog 

+

15from app.models.eventRsvpLog import EventRsvpLog 

+

16from app.models.attachmentUpload import AttachmentUpload 

+

17from app.models.bonnerCohort import BonnerCohort 

+

18from app.models.certification import Certification 

+

19from app.models.user import User 

+

20from app.models.term import Term 

+

21from app.models.eventViews import EventView 

+

22from app.models.courseStatus import CourseStatus 

+

23 

+

24from app.logic.userManagement import getAllowedPrograms, getAllowedTemplates 

+

25from app.logic.createLogs import createAdminLog 

+

26from app.logic.certification import getCertRequirements, updateCertRequirements 

+

27from app.logic.utils import selectSurroundingTerms, getFilesFromRequest, getRedirectTarget, setRedirectTarget 

+

28from app.logic.events import cancelEvent, deleteEvent, attemptSaveEvent, preprocessEventData, calculateRecurringEventFrequency, deleteEventAndAllFollowing, deleteAllRecurringEvents, getBonnerEvents,addEventView, getEventRsvpCountsForTerm 

+

29from app.logic.participants import getEventParticipants, getParticipationStatusForTrainings, checkUserRsvp 

+

30from app.logic.fileHandler import FileHandler 

+

31from app.logic.bonner import getBonnerCohorts, makeBonnerXls, rsvpForBonnerCohort 

+

32from app.controllers.admin import admin_bp 

+

33from app.logic.manageSLFaculty import getInstructorCourses 

+

34from app.logic.courseManagement import unapprovedCourses, approvedCourses 

+

35from app.logic.serviceLearningCoursesData import parseUploadedFile, saveCourseParticipantsToDatabase 

+

36 

+

37 

+

38 

+

39@admin_bp.route('/switch_user', methods=['POST']) 

+

40def switchUser(): 

+

41 if app.env == "production": 

+

42 print(f"An attempt was made to switch to another user by {g.current_user.username}!") 

+

43 abort(403) 

+

44 

+

45 print(f"Switching user from {g.current_user} to",request.form['newuser']) 

+

46 session['current_user'] = model_to_dict(User.get_by_id(request.form['newuser'])) 

+

47 

+

48 return redirect(request.referrer) 

+

49 

+

50 

+

51@admin_bp.route('/eventTemplates') 

+

52def templateSelect(): 

+

53 if g.current_user.isCeltsAdmin or g.current_user.isCeltsStudentStaff: 

+

54 allprograms = getAllowedPrograms(g.current_user) 

+

55 visibleTemplates = getAllowedTemplates(g.current_user) 

+

56 return render_template("/events/template_selector.html", 

+

57 programs=allprograms, 

+

58 celtsSponsoredProgram = Program.get(Program.isOtherCeltsSponsored), 

+

59 templates=visibleTemplates) 

+

60 else: 

+

61 abort(403) 

+

62 

+

63 

+

64@admin_bp.route('/eventTemplates/<templateid>/<programid>/create', methods=['GET','POST']) 

+

65def createEvent(templateid, programid): 

+

66 if not (g.current_user.isAdmin or g.current_user.isProgramManagerFor(programid)): 

+

67 abort(403) 

+

68 

+

69 # Validate given URL 

+

70 program = None 

+

71 try: 

+

72 template = EventTemplate.get_by_id(templateid) 

+

73 if programid: 

+

74 program = Program.get_by_id(programid) 

+

75 except DoesNotExist as e: 

+

76 print("Invalid template or program id:", e) 

+

77 flash("There was an error with your selection. Please try again or contact Systems Support.", "danger") 

+

78 return redirect(url_for("admin.program_picker")) 

+

79 

+

80 # Get the data from the form or from the template 

+

81 eventData = template.templateData 

+

82 

+

83 eventData['program'] = program 

+

84 

+

85 if request.method == "GET": 

+

86 eventData['contactName'] = "CELTS Admin" 

+

87 eventData['contactEmail'] = app.config['celts_admin_contact'] 

+

88 if program: 

+

89 eventData['location'] = program.defaultLocation 

+

90 if program.contactName: 

+

91 eventData['contactName'] = program.contactName 

+

92 if program.contactEmail: 

+

93 eventData['contactEmail'] = program.contactEmail 

+

94 

+

95 # Try to save the form 

+

96 if request.method == "POST": 

+

97 eventData.update(request.form.copy()) 

+

98 try: 

+

99 savedEvents, validationErrorMessage = attemptSaveEvent(eventData, getFilesFromRequest(request)) 

+

100 

+

101 except Exception as e: 

+

102 print("Error saving event:", e) 

+

103 savedEvents = False 

+

104 validationErrorMessage = "Unknown Error Saving Event. Please try again" 

+

105 

+

106 if savedEvents: 

+

107 rsvpcohorts = request.form.getlist("cohorts[]") 

+

108 for year in rsvpcohorts: 

+

109 rsvpForBonnerCohort(int(year), savedEvents[0].id) 

+

110 

+

111 noun = (eventData['isRecurring'] == 'on' and "Events" or "Event") # pluralize 

+

112 flash(f"{noun} successfully created!", 'success') 

+

113 

+

114 if program: 

+

115 if len(savedEvents) > 1: 

+

116 createAdminLog(f"Created a recurring event, <a href=\"{url_for('admin.eventDisplay', eventId = savedEvents[0].id)}\">{savedEvents[0].name}</a>, for {program.programName}, with a start date of {datetime.strftime(eventData['startDate'], '%m/%d/%Y')}. The last event in the series will be on {datetime.strftime(savedEvents[-1].startDate, '%m/%d/%Y')}.") 

+

117 else: 

+

118 createAdminLog(f"Created <a href=\"{url_for('admin.eventDisplay', eventId = savedEvents[0].id)}\">{savedEvents[0].name}</a> for {program.programName}, with a start date of {datetime.strftime(eventData['startDate'], '%m/%d/%Y')}.") 

+

119 else: 

+

120 createAdminLog(f"Created a non-program event, <a href=\"{url_for('admin.eventDisplay', eventId = savedEvents[0].id)}\">{savedEvents[0].name}</a>, with a start date of {datetime.strftime(eventData['startDate'], '%m/%d/%Y')}.") 

+

121 

+

122 return redirect(url_for("admin.eventDisplay", eventId = savedEvents[0].id)) 

+

123 else: 

+

124 flash(validationErrorMessage, 'warning') 

+

125 

+

126 # make sure our data is the same regardless of GET or POST 

+

127 preprocessEventData(eventData) 

+

128 isProgramManager = g.current_user.isProgramManagerFor(programid) 

+

129 

+

130 futureTerms = selectSurroundingTerms(g.current_term, prevTerms=0) 

+

131 

+

132 requirements, bonnerCohorts = [], [] 

+

133 if eventData['program'] is not None and eventData['program'].isBonnerScholars: 

+

134 requirements = getCertRequirements(Certification.BONNER) 

+

135 bonnerCohorts = getBonnerCohorts(limit=5) 

+

136 return render_template(f"/admin/{template.templateFile}", 

+

137 template = template, 

+

138 eventData = eventData, 

+

139 futureTerms = futureTerms, 

+

140 requirements = requirements, 

+

141 bonnerCohorts = bonnerCohorts, 

+

142 isProgramManager = isProgramManager) 

+

143 

+

144 

+

145@admin_bp.route('/event/<eventId>/rsvp', methods=['GET']) 

+

146def rsvpLogDisplay(eventId): 

+

147 event = Event.get_by_id(eventId) 

+

148 eventData = model_to_dict(event, recurse=False) 

+

149 eventData['program'] = event.program 

+

150 isProgramManager = g.current_user.isProgramManagerFor(eventData['program']) 

+

151 if g.current_user.isCeltsAdmin or (g.current_user.isCeltsStudentStaff and isProgramManager): 

+

152 allLogs = EventRsvpLog.select(EventRsvpLog, User).join(User).where(EventRsvpLog.event_id == eventId).order_by(EventRsvpLog.createdOn.desc()) 

+

153 return render_template("/events/rsvpLog.html", 

+

154 event = event, 

+

155 eventData = eventData, 

+

156 allLogs = allLogs) 

+

157 else: 

+

158 abort(403) 

+

159 

+

160 

+

161@admin_bp.route('/event/<eventId>/view', methods=['GET']) 

+

162@admin_bp.route('/event/<eventId>/edit', methods=['GET','POST']) 

+

163def eventDisplay(eventId): 

+

164 pageViewsCount = EventView.select().where(EventView.event == eventId).count() 

+

165 if request.method == 'GET' and request.path == f'/event/{eventId}/view': 

+

166 viewer = g.current_user 

+

167 event = Event.get_by_id(eventId) 

+

168 addEventView(viewer,event) 

+

169 # Validate given URL 

+

170 try: 

+

171 event = Event.get_by_id(eventId) 

+

172 except DoesNotExist as e: 

+

173 print(f"Unknown event: {eventId}") 

+

174 abort(404) 

+

175 

+

176 notPermitted = not (g.current_user.isCeltsAdmin or g.current_user.isProgramManagerForEvent(event)) 

+

177 if 'edit' in request.url_rule.rule and notPermitted: 

+

178 abort(403) 

+

179 

+

180 eventData = model_to_dict(event, recurse=False) 

+

181 associatedAttachments = AttachmentUpload.select().where(AttachmentUpload.event == event) 

+

182 filepaths = FileHandler(eventId=event.id).retrievePath(associatedAttachments) 

+

183 

+

184 image = None 

+

185 picurestype = [".jpeg", ".png", ".gif", ".jpg", ".svg", ".webp"] 

+

186 for attachment in associatedAttachments: 

+

187 for extension in picurestype: 

+

188 if (attachment.fileName.endswith(extension)): 

+

189 image = filepaths[attachment.fileName][0] 

+

190 if image: 

+

191 break 

+

192 

+

193 

+

194 if request.method == "POST": # Attempt to save form 

+

195 eventData = request.form.copy() 

+

196 try: 

+

197 savedEvents, validationErrorMessage = attemptSaveEvent(eventData, getFilesFromRequest(request)) 

+

198 

+

199 except Exception as e: 

+

200 print("Error saving event:", e) 

+

201 savedEvents = False 

+

202 validationErrorMessage = "Unknown Error Saving Event. Please try again" 

+

203 

+

204 

+

205 if savedEvents: 

+

206 rsvpcohorts = request.form.getlist("cohorts[]") 

+

207 for year in rsvpcohorts: 

+

208 rsvpForBonnerCohort(int(year), event.id) 

+

209 

+

210 flash("Event successfully updated!", "success") 

+

211 return redirect(url_for("admin.eventDisplay", eventId = event.id)) 

+

212 else: 

+

213 flash(validationErrorMessage, 'warning') 

+

214 

+

215 # make sure our data is the same regardless of GET and POST 

+

216 preprocessEventData(eventData) 

+

217 eventData['program'] = event.program 

+

218 futureTerms = selectSurroundingTerms(g.current_term) 

+

219 userHasRSVPed = checkUserRsvp(g.current_user, event) 

+

220 filepaths = FileHandler(eventId=event.id).retrievePath(associatedAttachments) 

+

221 isProgramManager = g.current_user.isProgramManagerFor(eventData['program']) 

+

222 requirements, bonnerCohorts = [], [] 

+

223 

+

224 if eventData['program'] and eventData['program'].isBonnerScholars: 

+

225 requirements = getCertRequirements(Certification.BONNER) 

+

226 bonnerCohorts = getBonnerCohorts(limit=5) 

+

227 

+

228 rule = request.url_rule 

+

229 

+

230 # Event Edit 

+

231 if 'edit' in rule.rule: 

+

232 return render_template("admin/createEvent.html", 

+

233 eventData = eventData, 

+

234 futureTerms=futureTerms, 

+

235 event = event, 

+

236 requirements = requirements, 

+

237 bonnerCohorts = bonnerCohorts, 

+

238 userHasRSVPed = userHasRSVPed, 

+

239 isProgramManager = isProgramManager, 

+

240 filepaths = filepaths) 

+

241 # Event View 

+

242 else: 

+

243 # get text representations of dates 

+

244 eventData['timeStart'] = event.timeStart.strftime("%-I:%M %p") 

+

245 eventData['timeEnd'] = event.timeEnd.strftime("%-I:%M %p") 

+

246 eventData["startDate"] = event.startDate.strftime("%m/%d/%Y") 

+

247 

+

248 # Identify the next event in a recurring series 

+

249 if event.recurringId: 

+

250 eventSeriesList = list(Event.select().where(Event.recurringId == event.recurringId) 

+

251 .where((Event.isCanceled == False) | (Event.id == event.id)) 

+

252 .order_by(Event.startDate)) 

+

253 eventIndex = eventSeriesList.index(event) 

+

254 if len(eventSeriesList) != (eventIndex + 1): 

+

255 eventData["nextRecurringEvent"] = eventSeriesList[eventIndex + 1] 

+

256 

+

257 currentEventRsvpAmount = getEventRsvpCountsForTerm(g.current_term) 

+

258 

+

259 userParticipatedTrainingEvents = getParticipationStatusForTrainings(eventData['program'], [g.current_user], g.current_term) 

+

260 

+

261 return render_template("eventView.html", 

+

262 eventData = eventData, 

+

263 event = event, 

+

264 userHasRSVPed = userHasRSVPed, 

+

265 programTrainings = userParticipatedTrainingEvents, 

+

266 currentEventRsvpAmount = currentEventRsvpAmount, 

+

267 isProgramManager = isProgramManager, 

+

268 filepaths = filepaths, 

+

269 image = image, 

+

270 pageViewsCount= pageViewsCount) 

+

271 

+

272 

+

273@admin_bp.route('/event/<eventId>/cancel', methods=['POST']) 

+

274def cancelRoute(eventId): 

+

275 if g.current_user.isAdmin: 

+

276 try: 

+

277 cancelEvent(eventId) 

+

278 return redirect(request.referrer) 

+

279 

+

280 except Exception as e: 

+

281 print('Error while canceling event:', e) 

+

282 return "", 500 

+

283 

+

284 else: 

+

285 abort(403) 

+

286 

+

287@admin_bp.route('/event/<eventId>/delete', methods=['POST']) 

+

288def deleteRoute(eventId): 

+

289 try: 

+

290 deleteEvent(eventId) 

+

291 flash("Event successfully deleted.", "success") 

+

292 return redirect(url_for("main.events", selectedTerm=g.current_term)) 

+

293 

+

294 except Exception as e: 

+

295 print('Error while canceling event:', e) 

+

296 return "", 500 

+

297@admin_bp.route('/event/<eventId>/deleteEventAndAllFollowing', methods=['POST']) 

+

298def deleteEventAndAllFollowingRoute(eventId): 

+

299 try: 

+

300 deleteEventAndAllFollowing(eventId) 

+

301 flash("Events successfully deleted.", "success") 

+

302 return redirect(url_for("main.events", selectedTerm=g.current_term)) 

+

303 

+

304 except Exception as e: 

+

305 print('Error while canceling event:', e) 

+

306 return "", 500 

+

307@admin_bp.route('/event/<eventId>/deleteAllRecurring', methods=['POST']) 

+

308def deleteAllRecurringEventsRoute(eventId): 

+

309 try: 

+

310 deleteAllRecurringEvents(eventId) 

+

311 flash("Events successfully deleted.", "success") 

+

312 return redirect(url_for("main.events", selectedTerm=g.current_term)) 

+

313 

+

314 except Exception as e: 

+

315 print('Error while canceling event:', e) 

+

316 return "", 500 

+

317 

+

318@admin_bp.route('/makeRecurringEvents', methods=['POST']) 

+

319def addRecurringEvents(): 

+

320 recurringEvents = calculateRecurringEventFrequency(preprocessEventData(request.form.copy())) 

+

321 return json.dumps(recurringEvents, default=str) 

+

322 

+

323 

+

324@admin_bp.route('/userProfile', methods=['POST']) 

+

325def userProfile(): 

+

326 volunteerName= request.form.copy() 

+

327 if volunteerName['searchStudentsInput']: 

+

328 username = volunteerName['searchStudentsInput'].strip("()") 

+

329 user=username.split('(')[-1] 

+

330 return redirect(url_for('main.viewUsersProfile', username=user)) 

+

331 else: 

+

332 flash(f"Please enter the first name or the username of the student you would like to search for.", category='danger') 

+

333 return redirect(url_for('admin.studentSearchPage')) 

+

334 

+

335@admin_bp.route('/search_student', methods=['GET']) 

+

336def studentSearchPage(): 

+

337 if g.current_user.isAdmin: 

+

338 return render_template("/admin/searchStudentPage.html") 

+

339 abort(403) 

+

340 

+

341@admin_bp.route('/addParticipants', methods = ['GET']) 

+

342def addParticipants(): 

+

343 '''Renders the page, will be removed once merged with full page''' 

+

344 

+

345 return render_template('addParticipants.html', 

+

346 title="Add Participants") 

+

347 

+

348@admin_bp.route('/adminLogs', methods = ['GET', 'POST']) 

+

349def adminLogs(): 

+

350 if g.current_user.isCeltsAdmin: 

+

351 allLogs = AdminLog.select(AdminLog, User).join(User).order_by(AdminLog.createdOn.desc()) 

+

352 return render_template("/admin/adminLogs.html", 

+

353 allLogs = allLogs) 

+

354 else: 

+

355 abort(403) 

+

356 

+

357@admin_bp.route("/deleteEventFile", methods=["POST"]) 

+

358def deleteEventFile(): 

+

359 fileData= request.form 

+

360 eventfile=FileHandler(eventId=fileData["databaseId"]) 

+

361 eventfile.deleteFile(fileData["fileId"]) 

+

362 return "" 

+

363 

+

364@admin_bp.route("/uploadCourseParticipant", methods= ["POST"]) 

+

365def addCourseFile(): 

+

366 fileData = request.files['addCourseParticipants'] 

+

367 filePath = os.path.join(app.config["files"]["base_path"], fileData.filename) 

+

368 fileData.save(filePath) 

+

369 (session['cpPreview'], session['cpErrors']) = parseUploadedFile(filePath) 

+

370 os.remove(filePath) 

+

371 return redirect(url_for("admin.manageServiceLearningCourses")) 

+

372 

+

373@admin_bp.route('/manageServiceLearning', methods = ['GET', 'POST']) 

+

374@admin_bp.route('/manageServiceLearning/<term>', methods = ['GET', 'POST']) 

+

375def manageServiceLearningCourses(term=None): 

+

376 """ 

+

377 The SLC management page for admins 

+

378 """ 

+

379 if not g.current_user.isCeltsAdmin: 

+

380 abort(403) 

+

381 

+

382 if request.method =='POST' and "submitParticipant" in request.form: 

+

383 saveCourseParticipantsToDatabase(session.pop('cpPreview', {})) 

+

384 flash('Courses and participants saved successfully!', 'success') 

+

385 return redirect(url_for('admin.manageServiceLearningCourses')) 

+

386 

+

387 manageTerm = Term.get_or_none(Term.id == term) or g.current_term 

+

388 

+

389 setRedirectTarget(request.full_path) 

+

390 

+

391 return render_template('/admin/manageServiceLearningFaculty.html', 

+

392 courseInstructors = getInstructorCourses(), 

+

393 unapprovedCourses = unapprovedCourses(term), 

+

394 approvedCourses = approvedCourses(term), 

+

395 terms = selectSurroundingTerms(g.current_term), 

+

396 term = manageTerm, 

+

397 cpPreview= session.get('cpPreview',{}), 

+

398 cpPreviewErrors = session.get('cpErrors',[]) 

+

399 ) 

+

400 

+

401@admin_bp.route("/deleteUploadedFile", methods= ["POST"]) 

+

402def removeFromSession(): 

+

403 try: 

+

404 session.pop('cpPreview') 

+

405 except KeyError: 

+

406 pass 

+

407 

+

408 return "" 

+

409 

+

410@admin_bp.route("/manageBonner") 

+

411def manageBonner(): 

+

412 if not g.current_user.isCeltsAdmin: 

+

413 abort(403) 

+

414 

+

415 return render_template("/admin/bonnerManagement.html", 

+

416 cohorts=getBonnerCohorts(), 

+

417 events=getBonnerEvents(g.current_term), 

+

418 requirements = getCertRequirements(certification=Certification.BONNER)) 

+

419 

+

420@admin_bp.route("/bonner/<year>/<method>/<username>", methods=["POST"]) 

+

421def updatecohort(year, method, username): 

+

422 if not g.current_user.isCeltsAdmin: 

+

423 abort(403) 

+

424 

+

425 try: 

+

426 user = User.get_by_id(username) 

+

427 except: 

+

428 abort(500) 

+

429 

+

430 if method == "add": 

+

431 try: 

+

432 BonnerCohort.create(year=year, user=user) 

+

433 except IntegrityError as e: 

+

434 # if they already exist, ignore the error 

+

435 pass 

+

436 elif method == "remove": 

+

437 BonnerCohort.delete().where(BonnerCohort.user == user, BonnerCohort.year == year).execute() 

+

438 else: 

+

439 abort(500) 

+

440 

+

441 return "" 

+

442 

+

443@admin_bp.route("/bonnerxls") 

+

444def bonnerxls(): 

+

445 if not g.current_user.isCeltsAdmin: 

+

446 abort(403) 

+

447 

+

448 newfile = makeBonnerXls() 

+

449 return send_file(open(newfile, 'rb'), download_name='BonnerStudents.xlsx', as_attachment=True) 

+

450 

+

451@admin_bp.route("/saveRequirements/<certid>", methods=["POST"]) 

+

452def saveRequirements(certid): 

+

453 if not g.current_user.isCeltsAdmin: 

+

454 abort(403) 

+

455 

+

456 newRequirements = updateCertRequirements(certid, request.get_json()) 

+

457 

+

458 return jsonify([requirement.id for requirement in newRequirements]) 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_c86a23c356556db1_userManagement_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_c86a23c356556db1_userManagement_py.html new file mode 100644 index 000000000..f3823f6f6 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_c86a23c356556db1_userManagement_py.html @@ -0,0 +1,213 @@ + + + + + Coverage for app/controllers/admin/userManagement.py: 25% + + + + + +
+
+

+ Coverage for app/controllers/admin/userManagement.py: + 25% +

+ +

+ 92 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from flask import render_template,request, flash, g, abort, redirect, url_for 

+

2import re 

+

3from app.controllers.admin import admin_bp 

+

4from app.models.user import User 

+

5from app.models.program import Program 

+

6from app.logic.userManagement import addCeltsAdmin,addCeltsStudentStaff,removeCeltsAdmin,removeCeltsStudentStaff 

+

7from app.logic.userManagement import changeProgramInfo 

+

8from app.logic.utils import selectSurroundingTerms 

+

9from app.logic.term import addNextTerm, changeCurrentTerm 

+

10 

+

11@admin_bp.route('/admin/manageUsers', methods = ['POST']) 

+

12def manageUsers(): 

+

13 eventData = request.form 

+

14 user = eventData['user'] 

+

15 method = eventData['method'] 

+

16 username = re.sub("[()]","", (user.split())[-1]) 

+

17 

+

18 try: 

+

19 user = User.get_by_id(username) 

+

20 except Exception as e: 

+

21 print(e) 

+

22 flash(username + " is an invalid user.", "danger") 

+

23 return ("danger", 500) 

+

24 

+

25 if method == "addCeltsAdmin": 

+

26 if user.isStudent and not user.isCeltsStudentStaff: 

+

27 flash(user.firstName + " " + user.lastName + " cannot be added as a CELTS-Link admin", 'danger') 

+

28 else: 

+

29 if user.isCeltsAdmin: 

+

30 flash(user.firstName + " " + user.lastName + " is already a CELTS-Link Admin", 'danger') 

+

31 else: 

+

32 addCeltsAdmin(user) 

+

33 flash(user.firstName + " " + user.lastName + " has been added as a CELTS-Link Admin", 'success') 

+

34 elif method == "addCeltsStudentStaff": 

+

35 if not user.isStudent: 

+

36 flash(username + " cannot be added as CELTS Student Staff", 'danger') 

+

37 else: 

+

38 if user.isCeltsStudentStaff: 

+

39 flash(user.firstName + " " + user.lastName + " is already a CELTS Student Staff", 'danger') 

+

40 else: 

+

41 addCeltsStudentStaff(user) 

+

42 flash(user.firstName + " " + user.lastName + " has been added as a CELTS Student Staff", 'success') 

+

43 elif method == "removeCeltsAdmin": 

+

44 removeCeltsAdmin(user) 

+

45 flash(user.firstName + " " + user.lastName + " is no longer a CELTS Admin ", 'success') 

+

46 elif method == "removeCeltsStudentStaff": 

+

47 removeCeltsStudentStaff(user) 

+

48 flash(user.firstName + " " + user.lastName + " is no longer a CELTS Student Staff", 'success') 

+

49 return ("success") 

+

50 

+

51@admin_bp.route('/addProgramManagers', methods=['POST']) 

+

52def addProgramManagers(): 

+

53 eventData = request.form 

+

54 try: 

+

55 return addProgramManager(eventData['username'],int(eventData['programID'])) 

+

56 except Exception as e: 

+

57 print(e) 

+

58 flash('Error while trying to add a manager.','warning') 

+

59 abort(500,"'Error while trying to add a manager.'") 

+

60 

+

61@admin_bp.route('/removeProgramManagers', methods=['POST']) 

+

62def removeProgramManagers(): 

+

63 eventData = request.form 

+

64 try: 

+

65 return removeProgramManager(eventData['username'],int(eventData['programID'])) 

+

66 except Exception as e: 

+

67 print(e) 

+

68 flash('Error while removing a manager.','warning') 

+

69 abort(500,"Error while trying to remove a manager.") 

+

70 

+

71@admin_bp.route('/admin/updateProgramInfo/<programID>', methods=['POST']) 

+

72def updateProgramInfo(programID): 

+

73 """Grabs info and then outputs it to logic function""" 

+

74 programInfo = request.form # grabs user inputs 

+

75 if g.current_user.isCeltsAdmin: 

+

76 try: 

+

77 changeProgramInfo(programInfo["programName"], #calls logic function to add data to database 

+

78 programInfo["contactEmail"], 

+

79 programInfo["contactName"], 

+

80 programInfo["location"], 

+

81 programID) 

+

82 

+

83 flash("Program updated", "success") 

+

84 return redirect(url_for("admin.userManagement", accordion="program")) 

+

85 except Exception as e: 

+

86 print(e) 

+

87 flash('Error while updating program info.','warning') 

+

88 abort(500,'Error while updating program.') 

+

89 abort(403) 

+

90 

+

91@admin_bp.route('/admin', methods = ['GET']) 

+

92def userManagement(): 

+

93 terms = selectSurroundingTerms(g.current_term) 

+

94 current_programs = Program.select() 

+

95 currentAdmins = list(User.select().where(User.isCeltsAdmin)) 

+

96 currentStudentStaff = list(User.select().where(User.isCeltsStudentStaff)) 

+

97 if g.current_user.isCeltsAdmin: 

+

98 return render_template('admin/userManagement.html', 

+

99 terms = terms, 

+

100 programs = list(current_programs), 

+

101 currentAdmins = currentAdmins, 

+

102 currentStudentStaff = currentStudentStaff, 

+

103 ) 

+

104 abort(403) 

+

105 

+

106@admin_bp.route('/admin/changeTerm', methods=['POST']) 

+

107def changeTerm(): 

+

108 termData = request.form 

+

109 term = int(termData["id"]) 

+

110 changeCurrentTerm(term) 

+

111 return "" 

+

112 

+

113@admin_bp.route('/admin/addNewTerm', methods = ['POST']) 

+

114def addNewTerm(): 

+

115 addNextTerm() 

+

116 return "" 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_c86a23c356556db1_volunteers_py.html b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_c86a23c356556db1_volunteers_py.html new file mode 100644 index 000000000..bdcf4b0db --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/d_c86a23c356556db1_volunteers_py.html @@ -0,0 +1,342 @@ + + + + + Coverage for app/controllers/admin/volunteers.py: 23% + + + + + +
+
+

+ Coverage for app/controllers/admin/volunteers.py: + 23% +

+ +

+ 180 statements   + + + +

+

+ « prev     + ^ index     + » next +       + coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+ +
+
+
+

1from flask import request, render_template, redirect, url_for, request, flash, abort, g, json, jsonify 

+

2from datetime import datetime 

+

3from peewee import DoesNotExist, JOIN 

+

4from playhouse.shortcuts import model_to_dict 

+

5from app.controllers.admin import admin_bp 

+

6from app.models.event import Event 

+

7from app.models.program import Program 

+

8from app.models.user import User 

+

9from app.models.eventParticipant import EventParticipant 

+

10from app.logic.searchUsers import searchUsers 

+

11from app.logic.volunteers import updateEventParticipants, addVolunteerToEventRsvp, getEventLengthInHours, addUserBackgroundCheck, setProgramManager 

+

12from app.logic.participants import trainedParticipants, getEventParticipants, addPersonToEvent, getParticipationStatusForTrainings 

+

13from app.logic.events import getPreviousRecurringEventData, getEventRsvpCount 

+

14from app.models.eventRsvp import EventRsvp 

+

15from app.models.backgroundCheck import BackgroundCheck 

+

16from app.models.programManager import ProgramManager 

+

17from app.logic.createLogs import createAdminLog, createRsvpLog 

+

18from app.logic.users import getBannedUsers, isBannedFromEvent 

+

19 

+

20 

+

21@admin_bp.route('/searchVolunteers/<query>', methods = ['GET']) 

+

22def getVolunteers(query): 

+

23 '''Accepts user input and queries the database returning results that matches user search''' 

+

24 

+

25 return json.dumps(searchUsers(query)) 

+

26 

+

27@admin_bp.route('/event/<eventID>/manage_volunteers', methods=['POST']) 

+

28def updateVolunteerTable(eventID): 

+

29 try: 

+

30 event = Event.get_by_id(eventID) 

+

31 except DoesNotExist as e: 

+

32 print(f"No event found for {eventID}") 

+

33 abort(404) 

+

34 

+

35 volunteerUpdated = updateEventParticipants(request.form) 

+

36 if volunteerUpdated: 

+

37 flash("Volunteer table succesfully updated", "success") 

+

38 else: 

+

39 flash("Error adding volunteer", "danger") 

+

40 return redirect(url_for("admin.manageVolunteersPage", eventID=eventID)) 

+

41 

+

42@admin_bp.route('/event/<eventID>/manage_volunteers', methods=['GET']) 

+

43def manageVolunteersPage(eventID): 

+

44 try: 

+

45 event = Event.get_by_id(eventID) 

+

46 except DoesNotExist as e: 

+

47 print(f"No event found for {eventID}", e) 

+

48 abort(404) 

+

49 eventData = model_to_dict(event, recurse=False) 

+

50 

+

51 eventData["program"] = event.program 

+

52 trainedParticipantsList = trainedParticipants(event.program, event.term) 

+

53 eventParticipants = getEventParticipants(event) 

+

54 

+

55 isProgramManager = g.current_user.isProgramManagerForEvent(event) 

+

56 bannedUsers = [row.user for row in getBannedUsers(event.program)] 

+

57 if not (g.current_user.isCeltsAdmin or (g.current_user.isCeltsStudentStaff and isProgramManager)): 

+

58 abort(403) 

+

59 

+

60 eventParticipantData = list(EventParticipant.select(EventParticipant, User).join(User).where(EventParticipant.event==event)) 

+

61 eventRsvpData = list(EventRsvp.select(EventRsvp, User).join(User).where(EventRsvp.event==event).order_by(EventRsvp.rsvpTime)) 

+

62 eventParticipantUsers = [participantDatum.user for participantDatum in eventParticipantData] 

+

63 eventRsvpData = [rsvpDatum for rsvpDatum in eventRsvpData if rsvpDatum.user not in eventParticipantUsers] 

+

64 

+

65 if event.isPast: 

+

66 eventVolunteerData = eventParticipantData 

+

67 eventNonAttendedData = eventRsvpData 

+

68 eventWaitlistData = [] 

+

69 else: 

+

70 eventWaitlistData = [volunteer for volunteer in eventParticipantData + eventRsvpData if volunteer.rsvpWaitlist and event.isRsvpRequired] 

+

71 eventVolunteerData = [volunteer for volunteer in eventRsvpData if volunteer not in eventWaitlistData] 

+

72 eventNonAttendedData = [] 

+

73 

+

74 program = event.program 

+

75 

+

76 allRelevantUsers = [participant.user for participant in eventVolunteerData + eventNonAttendedData + eventWaitlistData] 

+

77 completedTrainingInfo = getParticipationStatusForTrainings(program, allRelevantUsers, event.term) 

+

78 

+

79 eventLengthInHours = getEventLengthInHours(event.timeStart, event.timeEnd, event.startDate) 

+

80 

+

81 recurringEventID = event.recurringId # query Event Table to get recurringId using Event ID. 

+

82 recurringEventStartDate = event.startDate 

+

83 recurringVolunteers = getPreviousRecurringEventData(recurringEventID) 

+

84 

+

85 currentRsvpAmount = getEventRsvpCount(event.id) 

+

86 return render_template("/events/manageVolunteers.html", 

+

87 eventData = eventData, 

+

88 eventVolunteerData = eventVolunteerData, 

+

89 eventNonAttendedData = eventNonAttendedData, 

+

90 eventWaitlistData = eventWaitlistData, 

+

91 eventLength = eventLengthInHours, 

+

92 event = event, 

+

93 recurringEventID = recurringEventID, 

+

94 recurringEventStartDate = recurringEventStartDate, 

+

95 recurringVolunteers = recurringVolunteers, 

+

96 bannedUsers = bannedUsers, 

+

97 trainedParticipantsList = trainedParticipantsList, 

+

98 completedTrainingInfo = completedTrainingInfo, 

+

99 currentRsvpAmount = currentRsvpAmount) 

+

100 

+

101 

+

102 

+

103@admin_bp.route('/event/<eventID>/volunteer_details', methods=['GET']) 

+

104def volunteerDetailsPage(eventID): 

+

105 try: 

+

106 event = Event.get_by_id(eventID) 

+

107 except DoesNotExist as e: 

+

108 print(f"No event found for {eventID}", e) 

+

109 abort(404) 

+

110 

+

111 if not (g.current_user.isCeltsAdmin or (g.current_user.isCeltsStudentStaff and g.current_user.isProgramManagerForEvent(event))): 

+

112 abort(403) 

+

113 

+

114 eventRsvpData = list(EventRsvp.select().where(EventRsvp.event==event)) 

+

115 eventParticipantData = list(EventParticipant.select().where(EventParticipant.event==event)) 

+

116 participantsAndRsvp = (eventParticipantData + eventRsvpData) 

+

117 eventParticipantUsers = [obj.user for obj in eventParticipantData] 

+

118 eventNonAttendedData = [obj.user for obj in eventRsvpData if obj.user not in eventParticipantUsers] 

+

119 

+

120 #get unique list of users for each category waitlist/notwaitlist,rsvped/attended 

+

121 waitlistUser = list(set([obj.user for obj in participantsAndRsvp if obj.rsvpWaitlist])) 

+

122 rsvpUser = list(set([obj.user for obj in eventRsvpData if not obj.rsvpWaitlist ])) 

+

123 attendedUser= list(set([obj.user for obj in eventParticipantData if obj.user not in eventNonAttendedData])) 

+

124 

+

125 eventData = model_to_dict(event, recurse=False) 

+

126 eventData["program"] = event.program 

+

127 

+

128 return render_template("/events/volunteerDetails.html", 

+

129 waitlistUser = waitlistUser, 

+

130 attendedUser= attendedUser, 

+

131 rsvpUser= rsvpUser, 

+

132 event = event, 

+

133 eventData = eventData) 

+

134 

+

135 

+

136@admin_bp.route('/addVolunteersToEvent/<eventId>', methods = ['POST']) 

+

137def addVolunteer(eventId): 

+

138 event = Event.get_by_id(eventId) 

+

139 successfullyAddedVolunteer = False 

+

140 usernameList = [] 

+

141 eventParticipants = getEventParticipants(eventId) 

+

142 usernameList = request.form.getlist("volunteer[]") 

+

143 

+

144 successfullyAddedVolunteer = False 

+

145 alreadyAddedList = [] 

+

146 addedSuccessfullyList = [] 

+

147 errorList = [] 

+

148 

+

149 for user in usernameList: 

+

150 userObj = User.get_by_id(user) 

+

151 successfullyAddedVolunteer = addPersonToEvent(userObj, event) 

+

152 if successfullyAddedVolunteer == "already in": 

+

153 alreadyAddedList.append(userObj.fullName) 

+

154 else: 

+

155 if successfullyAddedVolunteer: 

+

156 addedSuccessfullyList.append(userObj.fullName) 

+

157 else: 

+

158 errorList.append(userObj.fullName) 

+

159 

+

160 volunteers = "" 

+

161 if alreadyAddedList: 

+

162 volunteers = ", ".join(vol for vol in alreadyAddedList) 

+

163 flash(f"{volunteers} already in table.", "warning") 

+

164 

+

165 if addedSuccessfullyList: 

+

166 volunteers = ", ".join(vol for vol in addedSuccessfullyList) 

+

167 flash(f"{volunteers} added successfully.", "success") 

+

168 

+

169 if errorList: 

+

170 volunteers = ", ".join(vol for vol in errorList) 

+

171 flash(f"Error when adding {volunteers} to event.", "danger") 

+

172 

+

173 if 'ajax' in request.form and request.form['ajax']: 

+

174 return '' 

+

175 

+

176 return redirect(url_for('admin.manageVolunteersPage', eventID = eventId)) 

+

177 

+

178@admin_bp.route('/rsvpFromWaitlist/<username>/<eventId>', methods = ['POST']) 

+

179def rsvpFromWaitlist(username, eventId): 

+

180 event = Event.get_by_id(eventId) 

+

181 isProgramManager = g.current_user.isProgramManagerFor(event.program) 

+

182 if g.current_user.isCeltsAdmin or (g.current_user.isCeltsStudentStaff and isProgramManager): 

+

183 waitlistUsers = EventRsvp.select(EventRsvp, User).join(User).where(EventRsvp.user == username, EventRsvp.event==eventId).execute() 

+

184 if (waitlistUsers): 

+

185 createRsvpLog(event.id, f"Moved {waitlistUsers[0].user.fullName} from waitlist to RSVP.") 

+

186 (EventRsvp.update(rsvpWaitlist = False).where(EventRsvp.event_id == eventId, EventRsvp.user_id == username)).execute() 

+

187 return "" 

+

188 

+

189@admin_bp.route('/addVolunteersToEvent/<username>/<eventId>/isBanned', methods = ['GET']) 

+

190def isVolunteerBanned(username, eventId): 

+

191 return {"banned":1} if isBannedFromEvent(username, eventId) else {"banned":0} 

+

192 

+

193@admin_bp.route('/removeVolunteerFromEvent', methods = ['POST']) 

+

194def removeVolunteerFromEvent(): 

+

195 user = request.form.get('username') 

+

196 eventID = request.form.get('eventId') 

+

197 if g.current_user.isAdmin: 

+

198 userInRsvpTable = EventRsvp.select(EventRsvp, User).join(User).where(EventRsvp.user == user, EventRsvp.event==eventID).execute() 

+

199 if (userInRsvpTable): 

+

200 rsvpUser = userInRsvpTable[0] 

+

201 if rsvpUser.rsvpWaitlist: 

+

202 createRsvpLog(eventID, f"Removed {rsvpUser.user.fullName} from waitlist.") 

+

203 else: 

+

204 createRsvpLog(eventID, f"Removed {rsvpUser.user.fullName} from RSVP list.") 

+

205 (EventParticipant.delete().where(EventParticipant.user==user, EventParticipant.event==eventID)).execute() 

+

206 (EventRsvp.delete().where(EventRsvp.user==user, EventRsvp.event==eventID)).execute() 

+

207 flash("Volunteer successfully removed", "success") 

+

208 return "" 

+

209 

+

210@admin_bp.route('/addBackgroundCheck', methods = ['POST']) 

+

211def addBackgroundCheck(): 

+

212 if g.current_user.isCeltsAdmin: 

+

213 eventData = request.form 

+

214 user = eventData['user'] 

+

215 bgStatus = eventData['bgStatus'] 

+

216 type = eventData['bgType'] 

+

217 dateCompleted = eventData['bgDate'] 

+

218 addUserBackgroundCheck(user, type, bgStatus, dateCompleted) 

+

219 return " " 

+

220 

+

221@admin_bp.route('/deleteBackgroundCheck', methods = ['POST']) 

+

222def deleteBackgroundCheck(): 

+

223 if g.current_user.isCeltsAdmin: 

+

224 eventData = request.form 

+

225 bgToDelete = BackgroundCheck.get_by_id(eventData['bgID']) 

+

226 BackgroundCheck.delete().where(BackgroundCheck.id == bgToDelete).execute() 

+

227 return "" 

+

228 

+

229@admin_bp.route('/updateProgramManager', methods=["POST"]) 

+

230def updateProgramManager(): 

+

231 if g.current_user.isCeltsAdmin: 

+

232 data =request.form 

+

233 username = User.get(User.username == data["user_name"]) 

+

234 program = Program.get_by_id(data['program_id']) 

+

235 setProgramManager(data["user_name"], data["program_id"], data["action"]) 

+

236 createAdminLog(f'{username.firstName} has been {data["action"]}ed as a Program Manager for {program.programName}') 

+

237 return "" 

+

238 else: 

+

239 abort(403) 

+

240 

+

241@admin_bp.route("/updatePhone", methods=["POST"]) 

+

242def updatePhone(): 

+

243 newinfo=request.form 

+

244 User.update(phoneNumber=newinfo["phoneNumber"]).where(User.username==newinfo["username"]).execute() 

+

245 return "" 

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/favicon_32.png b/BCStudentSoftwareDevTeam/celts/fixAdminLog/favicon_32.png new file mode 100644 index 0000000000000000000000000000000000000000..8649f0475d8d20793b2ec431fe25a186a414cf10 GIT binary patch literal 1732 zcmV;#20QtQP)K2KOkBOVxIZChq#W-v7@TU%U6P(wycKT1hUJUToW3ke1U1ONa4 z000000000000000bb)GRa9mqwR9|UWHy;^RUrt?IT__Y0JUcxmBP0(51q1>E00030 z|NrOz)aw7%8sJzM<5^g%z7^qE`}_Ot|JUUG(NUkWzR|7K?Zo%@_v-8G-1N%N=D$;; zw;keH4dGY$`1t4M=HK_s*zm^0#KgqfwWhe3qO_HtvXYvtjgX>;-~C$L`&k>^R)9)7 zdPh2TL^pCnHC#0+_4D)M`p?qp!pq{jO_{8;$fbaflbx`Tn52n|n}8VFRTA1&ugOP< zPd{uvFjz7t*Vot1&d$l-xWCk}s;sQL&#O(Bskh6gqNJv>#iB=ypG1e3K!K4yc7!~M zfj4S*g^zZ7eP$+_Sl07Z646l;%urinP#D8a6TwRtnLIRcI!r4f@bK~9-`~;E(N?Lv zSEst7s;rcxsi~}{Nsytfz@MtUoR*iFc8!#vvx}Umhm4blk(_~MdVD-@dW&>!Nn~ro z_E~-ESVQAj6Wmn;(olz(O&_{U2*pZBc1aYjMh>Dq3z|6`jW`RDHV=t3I6yRKJ~LOX zz_z!!vbVXPqob#=pj3^VMT?x6t(irRmSKsMo1~LLkB&=#j!=M%NP35mfqim$drWb9 zYIb>no_LUwc!r^NkDzs4YHu@=ZHRzrafWDZd1EhEVq=tGX?tK$pIa)DTh#bkvh!J- z?^%@YS!U*0E8$q$_*aOTQ&)Ra64g>ep;BdcQgvlg8qQHrP*E$;P{-m=A*@axn@$bO zO-Y4JzS&EAi%YG}N?cn?YFS7ivPY=EMV6~YH;+Xxu|tefLS|Aza)Cg6us#)=JW!uH zQa?H>d^j+YHCtyjL^LulF*05|F$RG!AX_OHVI&MtA~_@=5_lU|0000rbW%=J06GH4 z^5LD8b8apw8vNh1ua1mF{{Hy)_U`NA;Nacc+sCpuHXa-V{r&yz?c(9#+}oX+NmiRW z+W-IqK1oDDR5;6GfCDCOP5}iL5fK(cB~ET81`MFgF2kGa9AjhSIk~-E-4&*tPPKdiilQJ11k_J082ZS z>@TvivP!5ZFG?t@{t+GpR3XR&@*hA_VE1|Lo8@L@)l*h(Z@=?c-NS$Fk&&61IzUU9 z*nPqBM=OBZ-6ka1SJgGAS-Us5EN)r#dUX%>wQZLa2ytPCtMKp)Ob z*xcu38Z&d5<-NBS)@jRD+*!W*cf-m_wmxDEqBf?czI%3U0J$Xik;lA`jg}VH?(S(V zE!M3;X2B8w0TnnW&6(8;_Uc)WD;Ms6PKP+s(sFgO!}B!^ES~GDt4qLPxwYB)^7)XA zZwo9zDy-B0B+jT6V=!=bo(zs_8{eBA78gT9GH$(DVhz;4VAYwz+bOIdZ-PNb|I&rl z^XG=vFLF)1{&nT2*0vMz#}7^9hXzzf&ZdKlEj{LihP;|;Ywqn35ajP?H?7t|i-Un% z&&kxee@9B{nwgv1+S-~0)E1{ob1^Wn`F2isurqThKK=3%&;`@{0{!D- z&CSj80t;uPu&FaJFtSXKH#ajgGj}=sEad7US6jP0|Db@0j)?(5@sf<7`~a9>s;wCa zm^)spe{uxGFmrJYI9cOh7s$>8Npkt-5EWB1UKc`{W{y5Ce$1+nM9Cr;);=Ju#N^62OSlJMn7omiUgP&ErsYzT~iGxcW aE(`!K@+CXylaC4j0000 + + + + Coverage report + + + + + +
+
+

Coverage report: + 63% +

+ +
+ +
+

+ coverage.py v7.2.5, + created at 2023-10-09 13:40 +0000 +

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Modulestatementsmissingexcludedcoverage
app/__init__.py7425066%
app/controllers/__init__.py200100%
app/controllers/admin/__init__.py500100%
app/controllers/admin/routes.py308229026%
app/controllers/admin/userManagement.py9269025%
app/controllers/admin/volunteers.py180138023%
app/controllers/events/__init__.py300100%
app/controllers/events/email.py5535036%
app/controllers/events/routes.py3620044%
app/controllers/main/__init__.py300100%
app/controllers/main/routes.py306227026%
app/controllers/serviceLearning/__init__.py300100%
app/controllers/serviceLearning/routes.py194141027%
app/logic/bonner.py4726045%
app/logic/certification.py4900100%
app/logic/config.py232091%
app/logic/courseManagement.py4710079%
app/logic/createLogs.py1000100%
app/logic/downloadFile.py272093%
app/logic/emailHandler.py16630082%
app/logic/events.py23118092%
app/logic/fileHandler.py628087%
app/logic/landingPage.py302093%
app/logic/loginManager.py3627025%
app/logic/manageSLFaculty.py1100100%
app/logic/participants.py9110089%
app/logic/searchUsers.py2000100%
app/logic/serviceLearningCoursesData.py13018086%
app/logic/term.py4311074%
app/logic/transcript.py301097%
app/logic/userManagement.py4900100%
app/logic/users.py5600100%
app/logic/utils.py4117059%
app/logic/volunteers.py558085%
app/models/__init__.py141093%
app/models/adminLog.py600100%
app/models/attachmentUpload.py700100%
app/models/backgroundCheck.py800100%
app/models/backgroundCheckType.py400100%
app/models/bonnerCohort.py700100%
app/models/certification.py700100%
app/models/certificationRequirement.py800100%
app/models/course.py2000100%
app/models/courseInstructor.py600100%
app/models/courseParticipant.py700100%
app/models/courseQuestion.py600100%
app/models/courseStatus.py700100%
app/models/emailLog.py1300100%
app/models/emailTemplate.py700100%
app/models/emergencyContact.py1100100%
app/models/event.py568086%
app/models/eventParticipant.py101090%
app/models/eventRsvp.py1100100%
app/models/eventRsvpLog.py800100%
app/models/eventTemplate.py1600100%
app/models/eventViews.py800100%
app/models/insuranceInfo.py1100100%
app/models/interest.py600100%
app/models/note.py800100%
app/models/partner.py300100%
app/models/profileNote.py800100%
app/models/program.py212090%
app/models/programBan.py1000100%
app/models/programManager.py600100%
app/models/questionNote.py600100%
app/models/requirementMatch.py800100%
app/models/term.py453093%
app/models/user.py491098%
app/scripts/send_event_reminder_emails.py333091%
Total29761093063%
+

+ No items found using the specified filter. +

+
+ + + diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/keybd_closed.png b/BCStudentSoftwareDevTeam/celts/fixAdminLog/keybd_closed.png new file mode 100644 index 0000000000000000000000000000000000000000..ba119c47df81ed2bbd27a06988abf700139c4f99 GIT binary patch literal 9004 zcmeHLc{tSF+aIY=A^R4_poB4tZAN2XC;O7M(inrW3}(h&Q4}dl*&-65$i9^&vW6_# zcM4g`Qix=GhkBl;=lwnJ@Ap2}^}hc-b6vBXb3XUyzR%~}_c`-Dw+!?&>5p(90RRB> zXe~7($~PP3eT?=X<@3~Q1w84vX~IoSx~1#~02+TopXK(db;4v6!{+W`RHLkkHO zo;+s?)puc`+$yOwHv>I$5^8v^F3<|$44HA8AFnFB0cAP|C`p}aSMJK*-CUB{eQ!;K z-9Ju3OQ+xVPr3P#o4>_lNBT;M+1vgV&B~6!naOGHb-LFA9TkfHv1IFA1Y!Iz!Zl3) z%c#-^zNWPq7U_}6I7aHSmFWi125RZrNBKyvnV^?64)zviS;E!UD%LaGRl6@zn!3E{ zJ`B$5``cH_3a)t1#6I7d==JeB_IcSU%=I#DrRCBGm8GvCmA=+XHEvC2SIfsNa0(h9 z7P^C4U`W@@`9p>2f^zyb5B=lpc*RZMn-%%IqrxSWQF8{ec3i?-AB(_IVe z)XgT>Y^u41MwOMFvU=I4?!^#jaS-%bjnx@ zmL44yVEslR_ynm18F!u}Ru#moEn3EE?1=9@$B1Z5aLi5b8{&?V(IAYBzIar!SiY3< z`l0V)djHtrImy}(!7x-Pmq+njM)JFQ9mx*(C+9a3M)(_SW|lrN=gfxFhStu^zvynS zm@gl;>d8i8wpUkX42vS3BEzE3-yctH%t0#N%s+6-&_<*Fe7+h=`=FM?DOg1)eGL~~ zQvIFm$D*lqEh07XrXY=jb%hdyP4)`wyMCb$=-z9(lOme9=tirVkb)_GOl2MJn;=Ky z^0pV1owR7KP-BSxhI@@@+gG0roD-kXE1;!#R7KY1QiUbyDdTElm|ul7{mMdF1%UDJ z_vp=Vo!TCF?D*?u% zk~}4!xK2MSQd-QKC0${G=ZRv2x8%8ZqdfR!?Dv=5Mj^8WU)?iH;C?o6rSQy*^YwQb zf@5V)q=xah#a3UEIBC~N7on(p4jQd4K$|i7k`d8mw|M{Mxapl46Z^X^9U}JgqH#;T z`CTzafpMD+J-LjzF+3Xau>xM_sXisRj6m-287~i9g|%gHc}v77>n_+p7ZgmJszx!b zSmL4wV;&*5Z|zaCk`rOYFdOjZLLQr!WSV6AlaqYh_OE)>rYdtx`gk$yAMO=-E1b~J zIZY6gM*}1UWsJ)TW(pf1=h?lJy_0TFOr|nALGW>$IE1E7z+$`^2WJY+>$$nJo8Rs` z)xS>AH{N~X3+b=2+8Q_|n(1JoGv55r>TuwBV~MXE&9?3Zw>cIxnOPNs#gh~C4Zo=k z&!s;5)^6UG>!`?hh0Q|r|Qbm>}pgtOt23Vh!NSibozH$`#LSiYL)HR4bkfEJMa zBHwC3TaHx|BzD|MXAr>mm&FbZXeEX-=W}Ji&!pji4sO$#0Wk^Q7j%{8#bJPn$C=E% zPlB}0)@Ti^r_HMJrTMN?9~4LQbIiUiOKBVNm_QjABKY4;zC88yVjvB>ZETNzr%^(~ zI3U&Ont?P`r&4 z#Bp)jcVV_N_{c1_qW}_`dQm)D`NG?h{+S!YOaUgWna4i8SuoLcXAZ|#Jh&GNn7B}3 z?vZ8I{LpmCYT=@6)dLPd@|(;d<08ufov%+V?$mgUYQHYTrc%eA=CDUzK}v|G&9}yJ z)|g*=+RH1IQ>rvkY9UIam=fkxWDyGIKQ2RU{GqOQjD8nG#sl+$V=?wpzJdT=wlNWr z1%lw&+;kVs(z?e=YRWRA&jc75rQ~({*TS<( z8X!j>B}?Bxrrp%wEE7yBefQ?*nM20~+ZoQK(NO_wA`RNhsqVkXHy|sod@mqen=B#@ zmLi=x2*o9rWqTMWoB&qdZph$~qkJJTVNc*8^hU?gH_fY{GYPEBE8Q{j0Y$tvjMv%3 z)j#EyBf^7n)2d8IXDYX2O0S%ZTnGhg4Ss#sEIATKpE_E4TU=GimrD5F6K(%*+T-!o z?Se7^Vm`$ZKDwq+=~jf?w0qC$Kr&R-;IF#{iLF*8zKu8(=#chRO;>x zdM;h{i{RLpJgS!B-ueTFs8&4U4+D8|7nP~UZ@P`J;*0sj^#f_WqT#xpA?@qHonGB& zQ<^;OLtOG1w#)N~&@b0caUL7syAsAxV#R`n>-+eVL9aZwnlklzE>-6!1#!tVA`uNo z>Gv^P)sohc~g_1YMC;^f(N<{2y5C^;QCEXo;LQ^#$0 zr>jCrdoeXuff!dJ^`#=Wy2Gumo^Qt7BZrI~G+Pyl_kL>is3P0^JlE;Sjm-YfF~I>t z_KeNpK|5U&F4;v?WS&#l(jxUWDarfcIcl=-6!8>^S`57!M6;hZea5IFA@)2+*Rt85 zi-MBs_b^DU8LygXXQGkG+86N7<%M|baM(orG*ASffC`p!?@m{qd}IcYmZyi^d}#Q& zNjk-0@CajpUI-gPm20ERVDO!L8@p`tMJ69FD(ASIkdoLdiRV6h9TPKRz>2WK4upHd z6OZK33EP?`GoJkXh)S035}uLUO$;TlXwNdMg-WOhLB)7a`-%*a9lFmjf6n+4ZmIHN z-V@$ z8PXsoR4*`5RwXz=A8|5;aXKtSHFccj%dG7cO~UBJnt)61K>-uPX)`vu{7fcX6_>zZ zw_2V&Li+7mxbf!f7{Rk&VVyY!UtZywac%g!cH+xh#j$a`uf?XWl<``t`36W;p7=_* zO6uf~2{sAdkZn=Ts@p0>8N8rzw2ZLS@$ibV-c-QmG@%|3gUUrRxu=e*ekhTa+f?8q z3$JVGPr9w$VQG~QCq~Y=2ThLIH!T@(>{NihJ6nj*HA_C#Popv)CBa)+UI-bx8u8zfCT^*1|k z&N9oFYsZEijPn31Yx_yO5pFs>0tOAV=oRx~Wpy5ie&S_449m4R^{LWQMA~}vocV1O zIf#1ZV85E>tvZE4mz~zn{hs!pkIQM;EvZMimqiPAJu-9P@mId&nb$lsrICS=)zU3~ zn>a#9>}5*3N)9;PTMZ)$`5k} z?iG}Rwj$>Y*|(D3S3e&fxhaPHma8@vwu(cwdlaCjX+NIK6=$H4U`rfzcWQVOhp{fnzuZhgCCGpw|p zTi`>cv~xVzdx|^`C0vXdlMwPae3S?>3|7v$e*Bs6-5gS>>FMHk_r2M(ADOV{KV7+6 zA@5Q(mdx%7J}MY}K461iuQ}5GwDGI=Yc&g0MZHu)7gC3{5@QZj6SJl*o0MS2Cl_ia zyK?9QmC9tJ6yn{EA-erJ4wk$+!E#X(s~9h^HOmQ_|6V_s1)k;%9Q6Niw}SyT?jxl4 z;HYz2$Nj$8Q_*Xo`TWEUx^Q9b+ik@$o39`mlY&P}G8wnjdE+Dlj?uL;$aB$n;x zWoh-M_u>9}_Ok@d_uidMqz10zJc}RQijPW3Fs&~1am=j*+A$QWTvxf9)6n;n8zTQW z!Q_J1%apTsJzLF`#^P_#mRv2Ya_keUE7iMSP!ha-WQoo0vZZG?gyR;+4q8F6tL#u< zRj8Hu5f-p1$J;)4?WpGL{4@HmJ6&tF9A5Tc8Trp>;Y>{^s?Q1&bam}?OjsnKd?|Z82aix26wUOLxbEW~E)|CgJ#)MLf_me# zv4?F$o@A~Um)6>HlM0=3Bd-vc91EM}D+t6-@!}O%i*&Wl%@#C8X+?5+nv`oPu!!=5 znbL+Fk_#J_%8vOq^FIv~5N(nk03kyo1p@l|1c+rO^zCG3bk2?|%AF;*|4si1XM<`a z1NY0-8$wv?&129!(g_A1lXR!+pD*1*cF?T~e1d6*G1Fz)jcSaZoKpxtA%FNnKP2jo zLXn@OR#1z@6zuH%mMB98}-t zHJqClsZ!G5xMSgIs_=<8sBePXxfoXsuvy`|buON9BX%s-o>OVLA)k3W=wKnw1?so$ zEjm0aS=zu@Xu#;{A)QTjJ$a9_={++ACkRY*sk3jLk&Fu}RxR<-DXR<`5`$VNG*wJE zidM6VzaQ!M0gbQM98@x@;#0qUS8O)p6mrYwTk*;8J~!ovbY6jon^Ki}uggd3#J5G8 z>awvtF85Y<9yE{Iag}J7O7)1O=ylk^255@XmV5J06-{xaaSNASZoTKKp~$tSxdUI~ zU1RZ&UuW37Ro&_ryj^cSt$Jd&pt|+h!A&dwcr&`S=R5E`=6Tm`+(qGm@$YZ8(8@a$ zXfo@Rwtvm7N3RMmVCb7radAs-@QtCXx^CQ-<)V>QPLZy@jH{#dc4#(y zV)6Hp{ZMz!|NG8!>i01gZMy)G<8Hf2X7e&LH_gOaajW<<^Xi55@OnlY*|S|*TS8;u_nHbv7lgmmZ+Q<5 zi!*lLCJmdpyzl(L${$C?(pVo|oR%r~x_B_ocPePa_);27^=n4L=`toZ;xdBut9rSv z?wDQ7j2I3WQBdhz%X7`2YaG_y|wA!7|s?k;A&WNMLMTZEzCaE^d??E&u?f=ejQBR~|< z)=thyP2(p8r6mt?Ad}tXAP_GvF9|P630I;$1cpQ+Ay7C34hK^ZV3H4kjPV8&NP>G5 zKRDEIBrFl{M#j4mfP0)68&?mqJP1S?2mU0djAGTjDV;wZ?6vplNn~3Hn$nP>%!dMi zz@bnC7zzi&k&s{QDWkf&zgrVXKUJjY3Gv3bL0}S4h>OdgEJ$Q^&p-VAr3J}^a*+rz z!jW7(h*+GuCyqcC{MD(Ovj^!{pB^OKUe|uy&bD?CN>KZrf3?v>>l*xSvnQiH-o^ViN$%FRdm9url;%(*jf5H$*S)8;i0xWHdl>$p);nH9v0)YfW?Vz$! zNCeUbi9`NEg(i^57y=fzM@1o*z*Bf6?QCV>2p9}(BLlYsOCfMjFv1pw1mlo)Py{8v zppw{MDfEeWN+n>Ne~oI7%9cU}mz0r3!es2gNF0t5jkGipjIo2lz;-e)7}Ul_#!eDv zw;#>kI>;#-pyfeu3Fsd^2F@6=oh#8r9;A!G0`-mm7%{=S;Ec(bJ=I_`FodKGQVNEY zmXwr4{9*jpDl%4{ggQZ5Ac z%wYTdl*!1c5^)%^E78Q&)ma|27c6j(a=)g4sGrp$r{jv>>M2 z6y)E5|Aooe!PSfKzvKA>`a6pfK3=E8vL14ksP&f=>gOP?}rG6ye@9ZR3 zJF*vsh*P$w390i!FV~~_Hv6t2Zl<4VUi|rNja#boFt{%q~xGb z(2petq9A*_>~B*>?d?Olx^lmYg4)}sH2>G42RE; literal 0 HcmV?d00001 diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/keybd_open.png b/BCStudentSoftwareDevTeam/celts/fixAdminLog/keybd_open.png new file mode 100644 index 0000000000000000000000000000000000000000..a8bac6c9de256626c680f9e9e3f8ee81d9713ecd GIT binary patch literal 9003 zcmeHLc{tST+n?-2i>)FxMv|DtSZA{DOOu_57&BjtZI~H*ma;_1l4LIxB9dJQ*|TO# zN!sjLvQy+8>YUSgf9L)E-g8~=``>Y0!#wx%xj*;)e4hJ$zP?Ym-Z>3679JK52*jqP zscJy|%SHXLGSN|g3$@6f1Az_(`xu?47+^iYt|X!@!3h9Uyj=k>;6<(w94t$&Tmv4vUI0Y(72z4p-=52qQm)ibdMG{Lq zK-QAXj0ngGo#r{-=KfvMuhjI#;F3ml_v?vI<2-B3E&Sb83IPcet8E#VcMLMbDBXp( zietxGS0^|mhdOuNU*! z>lxhuyJ~5HC9jEu^6wu9yggaJEILLJFELe{&yOk3uY^_mY(J*EdTA{CbDHru&S*s5 zFHGCrim@r19P**ASiJAew_7dD+e>cSOtls3Z#(>lZx1iINjrV7NNt%PDNcMkXlA*W z`Bs*%ezf4U5NxJm__K5P?GEB7`Q`04T`~MTc=Sf&%qHuFd;!rn3}>8+-@yEidsy4J zwgV$+ymZ>vxo%s!H&}(*({B{M0j#!`Lt5GDbvmkji<_pajk9^n5DO(1Q=&m;TJ!?& z?dIZM5vQ>Gv(&EdlJNx^(v{pFFPfSP@r^ zUhRTD7bv*AYH`?Gq11M%nz2r;gHNp42jVLD`5tDqtqX8m!12pRUB0&T%w5?UN8u2$ z{33ra^&{S8?zu^Udrw+}HTUH(`Hi#oxx_~8z^KjV88Ir*uZL|Sg~!j^L_s$=4bBRW zop?W3)Xm?LO6n3E9KHt6XpGZ_HN~5oyARM_FU(4I%qcBvz8@9K>nRPh&##*Eoh-~w z_nj&&SNa->_^2rmZKKZTTsb8qBi7eZ+<|^m6k%kJZMtc45f~Vd$|>90cV@0+305_? z$}Q=5?!3a*rg#60fWtWf!9(Na58NEPqWSacwBi#FiX9R?*v-C&eMqb0k&TM0y0Va% zz~=|oCLbfUU9)b69enmUFXBy2)12vO`bS&kb^YOC0g}4%8d0@NbMm6<9C^4VY$)DE z97dE-HVFOL-)`t{@mQPechUcK@>Nbm7VqtmzZyM5U<`U@;RjksVMF8R*E>VhuI zkJSj=K$J!b9wLT59DZFvicVNQpWLaC2991nDs(piR8YcRq>puA}_3int5bZCnSnDDDBIyC`&DN%_Rawgsxlzfrw!$YU zk697D5ny@b5%eg+G2F&np#M_QkwT<~o z=20^H-;eo=m3|I#91GRY0$TY@>nd$|*Y@6PiI*+2I$KO&NY?@M466>Gt%~Lgowk~^JM_8wk%ghs}g}t}vM}#g;++DAjY#7oR5>!9Zb&%tZ@Av?{`s6b=pUPf& z`Ej0w!tuWT?VOSJ(s^!$)o|_8JY0RAMH30nz=QERTWUx%i6hBP9(PAp{ZQXvk!u}#Vab<|7#n z{maX?O+c&it?=GMZ6-mCiq1b`jrvnH%AIwV(c=)Y+Ng zV<#loBasaSDG>p~!~6DW%DmIwBgLM5kIpGHr(+-C2oq1L_i5|QlNU`n4xG_p4P3X+ zRb3J0k2659ugVF3jbY3g*#hm^+qFWErnuOPd#1_kH{$GKT=$ySdOG<2GJTTZieX8- z?SgdRq&e6K0~#g8LaMO>bF{p3>QU`28P6mcPxd#h%a3HMTriHT*5N2RdHdrvo)Hl( z`U&a1G+qKp7@qqMO*C~Dy@6-;0(yrivn$>oJm|n&YNs2%lFk?#rUv7N=CbY!26_#` zOwy)}i?Rp4nN$r%&5zU9O^|X|`}0gh4dooTajuqYy@fN0lYu~6li4||>k%x%XO;xj z5hh>P?#m$1I$s2gk=e^$N7Mm%F()PB*mBjl8#GTm}V z$n>4H{Zn?>tRb54D4BSNiH}riISvV^~kJ4Oqi-Q}*uV!1arYe1u@i3%->Aj(r zIL(E2nn^nhc3)1$LG?M!Z0P!8{kc7jVZ|z31Z9vW;zWG03+NwSV4)_v?8U zWzJng#k|hYcWf&`>pXSb$1J+|*RC+y0H1PLZGt#e5IB@{-e@rJo$|6ec*b&%(FN6?k>rN1-Nr$ z4m|s8prjrxoFseZy3M8c%nY<;8djgwW?!ntbr_BuPh)z_r$EZ(kbFfHIe-m~a@%)q zLHUZt{_ImXka>hsv7(tXD6IvCnD*Y9=OgFxoLemASErKGmb*^Vr}f(jx0bPl+I)E& zdgR_RtTV3aL1y$Y0L5%R`aCZ_j3{hDnOKUvJ-^B&r*-n!H1{M-gxge|1@AvCd1;LQ z&gyHGB7uzB5-;A*PN28V&l6{zV&ytnvv49kQD;x-Jcw{TPutVpBdI*~r2kQt;9y9} zrm;uL{ueR+pCY~(GsbF5WOLs1yA+{d^Nmfm{aCu^(uKBHuPP3>NOHZQeGCtO_(B6)e%e38$iS+A2@EuwaM3TExzF}i&|u$ zKssx-vZFF{(!fLzv#fm`hUWZG5W_HwZrHcibZGYIaTr8bF#XA~Yf^ke%h&0u3Dx%! z^ibu!hA$rmFDYFLiIR1*I%r`O?aUXua(z?Y&59c);yYe5&auIz#2%m$bF*Hyeb18q z{s%|D-an(}lltLeI1PH%zkvDJwfC);yKU+wq>Y~}`Wh1~1YKy!?;AbZMc?c-xx!ID zGU@t4XMu&;EzIlDe3)0mJ*~+gZ-I|7lWVH7XtQ^*7s@OAG%rXhF&W2i7^~4ZIjANP z)iqZodK~wkV=H<3sb9XbJmqa^_fu6Md2TL+@V@LjyB!gdKL)fcuy|X!v>b{(24;h6 zJWY9Lv8*x1KY;xnwHPyvsDJ@ za=nD?=lf8HdL|ib^6{~*M~Z^@X6f4_vccD5U;FmpEMP#m#3a{Hv(qAR7jbY4j^jmY1_kGt2jCr9Hcns@ad#dkAiH(87OC%{OL&%A8E67dds4 zUUa(por`Wt!CH3Hh4y+T!9&*HuNopp&DuC!EBsu2>zv#{TDK;p*zGdw3Q}{Qa3l3P z;iD#9LF=sx7%v`;5kM(4uz1BHUXiwju?VgYWB8vDMa+TeebP^R`85D{{ zc$n4X&Z!+bAB>Phr{s{sU9$^T=t{2+HO8<@oNBifmQ0|Km;F^;iwj#gXkI1ur>(!Z zG@-if3==No%Idh?cck)-zRX2RqlFtoV`vrn=qyc?4xL}sirUxBJ4r!#F?aOvj)juB z%{tu=P8ttd5+4}c=Ud{6@wDYv&cB^kki63NIG@ATX%<^s?;CRDcEa1`cD0Wo0dd{Y z6qjdr3O;ft)T>4e(3iLm_u`QvGhKad%P9zU^Lh8<(*A{x4mEG2wo)t&m&#+lvgmgT zX=0eA>sxXaMJ9`9ydOiNS4<9P-1gH31Wp9bo%!tP$g@wsOnW*#!un#WK&N2z$F93% z)7XXFa=YT;W;+I0qF=FN_Dr$}{`Q67WG7Phqm*HvlkJb*IdK?p`G_u_U_TMccM}%Z z9o(j&Lzg2plsL#1uY|kR zlIJvxnYMIcl8WJUtLEWZ=Jc)J-!GUhx*adO`KdDYV3eE|sbm38a(2si#4)I#TQ{ zu?Gg4M4z6{uc>!WZ(Z|4?1_ml(CD!lWvQIf+81z4K0o}Pq{RyyL8J8^KU+axA#4qy zQ_Hf5_NC-tOOi9sMZFnv)U{y8i$_y>bVIjd zYdd_eZZ%qsKW*^;2wxh(DlFXEIM5O>17AA*?E6crapNmn`L!Jn>AqbENHS$!E&q-T zFo+4DLWSrzdaYa`rye_*o~K22kByy4JzG;|#gQ7C@QCI9JkMy#2(2Fr`Ks(a7O@xQ zvrGC5UmLAPFdMG#Z`W+kDtZAXOA0bEMIr=*Q!fa#N06YRqNk;z^4on3^%f>IEv8Vr zL60-Ew)rk(`mRiv3IpS4>4mi@^GxX`R5ew(n60W&Syt}_o>A)pgE5&E8 zx78ULi@iR42{_udvF!_&adC>f`(&?{`S`^G4hsg;xq4oViQ6kITte;T!WM@^_k;-B zLpb!avBKI!QgmoYY?o2a^F?+Z#*eEd9ik7<*Uqk8Z`^Mqt=+4+d1B;xTx-$WS;2+I zO|PLhqWk+I$Zt%YKlF@o9>2ARqq#A@Bb52^a#Z=0)&8LgZP% zvLw7M+CWwPCk1sR2eGG6T+wj2r>7^(lX?k3vV)7EP$)P82}dHKR0Ndl?LxtNL0!lK zI}|@SQ~@%ML~x}Lh%VqAPOJ^logxQ;Q0Kuv$*HqAH7~01XMmmYE64doj z0dOP&Ap=Dqp-2?`SAXg(2J^eO3;CytR6XHdSXa0h3;}m`{*wopqUP~Oyub7y8&U5O z;RXPi=uW}`Y94?KMc~(#>9W6^Y0Fj&pS3( z&1F|tv?>wjz7teSRSvR~FB(t85%B2UuQo^=N&+ci3&lwQc&G#dB?U#Ha9F4<9xr7h zBPD@Dps>GCX}ORoSQi|yLq#Qr5vV*UoEQ=zjTM7RN}ch1}Yr4mQkNTZ}}B%l(~;?mS?Yyqf^gft3@K-mCDtb{mq zUTl|YXCKf?dRlT2Bn~8 zNJ`0wBY$x>0Z3$OmG6*>Az;WKS>thNbt)y6T5SYptQ`P%b+Oy!-Psp3bv0CFu{+H{ zW!|+@7lT$I0ayx=WJDx7$w79K1@BPq_7qt5XSblw5^=kZyI=sn({MjqP8n+l-yO=r z{~h>Wm<;WSo-Y48oj67^y5TwBJ4^92JfB%Xe{oB{A8>LfZyE$s*XRVaQ0XiJAiuJ z{_M5i?1aClV_U2g4k1M?Txn@MwF0GZQcxRdF#w7}NFk8o(kPUK)Q?*Eot;dyrFddV zfRY`x2B`Z??XBH?2A}#-e!_oF#?v0ysVxLj42qC|iisN`#nA|Hw73Lyh(;hFKeik! z3*R|qe_OKb&N+m^pnnxbcITWzYwc8{p}VWA69FLoS*+iR=YPQc;{UTy|C9T#upizk zL|1QWC)-nWJzf57_`d-DU^q*_0WM_Xzf1jB$PZb5c^FZ1{$Zm&;FtHmOoy*0T=2& zf1cErYE6u!67_|g#zsd&6|{Xdx}%mlVs_OuBZEMDId(pKK*_0xsYXVM7DkP6jBXz- zEd)lyY5I@OKCuXih+u*QN7paQfUw6wG;XcaW~qWCo?T2*0>x(MuCfDKSAqe7lXsSc7qm4=p(o#F8`bgRO G%6|bpD&^7u literal 0 HcmV?d00001 diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/status.json b/BCStudentSoftwareDevTeam/celts/fixAdminLog/status.json new file mode 100644 index 000000000..74bdbcee3 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/status.json @@ -0,0 +1 @@ +{"format":2,"version":"7.2.5","globals":"678786941a460af8d13312bc8fc46102","files":{"d_5f5a17c013354698___init___py":{"hash":"5022ff5651d7ff1d339db3c4fccfe520","index":{"nums":[0,1,74,0,25,0,0,0],"html_filename":"d_5f5a17c013354698___init___py.html","relative_filename":"app/__init__.py"}},"d_2e3eaab626e4e78a___init___py":{"hash":"7c77fdb732ea0c5d6d7cb602afe10dd3","index":{"nums":[0,1,2,0,0,0,0,0],"html_filename":"d_2e3eaab626e4e78a___init___py.html","relative_filename":"app/controllers/__init__.py"}},"d_c86a23c356556db1___init___py":{"hash":"269f8b45622e27534190af4806a11f2d","index":{"nums":[0,1,5,0,0,0,0,0],"html_filename":"d_c86a23c356556db1___init___py.html","relative_filename":"app/controllers/admin/__init__.py"}},"d_c86a23c356556db1_routes_py":{"hash":"4d1e19981e3bdcfcc15fa164f4fe1136","index":{"nums":[0,1,308,0,229,0,0,0],"html_filename":"d_c86a23c356556db1_routes_py.html","relative_filename":"app/controllers/admin/routes.py"}},"d_c86a23c356556db1_userManagement_py":{"hash":"f17e98d6ff95f56c067fd79174a3052e","index":{"nums":[0,1,92,0,69,0,0,0],"html_filename":"d_c86a23c356556db1_userManagement_py.html","relative_filename":"app/controllers/admin/userManagement.py"}},"d_c86a23c356556db1_volunteers_py":{"hash":"563a017e6ed90e3defaccfe843086ab2","index":{"nums":[0,1,180,0,138,0,0,0],"html_filename":"d_c86a23c356556db1_volunteers_py.html","relative_filename":"app/controllers/admin/volunteers.py"}},"d_82713a9719f5b640___init___py":{"hash":"a45f55656148e38d16c8971b0a393e21","index":{"nums":[0,1,3,0,0,0,0,0],"html_filename":"d_82713a9719f5b640___init___py.html","relative_filename":"app/controllers/events/__init__.py"}},"d_82713a9719f5b640_email_py":{"hash":"57bb20a57a9abceb8f6d560c10c9be39","index":{"nums":[0,1,55,0,35,0,0,0],"html_filename":"d_82713a9719f5b640_email_py.html","relative_filename":"app/controllers/events/email.py"}},"d_82713a9719f5b640_routes_py":{"hash":"432d2a0252e44393e091bd2c2cae2dc8","index":{"nums":[0,1,36,0,20,0,0,0],"html_filename":"d_82713a9719f5b640_routes_py.html","relative_filename":"app/controllers/events/routes.py"}},"d_beb112d5d893d27f___init___py":{"hash":"b7002d7a773af2a9c17d45c450ec9810","index":{"nums":[0,1,3,0,0,0,0,0],"html_filename":"d_beb112d5d893d27f___init___py.html","relative_filename":"app/controllers/main/__init__.py"}},"d_beb112d5d893d27f_routes_py":{"hash":"14d29112a51b7a510a70751ab767303f","index":{"nums":[0,1,306,0,227,0,0,0],"html_filename":"d_beb112d5d893d27f_routes_py.html","relative_filename":"app/controllers/main/routes.py"}},"d_0e098e07e81a8f2f___init___py":{"hash":"d64ba0bc0a4d896ae9413f4c22f044c1","index":{"nums":[0,1,3,0,0,0,0,0],"html_filename":"d_0e098e07e81a8f2f___init___py.html","relative_filename":"app/controllers/serviceLearning/__init__.py"}},"d_0e098e07e81a8f2f_routes_py":{"hash":"ad7b7e75e91cc40cb701cf54f4169f3c","index":{"nums":[0,1,194,0,141,0,0,0],"html_filename":"d_0e098e07e81a8f2f_routes_py.html","relative_filename":"app/controllers/serviceLearning/routes.py"}},"d_074bda25efadd8bd_bonner_py":{"hash":"871c94c4bfcff2eee8a6d550d62fd27c","index":{"nums":[0,1,47,0,26,0,0,0],"html_filename":"d_074bda25efadd8bd_bonner_py.html","relative_filename":"app/logic/bonner.py"}},"d_074bda25efadd8bd_certification_py":{"hash":"65f81ab9a9c86cf4ee5a7486a3d83a60","index":{"nums":[0,1,49,0,0,0,0,0],"html_filename":"d_074bda25efadd8bd_certification_py.html","relative_filename":"app/logic/certification.py"}},"d_074bda25efadd8bd_config_py":{"hash":"129630abaf6b5bda1df31510fd716bbb","index":{"nums":[0,1,23,0,2,0,0,0],"html_filename":"d_074bda25efadd8bd_config_py.html","relative_filename":"app/logic/config.py"}},"d_074bda25efadd8bd_courseManagement_py":{"hash":"50e8307f050c6082fe5635d5d0afd784","index":{"nums":[0,1,47,0,10,0,0,0],"html_filename":"d_074bda25efadd8bd_courseManagement_py.html","relative_filename":"app/logic/courseManagement.py"}},"d_074bda25efadd8bd_createLogs_py":{"hash":"8ab519bf0fd47667227b19a7493132a4","index":{"nums":[0,1,10,0,0,0,0,0],"html_filename":"d_074bda25efadd8bd_createLogs_py.html","relative_filename":"app/logic/createLogs.py"}},"d_074bda25efadd8bd_downloadFile_py":{"hash":"b6a74aa09eb8fac95a50024a07ebf529","index":{"nums":[0,1,27,0,2,0,0,0],"html_filename":"d_074bda25efadd8bd_downloadFile_py.html","relative_filename":"app/logic/downloadFile.py"}},"d_074bda25efadd8bd_emailHandler_py":{"hash":"8c9926180482b415086588da2e455327","index":{"nums":[0,1,166,0,30,0,0,0],"html_filename":"d_074bda25efadd8bd_emailHandler_py.html","relative_filename":"app/logic/emailHandler.py"}},"d_074bda25efadd8bd_events_py":{"hash":"4b468ec164463b0a27583b60f4630eed","index":{"nums":[0,1,231,0,18,0,0,0],"html_filename":"d_074bda25efadd8bd_events_py.html","relative_filename":"app/logic/events.py"}},"d_074bda25efadd8bd_fileHandler_py":{"hash":"693f2941702b779174f7a9446fb22385","index":{"nums":[0,1,62,0,8,0,0,0],"html_filename":"d_074bda25efadd8bd_fileHandler_py.html","relative_filename":"app/logic/fileHandler.py"}},"d_074bda25efadd8bd_landingPage_py":{"hash":"b2ccee2e88ceb36519216df0ea7fcdba","index":{"nums":[0,1,30,0,2,0,0,0],"html_filename":"d_074bda25efadd8bd_landingPage_py.html","relative_filename":"app/logic/landingPage.py"}},"d_074bda25efadd8bd_loginManager_py":{"hash":"d9b8ecaec98d749bd0b4858c4c427c93","index":{"nums":[0,1,36,0,27,0,0,0],"html_filename":"d_074bda25efadd8bd_loginManager_py.html","relative_filename":"app/logic/loginManager.py"}},"d_074bda25efadd8bd_manageSLFaculty_py":{"hash":"154f09f87269e74ba2a5d4ac48673db1","index":{"nums":[0,1,11,0,0,0,0,0],"html_filename":"d_074bda25efadd8bd_manageSLFaculty_py.html","relative_filename":"app/logic/manageSLFaculty.py"}},"d_074bda25efadd8bd_participants_py":{"hash":"a652144e99c0f0eb70ff3f27aefeb7bb","index":{"nums":[0,1,91,0,10,0,0,0],"html_filename":"d_074bda25efadd8bd_participants_py.html","relative_filename":"app/logic/participants.py"}},"d_074bda25efadd8bd_searchUsers_py":{"hash":"2788e565b1e6034d688d597cc04594dd","index":{"nums":[0,1,20,0,0,0,0,0],"html_filename":"d_074bda25efadd8bd_searchUsers_py.html","relative_filename":"app/logic/searchUsers.py"}},"d_074bda25efadd8bd_serviceLearningCoursesData_py":{"hash":"a7455efa48f115906839f37d0193c77e","index":{"nums":[0,1,130,0,18,0,0,0],"html_filename":"d_074bda25efadd8bd_serviceLearningCoursesData_py.html","relative_filename":"app/logic/serviceLearningCoursesData.py"}},"d_074bda25efadd8bd_term_py":{"hash":"a98d45109326662f224530d097788489","index":{"nums":[0,1,43,0,11,0,0,0],"html_filename":"d_074bda25efadd8bd_term_py.html","relative_filename":"app/logic/term.py"}},"d_074bda25efadd8bd_transcript_py":{"hash":"a5298622b0e4e27a5256e9f4c991442f","index":{"nums":[0,1,30,0,1,0,0,0],"html_filename":"d_074bda25efadd8bd_transcript_py.html","relative_filename":"app/logic/transcript.py"}},"d_074bda25efadd8bd_userManagement_py":{"hash":"c12a529f8885102840e120390c2db8a0","index":{"nums":[0,1,49,0,0,0,0,0],"html_filename":"d_074bda25efadd8bd_userManagement_py.html","relative_filename":"app/logic/userManagement.py"}},"d_074bda25efadd8bd_users_py":{"hash":"586d9b5670b7b279f2b8277915d8cf80","index":{"nums":[0,1,56,0,0,0,0,0],"html_filename":"d_074bda25efadd8bd_users_py.html","relative_filename":"app/logic/users.py"}},"d_074bda25efadd8bd_utils_py":{"hash":"d6fd3e7c79235f30beed364d5a82a15b","index":{"nums":[0,1,41,0,17,0,0,0],"html_filename":"d_074bda25efadd8bd_utils_py.html","relative_filename":"app/logic/utils.py"}},"d_074bda25efadd8bd_volunteers_py":{"hash":"2c76f6d400459293a3cc1d48b520b761","index":{"nums":[0,1,55,0,8,0,0,0],"html_filename":"d_074bda25efadd8bd_volunteers_py.html","relative_filename":"app/logic/volunteers.py"}},"d_6c0e4b930745278b___init___py":{"hash":"1d17ca71cee18ac8b8847b8d5a6ee052","index":{"nums":[0,1,14,0,1,0,0,0],"html_filename":"d_6c0e4b930745278b___init___py.html","relative_filename":"app/models/__init__.py"}},"d_6c0e4b930745278b_adminLog_py":{"hash":"593d10c5521e268ca6c53fb3783fc201","index":{"nums":[0,1,6,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_adminLog_py.html","relative_filename":"app/models/adminLog.py"}},"d_6c0e4b930745278b_attachmentUpload_py":{"hash":"bbde79f04f57723a0475c02a9217e779","index":{"nums":[0,1,7,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_attachmentUpload_py.html","relative_filename":"app/models/attachmentUpload.py"}},"d_6c0e4b930745278b_backgroundCheck_py":{"hash":"7f4ce0b66d3be917596b8645cf01613e","index":{"nums":[0,1,8,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_backgroundCheck_py.html","relative_filename":"app/models/backgroundCheck.py"}},"d_6c0e4b930745278b_backgroundCheckType_py":{"hash":"e011edea3f6f20d6f803e35dcf218f05","index":{"nums":[0,1,4,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_backgroundCheckType_py.html","relative_filename":"app/models/backgroundCheckType.py"}},"d_6c0e4b930745278b_bonnerCohort_py":{"hash":"f2980e387d84cd60bbf4a7609e928afc","index":{"nums":[0,1,7,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_bonnerCohort_py.html","relative_filename":"app/models/bonnerCohort.py"}},"d_6c0e4b930745278b_certification_py":{"hash":"0b3a5b1ddf29d1666440fb63814d49dc","index":{"nums":[0,1,7,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_certification_py.html","relative_filename":"app/models/certification.py"}},"d_6c0e4b930745278b_certificationRequirement_py":{"hash":"05d273686b356cb89e848e0309c36f0c","index":{"nums":[0,1,8,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_certificationRequirement_py.html","relative_filename":"app/models/certificationRequirement.py"}},"d_6c0e4b930745278b_course_py":{"hash":"96bee6978f3fe59e4bc0d64cddadd1f2","index":{"nums":[0,1,20,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_course_py.html","relative_filename":"app/models/course.py"}},"d_6c0e4b930745278b_courseInstructor_py":{"hash":"136c313f444d02255c77453e1047b284","index":{"nums":[0,1,6,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_courseInstructor_py.html","relative_filename":"app/models/courseInstructor.py"}},"d_6c0e4b930745278b_courseParticipant_py":{"hash":"48720748ec6d58e180563ee4d31be878","index":{"nums":[0,1,7,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_courseParticipant_py.html","relative_filename":"app/models/courseParticipant.py"}},"d_6c0e4b930745278b_courseQuestion_py":{"hash":"787a4ac2f5706d23a0b4302f5ecf0033","index":{"nums":[0,1,6,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_courseQuestion_py.html","relative_filename":"app/models/courseQuestion.py"}},"d_6c0e4b930745278b_courseStatus_py":{"hash":"c8624272b1643063e9470c472ebe5e96","index":{"nums":[0,1,7,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_courseStatus_py.html","relative_filename":"app/models/courseStatus.py"}},"d_6c0e4b930745278b_emailLog_py":{"hash":"c83b33470537e8f00279bf2adeef356f","index":{"nums":[0,1,13,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_emailLog_py.html","relative_filename":"app/models/emailLog.py"}},"d_6c0e4b930745278b_emailTemplate_py":{"hash":"ab497917acf91049fd5fc3d0aaff2a61","index":{"nums":[0,1,7,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_emailTemplate_py.html","relative_filename":"app/models/emailTemplate.py"}},"d_6c0e4b930745278b_emergencyContact_py":{"hash":"697eec96e4dcfdb1832f2618dbac6d2a","index":{"nums":[0,1,11,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_emergencyContact_py.html","relative_filename":"app/models/emergencyContact.py"}},"d_6c0e4b930745278b_event_py":{"hash":"b91f719a1fa923e78fa4aac519e1489b","index":{"nums":[0,1,56,0,8,0,0,0],"html_filename":"d_6c0e4b930745278b_event_py.html","relative_filename":"app/models/event.py"}},"d_6c0e4b930745278b_eventParticipant_py":{"hash":"8073cbbca9394196e09c5f7cd745fdeb","index":{"nums":[0,1,10,0,1,0,0,0],"html_filename":"d_6c0e4b930745278b_eventParticipant_py.html","relative_filename":"app/models/eventParticipant.py"}},"d_6c0e4b930745278b_eventRsvp_py":{"hash":"1a404ee3aae9f4b05d115368f0f9b603","index":{"nums":[0,1,11,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_eventRsvp_py.html","relative_filename":"app/models/eventRsvp.py"}},"d_6c0e4b930745278b_eventRsvpLog_py":{"hash":"c82a3ea5674aafa7756743349b365450","index":{"nums":[0,1,8,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_eventRsvpLog_py.html","relative_filename":"app/models/eventRsvpLog.py"}},"d_6c0e4b930745278b_eventTemplate_py":{"hash":"e323df877431437af235981ea89eb699","index":{"nums":[0,1,16,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_eventTemplate_py.html","relative_filename":"app/models/eventTemplate.py"}},"d_6c0e4b930745278b_eventViews_py":{"hash":"4590690f692d268224cfe60617143474","index":{"nums":[0,1,8,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_eventViews_py.html","relative_filename":"app/models/eventViews.py"}},"d_6c0e4b930745278b_insuranceInfo_py":{"hash":"e19a390348aa1581548c111e27d5ba49","index":{"nums":[0,1,11,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_insuranceInfo_py.html","relative_filename":"app/models/insuranceInfo.py"}},"d_6c0e4b930745278b_interest_py":{"hash":"c6234a9eb9706553c555e2237c5c66be","index":{"nums":[0,1,6,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_interest_py.html","relative_filename":"app/models/interest.py"}},"d_6c0e4b930745278b_note_py":{"hash":"595aa06f7d815105a0eb02a2c44548cf","index":{"nums":[0,1,8,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_note_py.html","relative_filename":"app/models/note.py"}},"d_6c0e4b930745278b_partner_py":{"hash":"4bfe619a9b0e982e9204596ed18311c4","index":{"nums":[0,1,3,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_partner_py.html","relative_filename":"app/models/partner.py"}},"d_6c0e4b930745278b_profileNote_py":{"hash":"703a04abc9b2fd32362062ff570c984f","index":{"nums":[0,1,8,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_profileNote_py.html","relative_filename":"app/models/profileNote.py"}},"d_6c0e4b930745278b_program_py":{"hash":"e305c77beaa7fb5f156d3ee58375d419","index":{"nums":[0,1,21,0,2,0,0,0],"html_filename":"d_6c0e4b930745278b_program_py.html","relative_filename":"app/models/program.py"}},"d_6c0e4b930745278b_programBan_py":{"hash":"668279739fbb6c7a2213cfdc03780589","index":{"nums":[0,1,10,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_programBan_py.html","relative_filename":"app/models/programBan.py"}},"d_6c0e4b930745278b_programManager_py":{"hash":"7fc7249b6959b5aaa9938fb1b2a5e0e1","index":{"nums":[0,1,6,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_programManager_py.html","relative_filename":"app/models/programManager.py"}},"d_6c0e4b930745278b_questionNote_py":{"hash":"eb8fd352785fe0fc89187175f2b3a15b","index":{"nums":[0,1,6,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_questionNote_py.html","relative_filename":"app/models/questionNote.py"}},"d_6c0e4b930745278b_requirementMatch_py":{"hash":"6713af28dca45ef3dcdbadbf619d8902","index":{"nums":[0,1,8,0,0,0,0,0],"html_filename":"d_6c0e4b930745278b_requirementMatch_py.html","relative_filename":"app/models/requirementMatch.py"}},"d_6c0e4b930745278b_term_py":{"hash":"5276b15487708b7997bab4ed2793a761","index":{"nums":[0,1,45,0,3,0,0,0],"html_filename":"d_6c0e4b930745278b_term_py.html","relative_filename":"app/models/term.py"}},"d_6c0e4b930745278b_user_py":{"hash":"83599da97488c6b7e26ad7f8c49e26e4","index":{"nums":[0,1,49,0,1,0,0,0],"html_filename":"d_6c0e4b930745278b_user_py.html","relative_filename":"app/models/user.py"}},"d_122d09e411690e95_send_event_reminder_emails_py":{"hash":"1ea9ea701deb36b54d4f5bc19a3fdaa8","index":{"nums":[0,1,33,0,3,0,0,0],"html_filename":"d_122d09e411690e95_send_event_reminder_emails_py.html","relative_filename":"app/scripts/send_event_reminder_emails.py"}}}} \ No newline at end of file diff --git a/BCStudentSoftwareDevTeam/celts/fixAdminLog/style.css b/BCStudentSoftwareDevTeam/celts/fixAdminLog/style.css new file mode 100644 index 000000000..11b24c4e7 --- /dev/null +++ b/BCStudentSoftwareDevTeam/celts/fixAdminLog/style.css @@ -0,0 +1,309 @@ +@charset "UTF-8"; +/* Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 */ +/* For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt */ +/* Don't edit this .css file. Edit the .scss file instead! */ +html, body, h1, h2, h3, p, table, td, th { margin: 0; padding: 0; border: 0; font-weight: inherit; font-style: inherit; font-size: 100%; font-family: inherit; vertical-align: baseline; } + +body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; font-size: 1em; background: #fff; color: #000; } + +@media (prefers-color-scheme: dark) { body { background: #1e1e1e; } } + +@media (prefers-color-scheme: dark) { body { color: #eee; } } + +html > body { font-size: 16px; } + +a:active, a:focus { outline: 2px dashed #007acc; } + +p { font-size: .875em; line-height: 1.4em; } + +table { border-collapse: collapse; } + +td { vertical-align: top; } + +table tr.hidden { display: none !important; } + +p#no_rows { display: none; font-size: 1.2em; } + +a.nav { text-decoration: none; color: inherit; } + +a.nav:hover { text-decoration: underline; color: inherit; } + +.hidden { display: none; } + +header { background: #f8f8f8; width: 100%; z-index: 2; border-bottom: 1px solid #ccc; } + +@media (prefers-color-scheme: dark) { header { background: black; } } + +@media (prefers-color-scheme: dark) { header { border-color: #333; } } + +header .content { padding: 1rem 3.5rem; } + +header h2 { margin-top: .5em; font-size: 1em; } + +header p.text { margin: .5em 0 -.5em; color: #666; font-style: italic; } + +@media (prefers-color-scheme: dark) { header p.text { color: #aaa; } } + +header.sticky { position: fixed; left: 0; right: 0; height: 2.5em; } + +header.sticky .text { display: none; } + +header.sticky h1, header.sticky h2 { font-size: 1em; margin-top: 0; display: inline-block; } + +header.sticky .content { padding: 0.5rem 3.5rem; } + +header.sticky .content p { font-size: 1em; } + +header.sticky ~ #source { padding-top: 6.5em; } + +main { position: relative; z-index: 1; } + +footer { margin: 1rem 3.5rem; } + +footer .content { padding: 0; color: #666; font-style: italic; } + +@media (prefers-color-scheme: dark) { footer .content { color: #aaa; } } + +#index { margin: 1rem 0 0 3.5rem; } + +h1 { font-size: 1.25em; display: inline-block; } + +#filter_container { float: right; margin: 0 2em 0 0; } + +#filter_container input { width: 10em; padding: 0.2em 0.5em; border: 2px solid #ccc; background: #fff; color: #000; } + +@media (prefers-color-scheme: dark) { #filter_container input { border-color: #444; } } + +@media (prefers-color-scheme: dark) { #filter_container input { background: #1e1e1e; } } + +@media (prefers-color-scheme: dark) { #filter_container input { color: #eee; } } + +#filter_container input:focus { border-color: #007acc; } + +header button { font-family: inherit; font-size: inherit; border: 1px solid; border-radius: .2em; color: inherit; padding: .1em .5em; margin: 1px calc(.1em + 1px); cursor: pointer; border-color: #ccc; } + +@media (prefers-color-scheme: dark) { header button { border-color: #444; } } + +header button:active, header button:focus { outline: 2px dashed #007acc; } + +header button.run { background: #eeffee; } + +@media (prefers-color-scheme: dark) { header button.run { background: #373d29; } } + +header button.run.show_run { background: #dfd; border: 2px solid #00dd00; margin: 0 .1em; } + +@media (prefers-color-scheme: dark) { header button.run.show_run { background: #373d29; } } + +header button.mis { background: #ffeeee; } + +@media (prefers-color-scheme: dark) { header button.mis { background: #4b1818; } } + +header button.mis.show_mis { background: #fdd; border: 2px solid #ff0000; margin: 0 .1em; } + +@media (prefers-color-scheme: dark) { header button.mis.show_mis { background: #4b1818; } } + +header button.exc { background: #f7f7f7; } + +@media (prefers-color-scheme: dark) { header button.exc { background: #333; } } + +header button.exc.show_exc { background: #eee; border: 2px solid #808080; margin: 0 .1em; } + +@media (prefers-color-scheme: dark) { header button.exc.show_exc { background: #333; } } + +header button.par { background: #ffffd5; } + +@media (prefers-color-scheme: dark) { header button.par { background: #650; } } + +header button.par.show_par { background: #ffa; border: 2px solid #bbbb00; margin: 0 .1em; } + +@media (prefers-color-scheme: dark) { header button.par.show_par { background: #650; } } + +#help_panel, #source p .annotate.long { display: none; position: absolute; z-index: 999; background: #ffffcc; border: 1px solid #888; border-radius: .2em; color: #333; padding: .25em .5em; } + +#source p .annotate.long { white-space: normal; float: right; top: 1.75em; right: 1em; height: auto; } + +#help_panel_wrapper { float: right; position: relative; } + +#keyboard_icon { margin: 5px; } + +#help_panel_state { display: none; } + +#help_panel { top: 25px; right: 0; padding: .75em; border: 1px solid #883; color: #333; } + +#help_panel .keyhelp p { margin-top: .75em; } + +#help_panel .legend { font-style: italic; margin-bottom: 1em; } + +.indexfile #help_panel { width: 25em; } + +.pyfile #help_panel { width: 18em; } + +#help_panel_state:checked ~ #help_panel { display: block; } + +kbd { border: 1px solid black; border-color: #888 #333 #333 #888; padding: .1em .35em; font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-weight: bold; background: #eee; border-radius: 3px; } + +#source { padding: 1em 0 1em 3.5rem; font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; } + +#source p { position: relative; white-space: pre; } + +#source p * { box-sizing: border-box; } + +#source p .n { float: left; text-align: right; width: 3.5rem; box-sizing: border-box; margin-left: -3.5rem; padding-right: 1em; color: #999; } + +@media (prefers-color-scheme: dark) { #source p .n { color: #777; } } + +#source p .n.highlight { background: #ffdd00; } + +#source p .n a { margin-top: -4em; padding-top: 4em; text-decoration: none; color: #999; } + +@media (prefers-color-scheme: dark) { #source p .n a { color: #777; } } + +#source p .n a:hover { text-decoration: underline; color: #999; } + +@media (prefers-color-scheme: dark) { #source p .n a:hover { color: #777; } } + +#source p .t { display: inline-block; width: 100%; box-sizing: border-box; margin-left: -.5em; padding-left: 0.3em; border-left: 0.2em solid #fff; } + +@media (prefers-color-scheme: dark) { #source p .t { border-color: #1e1e1e; } } + +#source p .t:hover { background: #f2f2f2; } + +@media (prefers-color-scheme: dark) { #source p .t:hover { background: #282828; } } + +#source p .t:hover ~ .r .annotate.long { display: block; } + +#source p .t .com { color: #008000; font-style: italic; line-height: 1px; } + +@media (prefers-color-scheme: dark) { #source p .t .com { color: #6a9955; } } + +#source p .t .key { font-weight: bold; line-height: 1px; } + +#source p .t .str { color: #0451a5; } + +@media (prefers-color-scheme: dark) { #source p .t .str { color: #9cdcfe; } } + +#source p.mis .t { border-left: 0.2em solid #ff0000; } + +#source p.mis.show_mis .t { background: #fdd; } + +@media (prefers-color-scheme: dark) { #source p.mis.show_mis .t { background: #4b1818; } } + +#source p.mis.show_mis .t:hover { background: #f2d2d2; } + +@media (prefers-color-scheme: dark) { #source p.mis.show_mis .t:hover { background: #532323; } } + +#source p.run .t { border-left: 0.2em solid #00dd00; } + +#source p.run.show_run .t { background: #dfd; } + +@media (prefers-color-scheme: dark) { #source p.run.show_run .t { background: #373d29; } } + +#source p.run.show_run .t:hover { background: #d2f2d2; } + +@media (prefers-color-scheme: dark) { #source p.run.show_run .t:hover { background: #404633; } } + +#source p.exc .t { border-left: 0.2em solid #808080; } + +#source p.exc.show_exc .t { background: #eee; } + +@media (prefers-color-scheme: dark) { #source p.exc.show_exc .t { background: #333; } } + +#source p.exc.show_exc .t:hover { background: #e2e2e2; } + +@media (prefers-color-scheme: dark) { #source p.exc.show_exc .t:hover { background: #3c3c3c; } } + +#source p.par .t { border-left: 0.2em solid #bbbb00; } + +#source p.par.show_par .t { background: #ffa; } + +@media (prefers-color-scheme: dark) { #source p.par.show_par .t { background: #650; } } + +#source p.par.show_par .t:hover { background: #f2f2a2; } + +@media (prefers-color-scheme: dark) { #source p.par.show_par .t:hover { background: #6d5d0c; } } + +#source p .r { position: absolute; top: 0; right: 2.5em; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; } + +#source p .annotate { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; color: #666; padding-right: .5em; } + +@media (prefers-color-scheme: dark) { #source p .annotate { color: #ddd; } } + +#source p .annotate.short:hover ~ .long { display: block; } + +#source p .annotate.long { width: 30em; right: 2.5em; } + +#source p input { display: none; } + +#source p input ~ .r label.ctx { cursor: pointer; border-radius: .25em; } + +#source p input ~ .r label.ctx::before { content: "▶ "; } + +#source p input ~ .r label.ctx:hover { background: #e8f4ff; color: #666; } + +@media (prefers-color-scheme: dark) { #source p input ~ .r label.ctx:hover { background: #0f3a42; } } + +@media (prefers-color-scheme: dark) { #source p input ~ .r label.ctx:hover { color: #aaa; } } + +#source p input:checked ~ .r label.ctx { background: #d0e8ff; color: #666; border-radius: .75em .75em 0 0; padding: 0 .5em; margin: -.25em 0; } + +@media (prefers-color-scheme: dark) { #source p input:checked ~ .r label.ctx { background: #056; } } + +@media (prefers-color-scheme: dark) { #source p input:checked ~ .r label.ctx { color: #aaa; } } + +#source p input:checked ~ .r label.ctx::before { content: "▼ "; } + +#source p input:checked ~ .ctxs { padding: .25em .5em; overflow-y: scroll; max-height: 10.5em; } + +#source p label.ctx { color: #999; display: inline-block; padding: 0 .5em; font-size: .8333em; } + +@media (prefers-color-scheme: dark) { #source p label.ctx { color: #777; } } + +#source p .ctxs { display: block; max-height: 0; overflow-y: hidden; transition: all .2s; padding: 0 .5em; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; white-space: nowrap; background: #d0e8ff; border-radius: .25em; margin-right: 1.75em; text-align: right; } + +@media (prefers-color-scheme: dark) { #source p .ctxs { background: #056; } } + +#index { font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.875em; } + +#index table.index { margin-left: -.5em; } + +#index td, #index th { text-align: right; width: 5em; padding: .25em .5em; border-bottom: 1px solid #eee; } + +@media (prefers-color-scheme: dark) { #index td, #index th { border-color: #333; } } + +#index td.name, #index th.name { text-align: left; width: auto; } + +#index th { font-style: italic; color: #333; cursor: pointer; } + +@media (prefers-color-scheme: dark) { #index th { color: #ddd; } } + +#index th:hover { background: #eee; } + +@media (prefers-color-scheme: dark) { #index th:hover { background: #333; } } + +#index th[aria-sort="ascending"], #index th[aria-sort="descending"] { white-space: nowrap; background: #eee; padding-left: .5em; } + +@media (prefers-color-scheme: dark) { #index th[aria-sort="ascending"], #index th[aria-sort="descending"] { background: #333; } } + +#index th[aria-sort="ascending"]::after { font-family: sans-serif; content: " ↑"; } + +#index th[aria-sort="descending"]::after { font-family: sans-serif; content: " ↓"; } + +#index td.name a { text-decoration: none; color: inherit; } + +#index tr.total td, #index tr.total_dynamic td { font-weight: bold; border-top: 1px solid #ccc; border-bottom: none; } + +#index tr.file:hover { background: #eee; } + +@media (prefers-color-scheme: dark) { #index tr.file:hover { background: #333; } } + +#index tr.file:hover td.name { text-decoration: underline; color: inherit; } + +#scroll_marker { position: fixed; z-index: 3; right: 0; top: 0; width: 16px; height: 100%; background: #fff; border-left: 1px solid #eee; will-change: transform; } + +@media (prefers-color-scheme: dark) { #scroll_marker { background: #1e1e1e; } } + +@media (prefers-color-scheme: dark) { #scroll_marker { border-color: #333; } } + +#scroll_marker .marker { background: #ccc; position: absolute; min-height: 3px; width: 100%; } + +@media (prefers-color-scheme: dark) { #scroll_marker .marker { background: #444; } }