Skip to content

Commit

Permalink
[RazortoothRTC#39] Removing useless code and better UI when deleting …
Browse files Browse the repository at this point in the history
…a question
  • Loading branch information
chrqls committed Jun 19, 2014
1 parent db11515 commit 3c21c5d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 50 deletions.
38 changes: 0 additions & 38 deletions lib/smile/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,44 +41,6 @@ Game.prototype.setRatingMetadata = function setRatingMetadata(metadata) {
}
};

/* OLD METHOD TO RETAKE.
NOT CALLED ANYMORE: TO DELETE SOON *//*
Game.prototype.retake_dirty = function retake_dirty() {
this.questionRatings = {};
this.questionCorrectCountMap = {};
for (var key in this.students.currentStudents) {
this.students.currentStudents[key].retake();
}
//var oldGame = this;
//this = new Game();
//this.students = oldGame.students;
//this.studentsWrapper = new StudentsWrapper(oldGame.students);
// Removing questions of past messages
var sizeQuestions = this.questions.numberOfQuestions;
for (var i=0; i<sizeQuestions;i++) {
// Handle deletion
var status = this.questions.deleteQuestion(0);
// Verify we get back an SessionID of the deleted question
if (status !== 0) {
var msgs = this.messages.past;
for (var j=0; j<msgs.length; j++) {
if ((msgs[j].SessionID !== undefined) && (msgs[j].SessionID === status.SessionID) ){
this.messages.past.splice(j, 1); // Delete the question from the ghost of messages past
}
}
}
}
this.questions = new Questions();
};*/

/*
When retaking, there is 2 things to manage:
- the past messages to clean
Expand Down
9 changes: 1 addition & 8 deletions static/js/smileteacher.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,7 @@ GlobalViewModel.startMakingQuestionsWithIQSet = function() {
.querySelector('[class=selected]')
.getAttribute('position_iqset');

/* We get the position to get the id of the iqset
var iqset = JSON.parse(smile_iqset(GlobalViewModel.iqsets()[GlobalViewModel.position()].id));*/
/* We get the position to get the id of the iqset */
var iqset = JSON.parse(smile_iqset(GlobalViewModel.iqsets()[positionOfIQSet].id));
var iqdata = iqset.iqdata;

Expand Down Expand Up @@ -456,8 +455,6 @@ function detailStudent() {
}
}

// console.log('studentToDetail='+JSON.stringify(studentToDetail));

GlobalViewModel.student_detail.push(studentToDetail);

// We highlight the right answers
Expand Down Expand Up @@ -958,10 +955,6 @@ function calculateAndShowResults(dataAll) {
for(var i=0; i<percents_success.length; i++) {

if($(this).find('input[type=hidden]').attr('name') === percents_success_sessionIDs[i]) {


console.log('TEST');
var html = '<span class="">';

var html;

Expand Down
12 changes: 8 additions & 4 deletions static/smile-teacher.html
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,10 @@ <h4><span data-bind="text: sessionName"></span></h4>
<div style="margin:5px 0"><span style="margin:0" data-bind="text: $data"></span></div>
</div>
<input type="hidden" data-bind="attr: {value: $data.answer}" />
<div><img data-bind="attr:{src: urlImage}"></div>
<div>
<span data-bind="text: urlImage"></span><br>
<img data-bind="attr:{src: urlImage}">
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -529,10 +532,11 @@ <h4><span data-bind="text: sessionName"></span></h4>
<img data-bind="attr:{src: urlImage}">
</p>
</div>
<a href="#" onclick="confirmDeletion(this.name)" data-bind="attr: {name: session_id}" class="alert expand button delete">Delete</a>
<ul class="button-group radius even-2">
<li><a href="#" data-bind='click: $root.redirectView' class="secondary expand button">Back</a></li>
<li><a href="#" onclick="confirmDeletion(this.name)" data-bind="attr: {name: session_id}" class="alert expand button delete">Delete</a></li>
</ul>
</div>

<a href="#" data-bind='click: redirectView' class="secondary expand button">Back</a>
</section>

<section smile="confirm-deletion" class="hidden">
Expand Down

0 comments on commit 3c21c5d

Please sign in to comment.