Fix submission table for 0 submissions

This commit is contained in:
Jason Yuen 2022-10-31 14:03:44 -07:00 committed by Tudor Brindus
parent df50e80e88
commit 803a8cb77b

View File

@ -82,7 +82,7 @@ function init_submission_table($, submission_activity, metadata, language_code)
.append($('<td>').addClass('activity-blank').append('<div>'));
}
var max_activity = Math.max.apply(null, days.map(function (obj) { return obj.activity; }));
var max_activity = Math.max(1, Math.max.apply(null, days.map(function (obj) { return obj.activity; })));
days.forEach(function (obj) {
var level = Math.ceil((obj.activity / max_activity) * (activity_levels - 1));
var text = ngettext('%(cnt)d submission on %(date)s', '%(cnt)d submissions on %(date)s', obj.activity)