Last active
December 5, 2019 12:29
-
-
Save ChlodAlejandro/bb2f3c85183e396875a62ea3b53e2ffc to your computer and use it in GitHub Desktop.
A way to automatically rate teachers and staff on the DBServer.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
================= [HOW TO USE] ================= | |
0. Obviously, go to the DBServer and login. | |
1. Open your Inspector using Ctrl + Shift + I | |
2. Open the "Console" tab in the inspector. | |
3. Copy all of the code in the bottom document. | |
4. Paste it in the input box of the console. | |
5. Run the code by pressing Enter (at the bottom | |
of the page) | |
6. There will now be two buttons on the footer. | |
7. Open a teacher/staff's evaluation form. | |
8. Press their respective button and answer. | |
9. Use wisely. | |
**/ | |
function fillAllRadiosTeacher(level) { | |
$("table.evaluation input[value=\"" + level + "\"").each((i, element) => { | |
element.checked = true; | |
}); | |
} | |
function fillAllRadiosSSD(level) { | |
$("table.inner input[value=\"" + level + "\"").each((i, element) => { | |
element.checked = true; | |
}); | |
} | |
function dbEvaluate(mode) { | |
if ($("#view_form").length === 0 || $("#view_form").html().trim() === "") { | |
alert("It looks like this page is not an open evaluation page. Please open a " + (mode === "SSD" ? "staff" : "faculty") + "'s evaluation page before pressing the button."); | |
return; | |
} | |
var level; | |
do { | |
var givenLevel = prompt("Indicate the level of all the radios (1 to 5)"); | |
if (givenLevel === undefined || givenLevel === null) return; | |
console.log(+(givenLevel) !== undefined); | |
console.log(!isNaN(givenLevel)); | |
console.log(+(givenLevel) > 0); | |
console.log(+(givenLevel) < 6); | |
if (+(givenLevel) !== undefined && !isNaN(givenLevel) && +(givenLevel) > 0 && +(givenLevel) < 6) { | |
level = givenLevel; | |
break; | |
} else alert("Please enter a number from 1 to 5 only."); | |
} while (+(level) === undefined || isNaN(level) || +(level) < 1 || +(level) > 5); | |
if (mode !== "SSD") fillAllRadiosTeacher(level); | |
else fillAllRadiosSSD(level); | |
var submitNow = confirm("Would you like to submit the evaluation now? \n\nIf you still want to write " | |
+ (mode === "SSD" ? "their strengths, weaknesses and comments" : "your suggestions") | |
+ ", please cancel now."); | |
if (submitNow) { | |
if (mode === "SSD") { | |
$("#weakness").val(" "); | |
$("#strength").val(" "); | |
$("#comment").val(" "); | |
} else { | |
$("#suggestion").val(" "); | |
} | |
$("#submit").trigger("click"); | |
} | |
} | |
(() => { | |
$("#footer .footer").html("<button onclick=\"dbEvaluate('CID')\" style=\"padding: 4px\">Auto-Evaluate Teacher</button>" + | |
"<button onclick=\"dbEvaluate('SSD')\" style=\"padding: 4px\">Auto-Evaluate SSD</button>"); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment