-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from TobiasSH/develop
Develop into master, ezzy
- Loading branch information
Showing
429 changed files
with
57,055 additions
and
136 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
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 |
---|---|---|
@@ -1,27 +1,171 @@ | ||
kolabApp.controller('lecturerCtrl', ['$scope', '$http', function ($scope, $http) { | ||
console.log("Hello World from controller"); | ||
|
||
var socket = io(); | ||
var max = 0; | ||
var cantKeepUpHits; | ||
var decreaseVolumeHits; | ||
var increaseVolumeHits; | ||
var decreaseSpeedHits; | ||
var increaseSpeedHits; | ||
|
||
// initial retrieval of questions from the database | ||
var refresh = function () { | ||
$http.get('/questionsCollection').then(function (response) { | ||
console.log("I got the data I requested"); | ||
$scope.kolabDBScope = response.data; | ||
$scope.question = null; | ||
}, | ||
|
||
function (error) { | ||
console.log("I got ERROR"); | ||
}); | ||
$http.get('/counters').then(function(response){ | ||
cantKeepUpHits = response.data[0].hits | ||
decreaseVolumeHits = response.data[1].hits | ||
increaseVolumeHits = response.data[2].hits | ||
decreaseSpeedHits = response.data[3].hits | ||
increaseSpeedHits = response.data[4].hits | ||
}) | ||
}; | ||
|
||
refresh(); | ||
|
||
$scope.studentView = function () { | ||
console.log("cantKeepUp button was clicked"); | ||
}; | ||
$scope.resetVotes = function() { | ||
socket.emit('resetVotes'); | ||
console.log("votes reset") | ||
} | ||
|
||
|
||
// remove function bound to the delete buttons in lecture view | ||
$scope.remove = function (index, id) { | ||
console.log("This is the index of the question we're trying to delete: " +index+ "\n and this is the ID: "+id); | ||
socket.emit('question delete', index, id); | ||
|
||
$scope.remove = function (id) { | ||
console.log(id); | ||
$http.delete('/questionsCollection/' + id).then(function (response) { | ||
refresh(); | ||
}); | ||
}; | ||
|
||
// socket message "question delete" and the response to that message | ||
socket.on('question delete', function (index, id) { | ||
console.log("Trying to delete message (SOCKET) with ID: " + id); | ||
console.log("kolabDBScope object: "); | ||
|
||
$scope.kolabDBScope.splice(index, 1); | ||
$scope.$apply(); | ||
}); | ||
|
||
// socket message "question message" and the response to that message | ||
socket.on('question message', function (msg) { | ||
console.log('Trying to populate the table with questions with ID: ' + msg._id); | ||
$scope.kolabDBScope.push(msg); | ||
$scope.$apply(); | ||
|
||
}); | ||
socket.on('resetVotes', function(){ | ||
var cantKeepUpBar = document.getElementById("cantKeepUpBar"); | ||
var decreaseVolumeBar = document.getElementById("decreaseVolumeBar"); | ||
var increaseVolumeBar = document.getElementById("increaseVolumeBar"); | ||
var decreaseSpeedBar = document.getElementById("decreaseSpeedBar"); | ||
var increaseSpeedBar = document.getElementById("increaseSpeedBar"); | ||
cantKeepUpBar.style.width=0+'%'; | ||
decreaseVolumeBar.style.width=0+'%'; | ||
increaseVolumeBar.style.width=0+'%'; | ||
increaseSpeedBar.style.width=0+'%'; | ||
decreaseSpeedBar.style.width=0+'%'; | ||
cantKeepUpHits = 0 | ||
decreaseVolumeHits = 0 | ||
increaseVolumeHits = 0 | ||
decreaseSpeedHits = 0 | ||
increaseSpeedHits = 0 | ||
|
||
}) | ||
socket.on('incUser',function(){ | ||
max+=1; | ||
console.log("more users") | ||
|
||
}) | ||
socket.on('decUser',function(){ | ||
max-=1; | ||
|
||
}) | ||
socket.on('cantKeepUp',function( hit){ | ||
cantKeepUpHits += hit; | ||
|
||
|
||
console.log(cantKeepUpHits + "hit get on"); | ||
var percent = (cantKeepUpHits/(max))*100 | ||
console.log(percent +"%") | ||
console.log(max+" users") | ||
console.log(cantKeepUpHits + " hits") | ||
console.log("cant keeep up lecture side"); | ||
var elem = document.getElementById("cantKeepUpBar"); | ||
|
||
|
||
elem.style.width=percent+'%'; | ||
|
||
}); | ||
socket.on('decreaseVolume', function(hit){ | ||
decreaseVolumeHits += hit; | ||
console.log("decrease volume lecture side"); | ||
|
||
var percent = (decreaseVolumeHits/(max))*100 | ||
console.log(percent +"%") | ||
console.log(max+" users") | ||
console.log(decreaseVolumeHits + " hits") | ||
console.log("decrease up lecture side"); | ||
var elem = document.getElementById("decreaseVolumeBar"); | ||
|
||
|
||
elem.style.width=percent+'%'; | ||
}); | ||
socket.on('increaseVolume', function(hit){ | ||
increaseVolumeHits += hit; | ||
console.log("increaseses volumes lecture side"); | ||
|
||
var percent = (increaseVolumeHits/(max))*100 | ||
console.log(percent +"%") | ||
console.log(max+" users") | ||
console.log(increaseVolumeHits + " hits") | ||
console.log("increase vol up lecture side"); | ||
var elem = document.getElementById("increaseVolumeBar"); | ||
|
||
|
||
elem.style.width=percent+'%'; | ||
|
||
}); | ||
socket.on('decreaseSpeed', function(hit){ | ||
decreaseSpeedHits += hit; | ||
console.log("decerease speed lecture side"); | ||
|
||
var percent = (decreaseSpeedHits/(max))*100 | ||
console.log(percent +"%") | ||
console.log(max+" users") | ||
console.log(decreaseSpeedHits + " hits") | ||
console.log("decrease speed lecture side"); | ||
var elem = document.getElementById("decreaseSpeedBar"); | ||
|
||
|
||
elem.style.width=percent+'%'; | ||
|
||
|
||
}); | ||
socket.on('increaseSpeed', function(hit){ | ||
increaseSpeedHits += hit; | ||
console.log("incerease speed lecture side"); | ||
|
||
var percent = (increaseSpeedHits/(max))*100 | ||
console.log(percent +"%") | ||
console.log(max+" users") | ||
console.log(increaseSpeedHits + " hits") | ||
console.log("increase speed lecture side"); | ||
var elem = document.getElementById("increaseSpeedBar"); | ||
|
||
|
||
elem.style.width=percent+'%'; | ||
|
||
|
||
}); | ||
|
||
}]); |
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 |
---|---|---|
@@ -1,24 +1,69 @@ | ||
<div class="container horizontal-center"> | ||
<h1>TDT4140 <p> Software Engineering</h1> | ||
<h1>Questions</h1> | ||
<div class="vertical-center"> | ||
<div class="horizontal-center"> | ||
<table class="title"> | ||
<tbody> | ||
<tr> | ||
<td width="90%"> | ||
<h1>TDT4140 <p> Software Engineering</h1> | ||
</td> | ||
<td width="10%"> | ||
<a href="/"> | ||
<button type="button" class="btn btn-lg btn-responsive btn-home"> | ||
<img class="home-button-icon" src="../../../assets/img/icons/chevron-right.svg" onerror="this.onerror=null; this.src='../../../assets/img/icons/chevron-right.png'"> | ||
</button> | ||
</a> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<span style="display:block; height: 20px;"></span> | ||
<div class="progress"> | ||
<div id="cantKeepUpBar" class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="40" | ||
aria-valuemin="0" aria-valuemax="100" style="width:0%"> | ||
Cant Keep up | ||
</div> | ||
</div> | ||
<div class="progress"> | ||
<div id="decreaseVolumeBar" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="50" | ||
aria-valuemin="0" aria-valuemax="100" style="width:0%"> | ||
Decrease Volume | ||
</div> | ||
</div> | ||
<div class="progress"> | ||
<div id="increaseVolumeBar" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="60" | ||
aria-valuemin="0" aria-valuemax="100" style="width:0%"> | ||
Increase Volume | ||
</div> | ||
</div> | ||
<div class="progress"> | ||
<div id="decreaseSpeedBar" class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="40" | ||
aria-valuemin="0" aria-valuemax="100" style="width:0%"> | ||
Decrease Speed | ||
</div> | ||
</div> | ||
<div class="progress"> | ||
<div id="increaseSpeedBar" class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="70" | ||
aria-valuemin="0" aria-valuemax="100" style="width:0%"> | ||
Increase Speed | ||
</div> | ||
</div> | ||
|
||
<a href="/"> | ||
<button type="button" class="btn btn-primary"> | ||
Home | ||
<button type="button" class="btn btn-primary" ng-click="resetVotes()"> | ||
Reset votes | ||
</button> | ||
</a> | ||
<div class="container vertical-center"> | ||
<table class="table"> | ||
<tbody> | ||
<tr ng-repeat="question in kolabDBScope" class="questionRows"> | ||
<!--<td>{{question.number}}</td>--> | ||
<td class="td-question">{{question.text}}</td> | ||
<td> | ||
<button class="btn btn-danger btn-lg btn-block btn-remove" ng-click="remove(question._id)">Remove | ||
</button> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
<span style="display:block; height: 20px;"></span> | ||
<table id="lecturerTable" class="table lecturer-table"> | ||
<tbody> | ||
<tr ng-repeat="question in kolabDBScope" class="questionRows"> | ||
<!--<td>{{question.number}}</td>--> | ||
<td width="80%" class="td-question">{{question.text}}</td> | ||
<td width="20%"> | ||
<button class="btn btn-lg btn-block btn-remove" ng-click="remove($index, question._id)"> | ||
<img class="lecturer-button-icon" src="../../../assets/img/icons/remove.svg" onerror="this.onerror=null; this.src='../../../assets/img/icons/remove.png'"> | ||
</button> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> |
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
Oops, something went wrong.