Skip to content

Commit

Permalink
synthetic assignments don't show statistics anymore
Browse files Browse the repository at this point in the history
fixed how synthetic assignments show statistics.
  • Loading branch information
andOrlando committed Oct 24, 2020
1 parent f1f73fc commit a355470
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions public/js/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ let currentTableData = tableData[currentTableDataIndex];
let selected_class_i;
let termsReset = {};

//variable for the number of synthetic assignments at the top
let total_synthetic_assignments = 0

let tempCell;
// When the user clicks anywhere outside of a modal or dropdown, close it
window.addEventListener("click", function(event) {
Expand Down Expand Up @@ -316,13 +319,13 @@ let assignmentsTable = new Tabulator("#assignmentsTable", {
{
title: "Stats",
titleFormatter: () => '<i class="fa fa-info-circle" aria-hidden="true"></i>',
formatter: cell =>
(!isNaN(cell.getRow().getData().score)) ?
formatter: cell =>
(!isNaN(cell.getRow().getData().score) && cell.getRow().getPosition() >= total_synthetic_assignments) ?
'<i class="fa fa-info" aria-hidden="true"></i>' : "",
width: 40,
align: "center",
cellClick: async function(e, cell) {
if (isNaN(cell.getRow().getData().score)) {
if (isNaN(cell.getRow().getData().score) || cell.getRow().getPosition() < total_synthetic_assignments) {
return;
}
noStats();
Expand Down Expand Up @@ -516,11 +519,18 @@ let assignmentsTable = new Tabulator("#assignmentsTable", {
{
title: "Add",
titleFormatter: () => '<i class="fa fa-plus grades" aria-hidden="true"></i>',
headerClick: newAssignment,
headerClick: function () {
total_synthetic_assignments++;
newAssignment();
},
formatter: "buttonCross",
width: 40,
align: "center",
cellClick: function(e, cell) {
//if the index is less than the total number of synthetic assignments it must be a synthetic assignment
if (cell.getRow().getPosition() < total_synthetic_assignments)
total_synthetic_assignments--;

cell.getRow().delete();
},
headerSort: false,
Expand Down

0 comments on commit a355470

Please sign in to comment.