function load_table_red_rank() { get_data("fcBiWorkerDaily/get?type=0&limit=3", on_red_rank_success); } function load_table_black_rank() { get_data("fcBiWorkerDaily/get?type=4&limit=3", on_black_rank_success); } function history_success(obj, sta) { var history = first_parse(this, obj); var i, j, t; console.log(" history : "); console.log(history); if (this.url.indexOf("type=1") >= 0) { t = 1; } else if (this.url.indexOf("type=2") >= 0) { t = 2; } else if (this.url.indexOf("type=3") >= 0) { t = 3; } else { t = 0; } if (t == 2 || t == 3) { hispass[t] = 0; hisfail[t] = 0; hisstack[t] = 0; hisrate[t] = 0; for (i = 0; i < history.length; i++) { hispass[t] = history[i].passNum + hispass[t]; hisfail[t] = history[i].failNum + hisfail[t]; hisstack[t] = history[i].avgDue + hisstack[t]; } if (history.length != 1) { if (hispass[t] + hisfail[t] == 0) { hisrate[t] = 0; } else { hisrate[t] = Math.floor(hisfail[t] * 10000 / (hispass[t] + hisfail[t])) / 100; } } } else if (t == 1) { hispass[1] = history[0].passNum; hisfail[1] = history[0].failNum; hisstack[1] = history[0].avgDue; if (hispass[1] + hisfail[1] == 0) { hisrate[1] = 0; } else { hisrate[1] = Math.floor(hisfail[1] * 10000 / (hispass[1] + hisfail[1])) / 100; } } hispass[0] = history[history.length - 1].passNum; hisfail[0] = history[history.length - 1].failNum; hisstack[0] = history[history.length - 1].avgDue; if (hispass[0] + hisfail[0] == 0) { hisrate[0] = 0; } else { hisrate[0] = Math.floor(hisfail[0] * 10000 / (hispass[0] + hisfail[0])) / 100; } } function on_red_rank_success(obj, sta) { var redchart = first_parse(this, obj); var i, j; i = j = 0; console.log(" redchart : "); console.log(redchart); for (i = 0; i < redchart.list.length; i++) { goodid[i] = getUserName(redchart.list[i].workerId); goodpass[i] = redchart.list[i].passNum; if(redchart.list[i].passNum + redchart.list[i].failNum > 0) { goodfailrate[i] = Math.floor(redchart.list[i].failNum * 10000 / (redchart.list[i].passNum + redchart.list[i].failNum)) / 100; }else{ goodfailrate[i] = 0; } } } function on_black_rank_success(obj, sta) { var blackchart = first_parse(this, obj); var i, j; i = j = 0; console.log(" black chart : "); console.log(blackchart); for (i = 0; i < blackchart.list.length; i++) { badid[i] = getUserName(blackchart.list[i].workerId); badpass[i] = blackchart.list[i].passNum; //badfailrate[i] = blackchart.list[i].failRate / 100; if(blackchart.list[i].passNum + blackchart.list[i].failNum > 0) { badfailrate[i] = Math.floor(blackchart.list[i].failNum * 10000 / (blackchart.list[i].passNum + blackchart.list[i].failNum)) / 100; }else{ badfailrate[i] = 0; } } } function getSpotHtml(htmlbody, i) { if(typeof hispass[i] === "undefined"){ htmlbody += "