Skip to content

Commit f5be45f

Browse files
committed
fix parentheses error js
1 parent 5d77f62 commit f5be45f

File tree

1 file changed

+46
-39
lines changed

1 file changed

+46
-39
lines changed

static/js/javascript.js

Lines changed: 46 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//Created by Ethan Chiu 2017
1+
//Created by Ethan Chiu 2016
22

33
$(document).ready(function(){
44
//Pulls info from AJAX call and sends it off to codemirror's update linting
@@ -36,6 +36,7 @@ $(document).ready(function(){
3636
$('#errorslist').append("<tr>"+"<th>Line</th>"+"<th>Severity</th>"+
3737
"<th>Error</th>"+ "<th>More Info</th>"+"</tr>");
3838

39+
//console.log(errors)
3940
for(var x = 2; x < errors.length; x+=2){
4041

4142
//Sorting into line_no, etc.
@@ -46,59 +47,66 @@ $(document).ready(function(){
4647
var message_split = errors[x].split(':');
4748
//console.log(message_split);
4849

49-
number = message_split[1] - 14;
50+
number = message_split[1] - 14 + 6;
5051

51-
//Get severity after second colon
52-
severity = message_split[2].charAt(2);
52+
//temp fix
53+
if(number>0)
54+
{
55+
number = message_split[1] - 14;
5356

54-
//Get message id by splitting
55-
id = message_split[2].substring(2,7);
57+
//Get severity after second colon
58+
severity = message_split[2].charAt(2);
5659

57-
//Split to get message
58-
message_split = message_split[2].split("]");
59-
message = message_split[1];
60+
//Get message id by splitting
61+
id = message_split[2].substring(2,7);
6062

61-
//Set severity to necessary parameters
62-
if(severity=="E"){
63-
console.log("error");
64-
severity="error";
65-
severity_color="red";
66-
} else if(severity=="W"){
67-
console.log("error");
68-
severity="warning";
69-
severity_color="yellow";
63+
//Split to get message
64+
message_split = message_split[2].split("]");
65+
message = message_split[1];
66+
67+
//Set severity to necessary parameters
68+
if(severity=="E"){
69+
//console.log("error");
70+
severity="error";
71+
severity_color="red";
72+
} else if(severity=="W"){
73+
//console.log("error");
74+
severity="warning";
75+
severity_color="yellow";
76+
}
77+
//Push to error list
78+
error_list.push({
79+
line_no: number,
80+
column_no_start: null,
81+
column_no_stop: null,
82+
fragment: null,
83+
message: message,
84+
severity: severity
85+
});
86+
87+
//Get help message for each id
88+
var moreinfo = getHelp(id);
89+
//Append all data to table
90+
$('#errorslist').append("<tr>"+"<td>" + number + "</td>"
91+
+"<td style=\"background-color:"+severity_color+";\"" +
92+
">" + severity + "</td>"
93+
+"<td>" + message + "</td>"
94+
+"<td>" + moreinfo + "</td>"+"</tr>");
7095
}
71-
//Push to error list
72-
error_list.push({
73-
line_no: number,
74-
column_no_start: null,
75-
column_no_stop: null,
76-
fragment: null,
77-
message: message,
78-
severity: severity
79-
});
8096

81-
//Get help message for each id
82-
var moreinfo = getHelp(id);
83-
//Append all data to table
84-
$('#errorslist').append("<tr>"+"<td>" + number + "</td>"
85-
+"<td style=\"background-color:"+severity_color+";\"" +
86-
">" + severity + "</td>"
87-
+"<td>" + message + "</td>"
88-
+"<td>" + moreinfo + "</td>"+"</tr>");
8997

9098

9199
}
92100

93-
console.log("error_list"+error_list.toString());
101+
//console.log("error_list"+error_list.toString());
94102
result_cb(error_list);
95103

96104
}
97105
//AJAX call to pylint
98106
$.getJSON('/check_code', {
99107
text : code
100108
}, function(data) {
101-
console.log(data);
109+
//console.log(data);
102110
current_text = data;
103111
//Check Text
104112
check(current_text);
@@ -125,7 +133,7 @@ $(document).ready(function(){
125133

126134
//Actually Run in Python
127135
$( "#run" ).click(function() {
128-
console.log("sfd");
136+
//console.log("sfd");
129137
//AJAX call to run python
130138
$.getJSON('/run_code', {
131139
text : editor.getValue()
@@ -139,7 +147,6 @@ $(document).ready(function(){
139147
$("#output").append("<pre>"+data+"</pre>");
140148
}
141149
});
142-
};
143150

144151
exampleCode('#codeexample1', "methods = []\nfor i in range(10):\n methodds.append(lambda x: x + i)\nprint methods[0](10)");
145152
exampleCode('#codeexample2', "for i in range(5):\n print i\n");

0 commit comments

Comments
 (0)