Skip to content

Commit

Permalink
add titles to debug_sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
angelgardt committed May 23, 2024
1 parent e721ab7 commit 8f67cb3
Show file tree
Hide file tree
Showing 14 changed files with 611 additions and 270 deletions.
242 changes: 121 additions & 121 deletions book/_book/debug_sheet.html

Large diffs are not rendered by default.

49 changes: 24 additions & 25 deletions book/_book/js/sheet.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,44 @@
// Parse JSON
INFO_JSON = JSON.parse(sheet_json);
let INFO = {};
let N_tasks = 30;

// Parse JSON

var info_json = JSON.parse(sheet_json);
let info = {};

for (let i = 0; i < info_json.length; i++) {
info[info_json[i].name] = {};
for (let t = 1; t <= 30; t++) {
for (let i = 0; i < INFO_JSON.length; i++) {
INFO[INFO_JSON[i].name] = {};
for (let t = 1; t <= N_tasks; t++) {
id = "t" + t;
info[info_json[i].name][id] = info_json[i][id];
INFO[INFO_JSON[i].name][id] = INFO_JSON[i][id];
}
}

console.log(info)
delete INFO_JSON;

// Add content

for (let i = 1; i <= 30; i++) {
if (info["level"]["t"+i] == "") {
// Add labels
for (let i = 1; i <= N_tasks; i++) {
if (INFO.level["t"+i] == "") {
document.getElementById("t"+i+"-level").hidden = true;
} else {
document.getElementById("t"+i+"-level").classList.add("level-" + info["level"]["t"+i]);
document.getElementById("t"+i+"-level").classList.add("level-" + INFO.level["t"+i]);
}
if (info["has_autocheck"]["t"+i] == "false") {
if (INFO.has_autocheck["t"+i] == "false") {
document.getElementById("t"+i+"-autocheck").hidden = true;
}
}

// Change TOC title
document.getElementById("toc-title").innerHTML = "Задания";

// Check answers

// Open hints


for (let i = 1; i <= N_tasks; i++) {
document.getElementById("t"+i+"-hints").open = true;
}


// Check answers
function checker(id, ans)
{
let input_task = document.getElementById(id+"-input").value;
Expand Down Expand Up @@ -62,12 +70,3 @@ function checker(id, ans)
function check(id) {
checker(id = id, ans = info["autocheck_answer"][id]);
}



// Open hints

for (let i = 1; i <= 30; i++) {
document.getElementById("t"+i+"-hints").open = true;
}

2 changes: 1 addition & 1 deletion book/_book/js/sheet0.json
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sheet_json='[{"name":"n","t1":"1","t2":"2","t3":"3","t4":"4","t5":"5","t6":"6","t7":"7","t8":"8","t9":"9","t10":"10","t11":"11","t12":"12","t13":"13","t14":"14","t15":"15","t16":"16","t17":"17","t18":"18","t19":"19","t20":"20","t21":"21","t22":"22","t23":"23","t24":"24","t25":"25","t26":"26","t27":"27","t28":"28","t29":"29","t30":"30"},{"name":"task","t1":"","t2":"","t3":"","t4":"","t5":"","t6":"","t7":"","t8":"","t9":"","t10":"","t11":"","t12":"","t13":"","t14":"","t15":"","t16":"","t17":"","t18":"","t19":"","t20":"","t21":"","t22":"","t23":"","t24":"","t25":"","t26":"","t27":"","t28":"","t29":"","t30":""},{"name":"img","t1":"","t2":"","t3":"","t4":"","t5":"","t6":"","t7":"","t8":"","t9":"","t10":"","t11":"","t12":"","t13":"","t14":"","t15":"","t16":"","t17":"","t18":"","t19":"","t20":"","t21":"","t22":"","t23":"","t24":"","t25":"","t26":"","t27":"","t28":"","t29":"","t30":""},{"name":"level","t1":"easy","t2":"medium","t3":"hard","t4":"extreme","t5":"easy","t6":"easy","t7":"medium","t8":"hard","t9":"extreme","t10":"extreme","t11":"easy","t12":"medium","t13":"hard","t14":"extreme","t15":"medium","t16":"easy","t17":"medium","t18":"hard","t19":"extreme","t20":"hard","t21":"easy","t22":"medium","t23":"hard","t24":"extreme","t25":"easy","t26":"easy","t27":"medium","t28":"hard","t29":"extreme","t30":"extreme"},{"name":"has_autocheck","t1":"true","t2":"true","t3":"true","t4":"true","t5":"true","t6":"true","t7":"true","t8":"true","t9":"true","t10":"true","t11":"true","t12":"true","t13":"true","t14":"true","t15":"true","t16":"true","t17":"true","t18":"true","t19":"true","t20":"true","t21":"true","t22":"true","t23":"true","t24":"true","t25":"true","t26":"true","t27":"true","t28":"true","t29":"false","t30":"false"},{"name":"autocheck_answer","t1":"1","t2":"2","t3":"three","t4":"four","t5":"check,five,none","t6":"1,2,3;4,5,6","t7":"7","t8":"8","t9":"9","t10":"10","t11":"11","t12":"12","t13":"13","t14":"14","t15":"15","t16":"16","t17":"17","t18":"18","t19":"19","t20":"20","t21":"21","t22":"22","t23":"23","t24":"24","t25":"25","t26":"26","t27":"27","t28":"28","t29":"","t30":""},{"name":"input_format","t1":"","t2":"","t3":"","t4":"","t5":"","t6":"","t7":"","t8":"","t9":"","t10":"","t11":"","t12":"","t13":"","t14":"","t15":"","t16":"","t17":"","t18":"","t19":"","t20":"","t21":"","t22":"","t23":"","t24":"","t25":"","t26":"","t27":"","t28":"","t29":"","t30":""},{"name":"answer","t1":"","t2":"","t3":"","t4":"","t5":"","t6":"","t7":"","t8":"","t9":"","t10":"","t11":"","t12":"","t13":"","t14":"","t15":"","t16":"","t17":"","t18":"","t19":"","t20":"","t21":"","t22":"","t23":"","t24":"","t25":"","t26":"","t27":"","t28":"","t29":"","t30":""},{"name":"text","t1":"","t2":"","t3":"","t4":"","t5":"","t6":"","t7":"","t8":"","t9":"","t10":"","t11":"","t12":"","t13":"","t14":"","t15":"","t16":"","t17":"","t18":"","t19":"","t20":"","t21":"","t22":"","t23":"","t24":"","t25":"","t26":"","t27":"","t28":"","t29":"","t30":""}]'
sheet_json='[{"name":"n","t1":"1","t2":"2","t3":"3","t4":"4","t5":"5","t6":"6","t7":"7","t8":"8","t9":"9","t10":"10","t11":"11","t12":"12","t13":"13","t14":"14","t15":"15","t16":"16","t17":"17","t18":"18","t19":"19","t20":"20","t21":"21","t22":"22","t23":"23","t24":"24","t25":"25","t26":"26","t27":"27","t28":"28","t29":"29","t30":"30"},{"name":"task","t1":"","t2":"","t3":"","t4":"","t5":"","t6":"","t7":"","t8":"","t9":"","t10":"","t11":"","t12":"","t13":"","t14":"","t15":"","t16":"","t17":"","t18":"","t19":"","t20":"","t21":"","t22":"","t23":"","t24":"","t25":"","t26":"","t27":"","t28":"","t29":"","t30":""},{"name":"img","t1":"","t2":"","t3":"","t4":"","t5":"","t6":"","t7":"","t8":"","t9":"","t10":"","t11":"","t12":"","t13":"","t14":"","t15":"","t16":"","t17":"","t18":"","t19":"","t20":"","t21":"","t22":"","t23":"","t24":"","t25":"","t26":"","t27":"","t28":"","t29":"","t30":""},{"name":"level","t1":"easy","t2":"medium","t3":"hard","t4":"extreme","t5":"easy","t6":"easy","t7":"medium","t8":"hard","t9":"extreme","t10":"extreme","t11":"easy","t12":"medium","t13":"hard","t14":"extreme","t15":"medium","t16":"easy","t17":"medium","t18":"hard","t19":"extreme","t20":"hard","t21":"easy","t22":"medium","t23":"hard","t24":"extreme","t25":"easy","t26":"easy","t27":"medium","t28":"hard","t29":"extreme","t30":"extreme"},{"name":"has_autocheck","t1":"true","t2":"true","t3":"true","t4":"true","t5":"true","t6":"true","t7":"true","t8":"true","t9":"true","t10":"true","t11":"true","t12":"true","t13":"true","t14":"true","t15":"true","t16":"true","t17":"true","t18":"true","t19":"true","t20":"true","t21":"true","t22":"true","t23":"true","t24":"true","t25":"true","t26":"true","t27":"true","t28":"true","t29":"false","t30":"false"},{"name":"autocheck_answer","t1":"1","t2":"2","t3":"three","t4":"four","t5":"check,five,none","t6":"1,2,3;4,5,6","t7":"7","t8":"8","t9":"9","t10":"10","t11":"11","t12":"12","t13":"13","t14":"14","t15":"15","t16":"16","t17":"17","t18":"18","t19":"19","t20":"20","t21":"21","t22":"22","t23":"23","t24":"24","t25":"25","t26":"26","t27":"27","t28":"28","t29":"","t30":""},{"name":"input_format","t1":"","t2":"","t3":"","t4":"","t5":"","t6":"","t7":"","t8":"","t9":"","t10":"","t11":"","t12":"","t13":"","t14":"","t15":"","t16":"","t17":"","t18":"","t19":"","t20":"","t21":"","t22":"","t23":"","t24":"","t25":"","t26":"","t27":"","t28":"","t29":"","t30":""},{"name":"answer","t1":"","t2":"","t3":"","t4":"","t5":"","t6":"","t7":"","t8":"","t9":"","t10":"","t11":"","t12":"","t13":"","t14":"","t15":"","t16":"","t17":"","t18":"","t19":"","t20":"","t21":"","t22":"","t23":"","t24":"","t25":"","t26":"","t27":"","t28":"","t29":"","t30":""}]'
sheet='sheet0'
Loading

0 comments on commit 8f67cb3

Please sign in to comment.