-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #297 Using composite key and handling exception, more improveme…
…nt in scenario
- Loading branch information
Showing
44 changed files
with
816 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://coffeescript.org/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
# The list of variables | ||
variables = null | ||
# The number of the current index of the line to be executed | ||
indexNumber = 0 | ||
|
||
# [Debugger: Debug - Story 3.6] | ||
# Sends the code to the server and changes the Variables to the data recieved | ||
# Parameters: | ||
# problem_id: The id of the problem being solved | ||
# Returns: none | ||
# Author: Mussab ElDash | ||
@start_debug = (problem_id) -> | ||
input = $('#solution_code').val() | ||
test = $('#testcases').val() | ||
start_spin() | ||
$.ajax | ||
type: "POST" | ||
url: '/debuggers/' + problem_id | ||
data: {code : input , case : test} | ||
datatype: 'json' | ||
success: (data) -> | ||
toggleDebug() | ||
variables = data | ||
stop_spin() | ||
highlight_line data[0]['line'] | ||
error: -> | ||
stop_spin() | ||
return | ||
return | ||
|
||
@start_spin = -> | ||
$('#spinner').attr "class" , "spinner" | ||
return | ||
|
||
@stop_spin = -> | ||
$('#spinner').attr "class" , "" | ||
return | ||
|
||
# [Execute Line By Line - Story 3.8] | ||
# Toggles debugging mode by changing the available buttons. | ||
# Parameters: | ||
# none | ||
# Returns: none | ||
# Author: Rami Khalil (Temporary) | ||
@toggleDebug = () -> | ||
$('#debugButton').prop 'hidden', !$('#debugButton').prop 'hidden' | ||
$('#compileButton').prop 'hidden', !$('#compileButton').prop 'hidden' | ||
$('#testButton').prop 'hidden', !$('#testButton').prop 'hidden' | ||
|
||
$('#nextButton').prop 'hidden', !$('#nextButton').prop 'hidden' | ||
$('#previousButton').prop 'hidden', !$('#previousButton').prop 'hidden' | ||
$('#stopButton').prop 'hidden', !$('#stopButton').prop 'hidden' | ||
|
||
# [Compile - Story 3.4] | ||
# Sends the code to the server to be compiled. | ||
# Parameters: | ||
# none | ||
# Returns: none | ||
# Author: Rami Khalil (Temporary) | ||
@compile = () -> | ||
alert "Compiling" | ||
|
||
# [Test - Story 3.15] | ||
# Sends the code and the input to be processed on the server. | ||
# Parameters: | ||
# none | ||
# Returns: none | ||
# Author: Rami Khalil (Temporary) | ||
@test = () -> | ||
alert "Testing" | ||
|
||
# [Execute Line By Line - Story 3.8] | ||
# Moves to the next state of execution. | ||
# Parameters: | ||
# none | ||
# Returns: none | ||
# Author: Rami Khalil | ||
@next = () -> | ||
if indexNumber + 1 < variables.length | ||
jump_state ++indexNumber | ||
else if(indexNumber == 99) | ||
alert "The online debugger can only step forward 100 times." | ||
else | ||
alert "The program has terminated." | ||
|
||
# [Execute Line By Line - Story 3.8] | ||
# Moves to the previous state of execution. | ||
# Parameters: | ||
# none | ||
# Returns: none | ||
# Author: Rami Khalil | ||
@previous = () -> | ||
if indexNumber > 0 | ||
jump_state --indexNumber | ||
else | ||
alert "This is the first step in the program." | ||
|
||
# [Execute Line By Line - Story 3.8] | ||
# Highlights the target line number in the editor | ||
# Parameters: | ||
# line: The line number to highlight. | ||
# Returns: none | ||
# Author: Rami Khalil | ||
@highlight_line = (line) -> | ||
alert "At line: " + line | ||
|
||
# [Execute Line By Line - Story 3.8] | ||
# Jumps to the target state by highlighting the line and showing variables | ||
# Parameters: | ||
# stateNumber: The target state number. | ||
# Returns: none | ||
# Author: Rami Khalil | ||
@jump_state = (stateNumber) -> | ||
highlight_line variables[stateNumber]['line'] | ||
|
||
# [Debug - Story 3.6] | ||
# Stops the debugging session. | ||
# Parameters: | ||
# none | ||
# Returns: none | ||
# Author: Rami Khalil (Temporary) | ||
@stop = () -> | ||
toggleDebug() | ||
indexNumber = 0; | ||
variables = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the compilers controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the Debuggers controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.hidden { | ||
display: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
.spinner { | ||
display: inline-block; | ||
width: 15px; | ||
height: 15px; | ||
position: relative; | ||
border: 2px solid rgba(0,0,0,0.5); | ||
border-top-color: transparent; | ||
border-radius: 100%; | ||
|
||
-webkit-animation: spin 1s infinite linear; | ||
-moz-animation: spin 1s infinite linear; | ||
-ms-animation: spin 1s infinite linear; | ||
-o-animation: spin 1s infinite linear; | ||
animation: spin 1s infinite linear; | ||
} | ||
|
||
.spinner:after { | ||
content: ''; | ||
display: block; | ||
width: 0; | ||
height: 0; | ||
position: absolute; | ||
top: -5px; | ||
left: 0px; | ||
|
||
border: 4px solid transparent; | ||
border-bottom-color: rgba(0,0,0,0.5); | ||
|
||
-webkit-transform: rotate(45deg); | ||
-moz-transform: rotate(45deg); | ||
-ms-transform: rotate(45deg); | ||
-o-transform: rotate(45deg); | ||
transform: rotate(45deg); | ||
} | ||
|
||
@-webkit-keyframes spin { | ||
to { -webkit-transform: rotate(360deg); } | ||
} | ||
|
||
@-moz-keyframes spin { | ||
to { -moz-transform: rotate(360deg); } | ||
} | ||
|
||
@-ms-keyframes spin { | ||
to { -ms-transform: rotate(360deg); } | ||
} | ||
|
||
@-o-keyframes spin { | ||
to { -o-transform: rotate(360deg); } | ||
} | ||
|
||
@keyframes spin { | ||
to { transform: rotate(360deg); } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class CompilersController < ApplicationController | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
class DebuggersController < ApplicationController | ||
|
||
# [Debugger: Debug - Story 3.6] | ||
# Send the recieved code to be debugged | ||
# and return the result to the user as a json object | ||
# Parameters: | ||
# id: The id of the problem being solved | ||
# code: The code to be debugged | ||
# case: Test case to be debugged against | ||
# Returns: Json object with the result of the debugging | ||
# Author: Mussab ElDash | ||
def start | ||
if lecturer_signed_in? || teaching_assistant_signed_in? | ||
render json: {} | ||
end | ||
id = current_student.id | ||
pid = params[:id] | ||
input = params[:code] | ||
cases = params[:case] | ||
result = Debugger.debug(id, pid, input, cases) | ||
p result | ||
render json: result | ||
end | ||
|
||
end |
Oops, something went wrong.