Skip to content

Commit

Permalink
deleting console.logs
Browse files Browse the repository at this point in the history
  • Loading branch information
kkatzen committed May 4, 2015
1 parent bb4ddfb commit df6d44e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 122 deletions.
37 changes: 1 addition & 36 deletions assets/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,8 @@ function updateProblemProgressBar(){

$.post("/user/read/", {}, function(users){
users.forEach(function (user) {
console.log(user.displayName);
var results = {tried: false, correct: false, style: false};
$.post("/submission/read/" + problem.id, {id: problem.id, student: user.username}, function(submissions){
console.log(submission.code);
if(submissions.length == 0){
} else {
results.tried = true;
Expand Down Expand Up @@ -147,7 +145,6 @@ function problemCorrect(user, problem, student, totalStudents){
var a = $("<a></a>")
.html(submissions.length)
.click(function (event) {
console.log("angst");
if($(".submissionUser"+user.id).hasClass("hidden")) {
$(".submissionUser"+user.id).removeClass('hidden');
} else {
Expand Down Expand Up @@ -212,8 +209,6 @@ function problemCorrect(user, problem, student, totalStudents){
myRows.push(submissionRow);
});

console.log("collpasemf");

student.append(rsectionF);
student.append(rsectionS);
$("#allStudents1ProblemResults").append(student);
Expand Down Expand Up @@ -301,15 +296,12 @@ function getSubmission(submission,user,problem) {
$("#submissionCreatedBy").empty().append(a);
$("#relatedSubmissions").empty();
$("#submissionPoints").html("Style Points: " + submission.value.style + "/" + problem.value.style + "<br/>Functionality Points: " + submission.value.correct + "/" + problem.value.correct);
console.log(submission.code);

editor.setValue(submission.code);
console.log("refresh editor");

$("#submissionMessage").empty().html(submission.message.replace(/\n/g,"<br />"));
$("#submissionTitle").html(problem.name);
$.post("/folder/read/", {id: problem.folder}, function(folder){
console.log(folder.name);
$("#submissionTitle").html(problem.name + "<i> in " + folder.name + "</i>");
});

Expand Down Expand Up @@ -506,13 +498,8 @@ function reloadFolders() {
$("#folderDropdown").empty();
$("#editFolderDropdown").empty();
numpoints = 0;
console.log("");
console.log("");
console.log("");
console.log("");
$.post("/folder/read", null, function (folders) {
folders.forEach(function (folder) {
console.log(folder.name + " num:" + folder.num);
addFolder(folder)
});
});
Expand All @@ -539,7 +526,6 @@ function addFolder(folder) {
$("#" + accordianFolderId).empty();
$.post("/problem/read", {folder: folder.id}, function (problems) {
problems.forEach( function (problem) {
// console.log(problem.name + " num:" + problem.num);
numpoints += parseInt(problem.value.style) + parseInt(problem.value.correct);
var link = addProblemToAccordian(problem, accordianFolderId);
$("#" + accordianFolderId).append(link);
Expand Down Expand Up @@ -649,7 +635,7 @@ function reloadSortableFolders() {
if (confirm('Are you sure you wish to delete this problem ?')) {
$.post("/problem/delete", {id: problem.id}, function () {
$.post("/problem/reorder", {folder: problem.folder}, function () {
console.log('reloadSortableFolders();')

});
});
}
Expand Down Expand Up @@ -766,7 +752,6 @@ window.onload = function () {
function() {
if($("#questions").hasClass("active")){
updateProblemProgressBar();
console.log('update progress bar');
}
},
2000 /* 30000 ms = 30 sec */
Expand Down Expand Up @@ -913,7 +898,6 @@ window.onload = function () {

$('#onyenSearchButton').on('click', function( event ) {
var onyenValue = $("#onyen").val();
console.log("onyen " + onyenValue);
if(onyenValue == ""){
getIndividualNone("null");
return;
Expand Down Expand Up @@ -944,22 +928,3 @@ window.onload = function () {
$('[data-toggle="tooltip"]').tooltip()
};


function populateProgress () {
$.post("/user/read/", {}, function(users){
total = users.length;
users.forEach(function (user) {
$("#visualization").append('<div class="visualize-row" id="visualize-student-' + user.id + '"></div>')
})
});
$.post("/folder/read", null, function (folders) {
folders.forEach(function (folder) {
$.post("/problem/read", {folder: folder.id}, function (problems) {
problems.forEach( function (problem) {

})
});
})
});

}
86 changes: 0 additions & 86 deletions assets/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,60 +6,10 @@ var folderStudScore = 0;
var totScore = 0;
var studScore = 0;


/*
fProto = {
addProblem : function (problem) {
var maxScore = 0;
var probMax = Number(problem.value.correct) + Number(problem.value.style);
totScore += probMax;
var link = $("<li></li>").append(
$("<a></a>")
.attr("href","#")
.append(problem.name)
);
if(problem.phase == 0) {
link.css("background-color","lightgray");
}
link.click(function () { addProbInfo(problem); });
if (loggedIn) {
var results = { correct: false, style: false };
$.post("/submission/read/" + problem.id, {}, function (submissions) {
if (submissions.length == 0) {
//do nothing
} else {
submissions.forEach( function (submission) {
var curSubScore = Number(submission.value.correct)+Number(submission.value.style);
if(curSubScore > maxScore) {
maxScore = curSubScore;
}
results.correct =
results.correct || (submission.value.correct == problem.value.correct);
results.style = results.style || (submission.value.style == problem.value.style);
if (results.correct && results.style) { return true; }
});
studScore += maxScore;
if (maxScore < probMax) {
$("a", link).append(inProgress("8px"));
} else {
$("a", link).append(correct("8px"));
}
var probGrade = $("<span class='badge'>" + maxScore + "/" + (Number(problem.value.correct) + Number(problem.value.style))+"</span>");
$("a", link).append(probGrade);
}
$("#grade").empty().append(studScore + "/" + totScore);
});
}
$("ul",this.domNode).append(link);
}
}
*/

function addProblemToAccordian(problem,folderName){
var earnedPointsDiv = "#earned-" +folderName;
var availPointsDiv = "#avail-" +folderName;
var checkDiv = "#check-" +folderName;
console.log("addProblemToAccordian()");
var maxScore = 0;
var probMax = Number(problem.value.correct) + Number(problem.value.style);
totScore += probMax;
Expand Down Expand Up @@ -106,16 +56,11 @@ function addProblemToAccordian(problem,folderName){

var currentEarned = $(earnedPointsDiv).text();
var availablePoints = $(availPointsDiv).text();
// console.log("currentEarnedPre" +currentEarned);
// console.log("maxScore" +maxScore);
currentEarned = Number(currentEarned);
currentEarned = currentEarned + maxScore;
// console.log("currentEarnedPost" +currentEarned);
$(earnedPointsDiv).empty().append(currentEarned);
console.log("check a" + availablePoints + " e" + currentEarned);

if(availablePoints == currentEarned){
console.log("check is yes");
$(checkDiv).append(correct("8px").css("float","right"));
$("#panel-" + folderName).removeClass("panel-danger");
$("#panel-" + folderName).removeClass("panel-warning");
Expand Down Expand Up @@ -154,20 +99,6 @@ function inProgress (pad) {
}

function addFolder (folder) {
/*
var dropdown = $("<li></li>").addClass("dropdown");
var toggle = $("<a></a>")
.attr("href","#")
.attr("data-toggle","dropdown")
.addClass("dropdown-toggle")
.append(folder.name)
.append( $("<b></b>").addClass("caret") );
var menu = $("<ul></ul>")
.addClass("dropdown-menu")
.attr("id","f-" + folder.id);
dropdown.append(toggle).append(menu);
$("#folders").append(dropdown);
*/
var accordianFolderName = "accoridanFolder" + folder.id;
var toggleLabel = '<a data-toggle="collapse" data-parent="#accordion" href="#'+ accordianFolderName + '">' + folder.name + '</a>';
var accordian = "<div id='panel-" + accordianFolderName + "' class='panel panel-danger'><div class='panel-heading'><h4 class='panel-title'>" + toggleLabel + " <span id='earned-"+ accordianFolderName + "'>0</span>/<span id='avail-"+ accordianFolderName + "'></span><span id='check-"+ accordianFolderName + "'></span></h4></div><ul id = '" + accordianFolderName + "' class='panel-collapse collapse folderCollapse'></ul></div></div>";
Expand All @@ -177,13 +108,9 @@ function addFolder (folder) {
$("#" + accordianFolderName).append(accordianFolderBody);
var folderScore = 0;
$("#avail-" + accordianFolderName).empty().append(folderScore);
//var fObj = { domNode : dropdown, data : folder };
//fObj.__proto__ = fProto;
//allFolders[folder.id] = fObj;
$("#" + accordianFolderName).empty();
$.post("/problem/read", {folder: folder.id, phase: 2}, function (problems) {
problems.forEach( function (problem) {
//fObj.addProblem(problem);
var link = addProblemToAccordian(problem, accordianFolderName);
folderScore += parseInt(problem.value.style) + parseInt(problem.value.correct);
$("#" + accordianFolderName).append(link);
Expand Down Expand Up @@ -214,17 +141,12 @@ function addProbInfo (problem) {

submissions.forEach( function (submission) {
addSubmission(submission);
console.log(submission.value.style);
console.log(submission.value.correct);
if(submission.value.style > highestStyle){
highestStyle = submission.value.style;
}
if(submission.value.correct > highestCorrect){
highestCorrect = submission.value.correct;
}
console.log("highestCorrect" + highestCorrect);
console.log("highestStyle" + highestStyle);

});
$("#highestPtCorrect").empty().append(highestCorrect);
$("#highestPtStyle").empty().append(highestStyle);
Expand All @@ -248,7 +170,6 @@ function addProbInfo (problem) {
}

function addSubmission(submission) {
console.log("adding submission");
var time = new Date(submission.updatedAt);
var timeString = time.toLocaleDateString() + " " + time.toLocaleTimeString();
var link = $("<tr></tr>");
Expand Down Expand Up @@ -351,14 +272,11 @@ window.onload = function () {
}
});
var setErrorMsg = function (msg) {
//$("#errors").removeClass("hidden");
$("#console").empty();
$("#console").append(msg);
console.log(msg);
};
$("#test").click(function () {
var code = editor.getValue();
//$("#errors").removeClass("hidden");
$("#console").empty();
try {
eval(code);
Expand All @@ -380,19 +298,15 @@ window.onload = function () {
var AST = acorn.parse(code); // return an abstract syntax tree structure
// var types = pnut.listTopLevelTypes(AST);
var ssOb = pnut.collectStructureStyleFacts(AST); // return a analysis of style grading by checking AST
console.log("ssOb" + ssOb.numDeclVar);
$.post("/submission/create", {problem: problem, code: code, style: JSON.stringify(ssOb)}, function (submission) {
addSubmission(submission);
foldersReload();
setErrorMsg(submission.message);
console.log(submission);
});
} catch (e) {
$("#console").append("Error! Be sure to test your code locally before submitting.");
}



}
});

Expand Down

0 comments on commit df6d44e

Please sign in to comment.