From: <se...@us...> - 2008-05-12 20:24:00
|
Revision: 131 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=131&view=rev Author: sem62 Date: 2008-05-12 13:23:44 -0700 (Mon, 12 May 2008) Log Message: ----------- Finished with logic of summary page Modified Paths: -------------- WebEditor/template/global/SummaryPage.js Modified: WebEditor/template/global/SummaryPage.js =================================================================== --- WebEditor/template/global/SummaryPage.js 2008-05-12 20:05:40 UTC (rev 130) +++ WebEditor/template/global/SummaryPage.js 2008-05-12 20:23:44 UTC (rev 131) @@ -102,24 +102,28 @@ rowNum++; var percents = "0"; - if ((min != null) && (max != null) && (raw != null)){ - percents = 100 * (raw - min) / (max - min) + " %"; + if ((parseInt(min) || min == 0) && (parseInt(max) || max == 0) && (parseInt(raw) || raw == 0)){ + if (max == min){ + percents = "? %"; + } else { + percents = 100 * (raw - min) / (max - min) + " %"; + } } if (modelName == "LectureModel"){ raw = (completionStatus == "completed") ? "read" : "unread"; - percents = "--"; + percents = ""; } - if (min == null){ + if (!parseInt(min) && min != 0){ min = "--"; } - if (max == null){ + if (!parseInt(max) && max != 0){ max = "--"; } - if (raw == null){ + if (!parseInt(raw) && raw != 0){ raw = "--"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <se...@us...> - 2008-05-26 18:45:05
|
Revision: 169 http://acmcontester.svn.sourceforge.net/acmcontester/?rev=169&view=rev Author: sem62 Date: 2008-05-26 11:45:06 -0700 (Mon, 26 May 2008) Log Message: ----------- added Lecture model support at summary page. Modified Paths: -------------- WebEditor/template/global/SummaryPage.js Modified: WebEditor/template/global/SummaryPage.js =================================================================== --- WebEditor/template/global/SummaryPage.js 2008-05-24 22:27:29 UTC (rev 168) +++ WebEditor/template/global/SummaryPage.js 2008-05-26 18:45:06 UTC (rev 169) @@ -9,7 +9,7 @@ var records = new Array(1000); var curr_record = 0; -function ins(title, min, max, raw, completionStatus, model){ +function ins(title, min, max, raw, completionStatus, successStatus, model){ var record = new Array(7); record[0] = completionStatus; record[1] = title; @@ -17,7 +17,8 @@ record[3] = max; record[4] = raw; record[5] = model; - record[6] = deep; + record[6] = successStatus; + record[7] = deep; records[curr_record] = record; curr_record++; @@ -28,7 +29,7 @@ record[2] = 0; record[3] = 0; record[4] = 0; - record[6] = 1; + record[7] = 1; records[curr_record] = record; curr_record++; @@ -49,7 +50,7 @@ var parentRec = records[stack[stackPos]]; - while (record[6] < prevRec[6]){ + while (record[7] < prevRec[7]){ stackPos--; var parent_parent = records[stackPos]; @@ -95,11 +96,11 @@ var i; for (i = 0; i < curr_record - 1; i++){ var record = records[i]; - write(record[0], record[1], record[2], record[3], record[4], record[5]); + write(record[0], record[6], record[1], record[2], record[3], record[4], record[5]); } } -function write(completionStatus, title, min, max, raw, modelName){ +function write(completionStatus, successStatus, title, min, max, raw, modelName){ rowNum++; var percents = "0 %"; @@ -112,21 +113,23 @@ } if (modelName == "LectureModel"){ - raw = (completionStatus == "completed") ? "read" : "unread"; - percents = ""; - } - - if (!parseInt(min) && min != 0){ + percents = "--"; min = "--"; - } + max = "--"; + raw = (completionStatus == "completed") ? "read" : "not read jet"; + } else { + if (!parseInt(min) && min != 0){ + min = "--"; + } + + if (!parseInt(max) && max != 0){ + max = "--"; + } - if (!parseInt(max) && max != 0){ - max = "--"; + if (!parseInt(raw) && raw != 0){ + raw = "--"; + } } - - if (!parseInt(raw) && raw != 0){ - raw = "--"; - } var td = "<td class='tbl"; td += 1 - (rowNum % 2) + 1; @@ -139,8 +142,13 @@ startFormat = "<B>"; endFormat = "</B>"; } - - document.write("<TR>" + td + rowNum + "<img src='global/images/" + completionStatus + ".gif'>"); + + var imgName = completionStatus; + if (imgName == "completed"){ + imgName = successStatus; + } + + document.write("<TR>" + td + rowNum + "<img src='global/images/" + imgName + ".gif'>"); document.write(td + title); document.write(td + startFormat + min + endFormat); document.write(td + startFormat + max + endFormat); @@ -164,7 +172,7 @@ title = " " + title; } - ins(title, getScore(id, "min"), getScore(id, "max"), getScore(id, "raw"), getCompletionStatus(id), modelName); + ins(title, getScore(id, "min"), getScore(id, "max"), getScore(id, "raw"), getCompletionStatus(id), getSuccessStatus(id), modelName); } function getObjectiveIndex(id){ @@ -180,17 +188,17 @@ return -1; } +function getSuccessStatus(objectiveID){ + var index = getObjectiveIndex(objectiveID); + if (index == -1) return "undefined"; + var res = GetValue("cmi.objectives." + index + ".success_status"); + return res != null ? res : "undefined"; +} + function getCompletionStatus(objectiveID){ var index = getObjectiveIndex(objectiveID); - - if (index == -1) return "incomplete"; - + if (index == -1) return "undefined"; var res = GetValue("cmi.objectives." + index + ".completion_status"); - - if (res == "completed"){ - res = GetValue("cmi.objectives." + index + ".success_status"); - } - return res != null ? res : "undefined"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |