Skip to content

Commit

Permalink
Merge pull request #16 from TejasTiwari/master
Browse files Browse the repository at this point in the history
Code mapping for each question implemented
  • Loading branch information
dmahajan980 authored Mar 19, 2021
2 parents 276495a + 2c5f295 commit 6da3a91
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
Binary file modified blind_coding/db.sqlite3
Binary file not shown.
1 change: 1 addition & 0 deletions blind_coding/main_app/templates/loggedIn.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ <h5>- Don't try to open up the console or changing the window/tab. You'll be log
</nav>
<h3 class="title">Blind Coding</h3>
<div id="main">
<div class="qno"></div>
<div class="left">
<h5>Question 1</h5>
Loading.....
Expand Down
7 changes: 7 additions & 0 deletions blind_coding/static/css/style-1.css
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ nav#header ul a {
sizing: expand;
}

#main > .qno {
color: white;
font-size: 16px;
padding: 25px 15px;
sizing: expand;
}

.left h4 {
margin: 0 0 10px 0;
}
Expand Down
10 changes: 9 additions & 1 deletion blind_coding/static/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ let timerCont = document.getElementById('timer');
let s = 0, m = 0;
let timerId;
const _totalNumQues = 5;
let codeMap= new Map();

$(document).ready(function() {
for(var i=0; i<_totalNumQues; i++){
codeMap.set(i, null)
}
populateLangs();
getQuestion(0);
disableCopyPaste();
Expand Down Expand Up @@ -231,7 +235,8 @@ function sendRequest(type, url, data){
}

function getQuestion(queNum){


codeMap.set(qNo, getCode())
sendRequest('POST', '/question/', { queNum }).then(
function(response){
response = JSON.parse(response);
Expand All @@ -243,9 +248,12 @@ function getQuestion(queNum){
inStr += '\n';
}
let que = response['question'] + '<br><br>'+'Sample Input'+'<br>'+response['sampTCNum']+'<br>'+inStr+'<br><br>'+'Sample Output'+'<br>'+response['sampleOut'];
document.getElementsByClassName('qno')[0].innerHTML='Q. '+(queNum+1);
document.getElementsByClassName('left')[0].innerHTML=que;
qNo = response['qNo'];
document.getElementById('score').innerHTML = response['userScore'];
var s= document.getElementById("codeInput");
s.value= codeMap.get(queNum)
}
).catch(
function(error){
Expand Down

0 comments on commit 6da3a91

Please sign in to comment.