Handle user data streams different 1/2

In the future this will be much more performant!
This commit is contained in:
Patrick Jentsch
2020-04-30 11:28:55 +02:00
parent b7fc804b40
commit e1b07d8719
7 changed files with 83 additions and 121 deletions

View File

@ -157,9 +157,8 @@
_init() {
let job;
job = (this.foreignJobFlag ? nopaque.foreignJobs[this.jobId]
: nopaque.jobs[this.jobId]);
job = (this.foreignJobFlag ? nopaque.foreignUser.jobs[this.jobId]
: nopaque.user.jobs[this.jobId]);
// End date
this.setEndDate(job.end_date);
// Status
@ -174,8 +173,8 @@
let pathArray;
for (let operation of patch) {
/* "/jobId/valueName" -> ["jobId", "valueName"] */
pathArray = operation.path.split("/").slice(1);
/* "/jobs/{jobId}/..." -> ["{jobId}", ...] */
pathArray = operation.path.split("/").slice(2);
if (pathArray[0] != this.jobId) {continue;}
switch(operation.op) {
case "add":
@ -212,20 +211,15 @@
}
setResults(results) {
let resultsElement;
results.sort(function (a, b) {
var filenameA = a.filename.toUpperCase();
var filenameB = b.filename.toUpperCase();
if (filenameA < filenameB) {
return -1;
}
if (filenameA > filenameB) {
return 1;
}
let resultsArray, resultsElement;
resultsArray = Object.values(results)
resultsArray.sort(function (a, b) {
if (a.filename < b.filename) {return -1;}
if (a.filename > b.filename) {return 1;}
return 0;
});
resultsElement = document.getElementById("results");
for (let result of results) {
for (let result of resultsArray) {
resultsElement.insertAdjacentHTML(
"beforeend",
`<tr>