2020-07-18 04:10:49 +00:00
|
|
|
var total_points = 0;
|
|
|
|
var total_votes = 0;
|
|
|
|
var percentage = 0;
|
|
|
|
var rounded_percentage = 0;
|
|
|
|
var application_type = "super";
|
|
|
|
var approved = false;
|
|
|
|
|
2020-08-02 23:06:29 +00:00
|
|
|
function submit_vote(points) {
|
2020-07-18 04:10:49 +00:00
|
|
|
total_points += points;
|
|
|
|
total_votes++;
|
|
|
|
percentage = (total_points / total_votes) * 100;
|
|
|
|
rounded_percentage = Math.round(percentage);
|
|
|
|
update_score();
|
|
|
|
}
|
|
|
|
|
2020-08-02 23:06:29 +00:00
|
|
|
function update_score() {
|
2020-07-18 04:10:49 +00:00
|
|
|
document.getElementById("points").innerHTML = total_points;
|
|
|
|
document.getElementById("total_votes").innerHTML = total_votes;
|
|
|
|
document.getElementById("rounded_percentage").innerHTML = rounded_percentage;
|
|
|
|
document.getElementById("percentage").innerHTML = percentage;
|
|
|
|
application_type = document.getElementById("type").value;
|
2020-08-02 23:06:29 +00:00
|
|
|
|
|
|
|
if (application_type == "super" && rounded_percentage >= 60) {
|
2020-07-18 04:10:49 +00:00
|
|
|
approved = true;
|
2020-08-02 23:06:29 +00:00
|
|
|
} else if (application_type == "telnet" && rounded_percentage >= 65) {
|
2020-07-18 04:10:49 +00:00
|
|
|
approved = true;
|
2020-08-02 23:06:29 +00:00
|
|
|
} else if (application_type == "senior" && rounded_percentage >= 70) {
|
2020-07-18 04:10:49 +00:00
|
|
|
approved = true;
|
2020-08-02 23:06:29 +00:00
|
|
|
} else {
|
2020-07-18 04:10:49 +00:00
|
|
|
approved = false;
|
|
|
|
}
|
2020-08-02 23:06:29 +00:00
|
|
|
|
|
|
|
if (approved) {
|
2020-07-18 04:10:49 +00:00
|
|
|
document.getElementById("status").style = "color: #0f0;";
|
|
|
|
document.getElementById("status").innerHTML = "Accepted";
|
2020-08-02 23:06:29 +00:00
|
|
|
} else {
|
2020-07-18 04:10:49 +00:00
|
|
|
document.getElementById("status").style = "color: #f00;";
|
|
|
|
document.getElementById("status").innerHTML = "Denied";
|
|
|
|
}
|
|
|
|
}
|