Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code mapping for each question implemented #16

Merged
merged 1 commit into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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