Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPORT-604: Add debtor badge for student evaluation teacher modal #287

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions adminpage/sport/static/sport/js/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,19 @@ function add_student_row(
email,
med_group,
hours,
maxHours
maxHours,
is_debtor
) {
const row = $(`<tr id="student_${student_id}">
<td class="trainer-table-width show-name-in-trainer-table" onclick="show_email_hide_name()">${full_name}
${
med_group === 'Special 1'
? `<span class="badge badge-pill badge-danger text-uppercase">${med_group}</span>`
? `<span class="badge badge-pill badge-success text-uppercase">${med_group}</span>`
: ''
}
${
is_debtor
? `<span class="badge badge-pill badge-danger">DEBTOR</span>`
: ''
}
</td>
Expand Down Expand Up @@ -352,14 +358,15 @@ function make_grades_table(grades, maxHours) {
'<th scope="col" class="trainer-table-width show-name-in-trainer-table">Student</th><th scope="col" class="trainer-table-width hide-email-in-trainer-table">Email</th><th scope="col" class="hours-in-trainer-table-right">Hours</th>'
);
student_hours_tbody = table.append('<tbody>').children('tbody');
grades.forEach(({ student_id, full_name, email, med_group, hours }) => {
grades.forEach(({ student_id, full_name, email, med_group, hours, is_debtor }) => {
add_student_row(
student_id,
full_name,
email,
med_group,
hours,
maxHours
maxHours,
is_debtor
);
});
return table;
Expand Down Expand Up @@ -488,7 +495,7 @@ document.addEventListener('DOMContentLoaded', function () {
});

function parse_student_from_server(data, h = 0) {
const [student_id, full_name, email, med_group] = data.split('_');
const [student_id, full_name, email, med_group, is_debtor] = data.split('_');
const hours = h;
const student_row = students_in_table[student_id];
if (student_row == null) {
Expand All @@ -500,7 +507,8 @@ function parse_student_from_server(data, h = 0) {
email,
med_group,
hours,
maxHours
maxHours,
is_debtor
); // add if student isn't present
local_hours_changes[student_id] = hours;
} else {
Expand Down