Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
baizel committed Apr 14, 2019
1 parent 6fcf3ee commit 9ae5046
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Viz/static/js/ClientAnimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,12 @@ function graphApiCall(url) {

////////////////////////////////////////////////////// Init ////////////////////////////////////////////////////
$(document).ready(function () {
graphApiCall("/api/graph/random");
const urlParams = new URLSearchParams(window.location.search);
const gId = urlParams.get('graphId');
if (gId === null)
graphApiCall("/api/graph/random");
else
graphApiCall("/api/graph/"+gId);
$(".pause-btn").hide();

for (i = 0; i < algo["lines"].length; i++) {
Expand Down
3 changes: 2 additions & 1 deletion Viz/utils/QuizEngine.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ def generateNeighbourQuestions(self):
def generateDistanceOfRandomNodeQuestion(self):
iteration = random.randint(1, self.__maxNodes - 1)
randomNode = random.randint(1, self.__maxNodes)
question = "On the {} iteration of the while Loop in the Dijkstra Algorithm (Line 14-24), whats the distance for node {}?".format(ordinal(iteration), randomNode)
question = "On the {} iteration of the while Loop in the Dijkstra Algorithm @ Line 15, whats the distance for node {}?".format(ordinal(iteration), randomNode)
ans = self.__getNodeDistanceAtState(self.__distanceState, iteration)[randomNode]
print(self.__distanceState)
options = [str(random.randint(0, 50)) for _ in range(4)]
options.append(str(ans))
if str(ans) != self.INF_OPTIONS:
Expand Down
2 changes: 2 additions & 0 deletions Viz/views/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ def get_context_data(self, **kwargs):
recentAtemptedAns.append({"attemptedAns": a.attempted_answers, "question": i.getSummaryContext()})
except AttemptedQuestion.DoesNotExist:
pass
except AttemptedQuestion.MultipleObjectsReturned:
pass
data = {"wrong": totalPossibleScore - totalScoreAchieved, "right": totalScoreAchieved, "stats": stats, "quiz": recentAtemptedAns, "timeChartData": timeChartData}
data = dict(**data, **exData, **res)
return data
Expand Down

0 comments on commit 9ae5046

Please sign in to comment.