fix(exam-correct): also persist local time on non-success
This commit is contained in:
parent
c520918eb3
commit
dcb79d4cb8
@ -275,6 +275,7 @@ export class ExamCorrect {
|
||||
users: null,
|
||||
results: null,
|
||||
status: STATUS.FAILURE,
|
||||
date: null,
|
||||
};
|
||||
|
||||
console.log('response', response);
|
||||
@ -294,10 +295,8 @@ export class ExamCorrect {
|
||||
const timeElem = row.cells.item(0);
|
||||
timeElem.innerHTML = moment(response.time).format(this._dateFormat);
|
||||
timeElem.classList.remove('exam-correct--local-time');
|
||||
// TODO special style for server time?
|
||||
newEntry.users = [response.user];
|
||||
newEntry.results = response.results;
|
||||
newEntry.date = response.time;
|
||||
}
|
||||
// TODO replace results with results from response
|
||||
// TODO set edit button visibility
|
||||
@ -326,6 +325,7 @@ export class ExamCorrect {
|
||||
setStatus(elem, status);
|
||||
});
|
||||
newEntry.status = status || STATUS.FAILURE;
|
||||
newEntry.date = response.time || moment().utc().format();
|
||||
savedEntries.push(newEntry);
|
||||
this._storageManager.save('entries', savedEntries);
|
||||
return;
|
||||
@ -432,10 +432,10 @@ export class ExamCorrect {
|
||||
const cells = new Map();
|
||||
|
||||
const dateCell = document.createElement('TD');
|
||||
const date = rowInfo.date ? moment(rowInfo.date) : moment();
|
||||
const date = moment(rowInfo.date);
|
||||
dateCell.appendChild(document.createTextNode(date.format(this._dateFormat)));
|
||||
dateCell.setAttribute('date', date.utc().format());
|
||||
if (!rowInfo.date) dateCell.classList.add('exam-correct--local-time');
|
||||
if (rowInfo.status !== STATUS.SUCCESS) dateCell.classList.add('exam-correct--local-time');
|
||||
cells.set(this._cIndices.get('date'), dateCell);
|
||||
|
||||
let userCell = document.createElement('TD');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user