Skip to content

Commit d09b147

Browse files
committed
report button link
1 parent 3b09efc commit d09b147

2 files changed

Lines changed: 33 additions & 3 deletions

File tree

apps/labeling/labelingSimpleAnnotationViewer.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,15 +435,16 @@
435435
console.log('Condition met', collectionMap[collectionId]);
436436
const placeholder = document.getElementById("report_placeholder");
437437
const link = document.createElement("a");
438-
link.href = "#";
439-
link.textContent = "Completion Report";
438+
link.href = "../../reports/report?collectionName=" + collectionMap[collectionId];
439+
link.textContent = "Study Performance Report";
440440
link.target = "_blank"; // open in new tab
441441
link.style.color = "white";
442442
link.style.textDecoration = "none";
443443
link.style.fontWeight = "900";
444444
link.style.letterSpacing = "0.05em";
445445
link.style.textTransform = "uppercase";
446446
link.style.fontSize = "0.9em";
447+
link.style.paddingLeft = "15px";
447448
placeholder.appendChild(link);
448449
}
449450
document.querySelectorAll("#datatables > thead > tr > th").forEach(x=>{

apps/labeling/profTable.html

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@
395395
}
396396
});
397397
// display the open button normally.
398-
let btn = `<button class="btn" data-id='${rs[0]}' onclick='openView(this)'>Annotate</button>`;
398+
let btn = `<button class="btn unfinished" data-id='${rs[0]}' onclick='openView(this)'>Annotate</button>`;
399399
if (labelingAnnotationCount >= labelingCount){
400400
// if done, just a check.
401401
btn = `<div class='material-icons' style='width:48px;color:#008000;' title='Done'>check_circle</div>`;
@@ -412,6 +412,35 @@
412412
perPageSelect: [25, 50, 100],
413413
data: { headings, data },
414414
});
415+
// check if conditions met to show the report button
416+
params2 = new URLSearchParams(window.location.search);
417+
// for now, need to map collections
418+
let collectionMap = {
419+
'647f6169a717cc71e7aad9b2': 'Feedback Test 1',
420+
'6570bc89465283ed7ec3af84': 'Feedback Test 2',
421+
'647f6169a717cc71e7aad9b1': 'Proficiency Test 1',
422+
'6570bc89465283ed7ec3af83': 'Proficiency Test 2',
423+
}
424+
collectionId = params2.get('collectionId');
425+
if (
426+
collectionId in collectionMap &&
427+
document.querySelectorAll('button.unfinished').length === 0
428+
) {
429+
console.log('Condition met', collectionMap[collectionId]);
430+
const placeholder = document.getElementById("report_placeholder");
431+
const link = document.createElement("a");
432+
link.href = "../../reports/report?collectionName=" + collectionMap[collectionId];
433+
link.textContent = "Study Performance Report";
434+
link.target = "_blank"; // open in new tab
435+
link.style.color = "white";
436+
link.style.textDecoration = "none";
437+
link.style.fontWeight = "900";
438+
link.style.letterSpacing = "0.05em";
439+
link.style.textTransform = "uppercase";
440+
link.style.fontSize = "0.9em";
441+
link.style.paddingLeft = "15px";
442+
placeholder.appendChild(link);
443+
}
415444
document.querySelectorAll("#datatables > thead > tr > th").forEach(x=>{
416445
if (tooltips[x.innerText]){
417446
x.setAttribute('title', tooltips[x.innerText]);

0 commit comments

Comments
 (0)