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,
|
users: null,
|
||||||
results: null,
|
results: null,
|
||||||
status: STATUS.FAILURE,
|
status: STATUS.FAILURE,
|
||||||
|
date: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('response', response);
|
console.log('response', response);
|
||||||
@ -294,10 +295,8 @@ export class ExamCorrect {
|
|||||||
const timeElem = row.cells.item(0);
|
const timeElem = row.cells.item(0);
|
||||||
timeElem.innerHTML = moment(response.time).format(this._dateFormat);
|
timeElem.innerHTML = moment(response.time).format(this._dateFormat);
|
||||||
timeElem.classList.remove('exam-correct--local-time');
|
timeElem.classList.remove('exam-correct--local-time');
|
||||||
// TODO special style for server time?
|
|
||||||
newEntry.users = [response.user];
|
newEntry.users = [response.user];
|
||||||
newEntry.results = response.results;
|
newEntry.results = response.results;
|
||||||
newEntry.date = response.time;
|
|
||||||
}
|
}
|
||||||
// TODO replace results with results from response
|
// TODO replace results with results from response
|
||||||
// TODO set edit button visibility
|
// TODO set edit button visibility
|
||||||
@ -326,6 +325,7 @@ export class ExamCorrect {
|
|||||||
setStatus(elem, status);
|
setStatus(elem, status);
|
||||||
});
|
});
|
||||||
newEntry.status = status || STATUS.FAILURE;
|
newEntry.status = status || STATUS.FAILURE;
|
||||||
|
newEntry.date = response.time || moment().utc().format();
|
||||||
savedEntries.push(newEntry);
|
savedEntries.push(newEntry);
|
||||||
this._storageManager.save('entries', savedEntries);
|
this._storageManager.save('entries', savedEntries);
|
||||||
return;
|
return;
|
||||||
@ -432,10 +432,10 @@ export class ExamCorrect {
|
|||||||
const cells = new Map();
|
const cells = new Map();
|
||||||
|
|
||||||
const dateCell = document.createElement('TD');
|
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.appendChild(document.createTextNode(date.format(this._dateFormat)));
|
||||||
dateCell.setAttribute('date', date.utc().format());
|
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);
|
cells.set(this._cIndices.get('date'), dateCell);
|
||||||
|
|
||||||
let userCell = document.createElement('TD');
|
let userCell = document.createElement('TD');
|
||||||
|
|||||||
Reference in New Issue
Block a user