Skip to content
Snippets Groups Projects
Commit beb97f33 authored by Axel's avatar Axel
Browse files

fix: DB communication for assessments

feat: docent quiz page
parent bf247012
No related branches found
No related tags found
No related merge requests found
Showing
with 213 additions and 76 deletions
...@@ -212,9 +212,9 @@ public class ManagementImpl implements Management { ...@@ -212,9 +212,9 @@ public class ManagementImpl implements Management {
/** /**
* TODO @Axel bitte in modules/asessment verschieben *
* @param projectId * @param field
* @param quizId * @param value
* @return * @return
*/ */
private User getUserByField(String field, String value) { private User getUserByField(String field, String value) {
......
...@@ -38,7 +38,7 @@ public class Menu extends SimpleTagSupport { ...@@ -38,7 +38,7 @@ public class Menu extends SimpleTagSupport {
out.println("<div id=\"sidebar-wrapper\">\n" + out.println("<div id=\"sidebar-wrapper\">\n" +
" <ul class=\"sidebar-nav\">\n" + " <ul class=\"sidebar-nav\">\n" +
" <li class=\"sidebar-brand\"><a href=\"overview-docent.jsp?token="+token+"&projectId="+projectId+"\">overview</a></li>\n" + " <li class=\"sidebar-brand\"><a href=\"overview-docent.jsp?token="+token+"&projectId="+projectId+"\">overview</a></li>\n" +
" <li><a href=\"Quiz.jsp?token="+token+"&projectId="+projectId+"\">Quizfrage</a></li>\n" + " <li><a href=\"Quiz-docent.jsp?token="+token+"&projectId="+projectId+"\">Quizfrage</a></li>\n" +
" <li><a href=\"#\">ePortfolio</a></li>\n" + " <li><a href=\"#\">ePortfolio</a></li>\n" +
" <li><a href=\"#\">Beitrag</a></li>\n" + " <li><a href=\"#\">Beitrag</a></li>\n" +
" <li><a href=\"#\">Gruppen erstellen</a></li>\n" + " <li><a href=\"#\">Gruppen erstellen</a></li>\n" +
...@@ -64,4 +64,4 @@ public class Menu extends SimpleTagSupport { ...@@ -64,4 +64,4 @@ public class Menu extends SimpleTagSupport {
} }
}; }
\ No newline at end of file \ No newline at end of file
...@@ -16,6 +16,7 @@ import java.util.Map; ...@@ -16,6 +16,7 @@ import java.util.Map;
@Resource @Resource
@Singleton @Singleton
class AssessmentDBCommunication { class AssessmentDBCommunication {
ArrayList<Map<String, Double>> getWorkRating(StudentIdentifier student) { ArrayList<Map<String, Double>> getWorkRating(StudentIdentifier student) {
ArrayList<Map<String, Double>> result = new ArrayList<>(); ArrayList<Map<String, Double>> result = new ArrayList<>();
MysqlConnect connect = new MysqlConnect(); MysqlConnect connect = new MysqlConnect();
...@@ -124,13 +125,19 @@ class AssessmentDBCommunication { ...@@ -124,13 +125,19 @@ class AssessmentDBCommunication {
void writeContributionRatingToDB(StudentIdentifier student, String fromStudent, Map<String, Integer> contributionRating) { void writeContributionRatingToDB(StudentIdentifier student, String fromStudent, Map<String, Integer> contributionRating) {
MysqlConnect connect = new MysqlConnect(); MysqlConnect connect = new MysqlConnect();
connect.connect(); connect.connect();
String mysqlRequest = "INSERT INTO `contributionrating`(`studentId`, `projectId`, `fromPeer`, " + String mysqlRequest = "INSERT INTO `contributionrating`(" +
"`studentId`, " +
"`projectId`, " +
"`fromPeer`, " +
"`dossier`, " + "`dossier`, " +
"`eJournal`, " + "`eJournal`, " +
"`research`" + "`research`) " +
") VALUES (?,?,?,?,?,?)"; "VALUES (?,?,?,?,?,?)";
connect.issueInsertOrDeleteStatement(mysqlRequest, student.getProjectId(), student.getStudentId(), fromStudent, connect.issueInsertOrDeleteStatement(mysqlRequest,
contributionRating.get("Dossier"), student.getStudentId(),
student.getProjectId(),
fromStudent,
contributionRating.get("dossier"),
contributionRating.get("eJournal"), contributionRating.get("eJournal"),
contributionRating.get("research") contributionRating.get("research")
); );
......
package unipotsdam.gf.modules.assessment.controller.service; package unipotsdam.gf.modules.assessment.controller.service;
import unipotsdam.gf.core.management.user.User;
import unipotsdam.gf.interfaces.IPeerAssessment; import unipotsdam.gf.interfaces.IPeerAssessment;
import unipotsdam.gf.modules.assessment.QuizAnswer; import unipotsdam.gf.modules.assessment.QuizAnswer;
import unipotsdam.gf.modules.assessment.controller.model.*; import unipotsdam.gf.modules.assessment.controller.model.*;
...@@ -202,7 +203,7 @@ public class PeerAssessment implements IPeerAssessment { ...@@ -202,7 +203,7 @@ public class PeerAssessment implements IPeerAssessment {
public void postPeerRating(ArrayList<PeerRating> peerRatings, String projectId) { public void postPeerRating(ArrayList<PeerRating> peerRatings, String projectId) {
for (PeerRating peer: peerRatings){ for (PeerRating peer: peerRatings){
StudentIdentifier student = new StudentIdentifier(projectId, peer.getToPeer()); StudentIdentifier student = new StudentIdentifier(projectId, peer.getToPeer());
new AssessmentDBCommunication().writeWorkRatingToDB(student, peerRatings.get(1).getFromPeer(), peerRatings.get(1).getWorkRating()); new AssessmentDBCommunication().writeWorkRatingToDB(student, peer.getFromPeer(), peer.getWorkRating());
} }
} }
......
$(document).ready(function () {
$('#newQuiz').on('click', function(){
location.href="createQuiz.jsp?token="+getUserTokenFromUrl()+"&projectId="+$('#projectId').html().trim();
});
let loading = $('#loadbar').hide();
$(document)
.ajaxStart(function () {
loading.show();
}).ajaxStop(function () {
loading.hide();
});
$("label.btn").on('click',function () {
let choice = $(this).find('input:radio').val();
$('#loadbar').show();
$('#quiz').fadeOut();
setTimeout(function(){
$( "#answer" ).html( $(this).checking(choice) );
$('#quiz').show();
$('#loadbar').fadeOut();
/* something else */
}, 1500);
});
$ans = 3;
let projectId = document.getElementById('projectId').innerText.trim();
$.ajax({
url: '../rest/assessments/project/'+projectId+'/quiz/',
type: 'GET',
success: function (data) {
let table = document.getElementById('tableQuiz');
for (let quiz = 0; quiz < data.length; quiz++){
let question = data[quiz].question.replace(/ /g,"").replace("?","").replace(",","");
let answers = data[quiz].correctAnswers.concat(data[quiz].incorrectAnswers);
let colspan = answers.length;
let trQuestion = document.createElement('TR');
let tdQuestion = '<td colspan="' + colspan + '"' +
' data-toggle="collapse" href="#'+question+'" aria-expanded="false" aria-controls="'+question+'">' +
'' + data[quiz].question + '</td>';
trQuestion.innerHTML = tdQuestion;
let trAnswers = document.createElement('TR');
let answersTd='<td style="display: block;">' +
'<div ' +
'class="quiz collapse" ' +
'id="'+question+'" ' +
'data-toggle="buttons">' +
'<p hidden>'+data[quiz].question+'</p>';
for (let i = 0; i < answers.length; i++) {
answersTd = answersTd + '<div>' +
'<label class="element-animation1 btn btn-lg btn-primary btn-block">' +
'<span class="btn-label">' +
'<i class="glyphicon glyphicon-chevron-right">' +
'</i>' +
'</span>' +
'<input type="checkbox" value="'+answers[i]+'">' + answers[i] + '' +
'</label>' +
'</div>';
}
tdQuestion ="";
answers=[];
let deletebutton = '<button class="btn btn-danger" id="delete'+question+'">löschen</button>';
trAnswers.innerHTML = answersTd+deletebutton+'</div></td>';
table.appendChild(trQuestion);
table.appendChild(trAnswers);
$("#delete"+question).click({quizId: data[quiz].question}, deleteQuiz);
}
},
error: function (a) {
alert('Fehler ' + a);
}
});
function deleteQuiz(event){
$.ajax({
url: '../rest/assessments/quiz/' + encodeURIComponent(event.data.quizId),
type: 'POST',
success: function () {
document.location.href="Quiz-docent.jsp?token="+getUserTokenFromUrl()+"&projectId="+$('#projectId').html().trim();
},
error: function(a){
alert(a)
}
});
}
});
$(document).ready(function(){ $(document).ready(function(){
var projectId = document.getElementById('projectId').innerText.trim(); let projectId = document.getElementById('projectId').innerText.trim();
$.ajax({ $.ajax({
url: '../rest/assessments/project/'+projectId+'/quiz/', url: '../rest/assessments/project/'+projectId+'/quiz/',
projectId: projectId, projectId: projectId,
type: 'GET', type: 'GET',
success: function (data) { success: function (data) {
var table = document.getElementById('myQuizzes'); let table = document.getElementById('myQuizzes');
for (var quiz = 0; quiz < data.length; quiz++){ for (let quiz = 0; quiz < data.length; quiz++){
var answers = data[quiz].correctAnswers.concat(data[quiz].incorrectAnswers); let answers = data[quiz].correctAnswers.concat(data[quiz].incorrectAnswers);
var colspan = answers.length; let colspan = answers.length;
var trQuestion = document.createElement('TR'); let trQuestion = document.createElement('TR');
trQuestion.className="pageChanger"; trQuestion.className="pageChanger";
trQuestion.innerHTML = '<td colspan="' + colspan + '"><h3>' + trQuestion.innerHTML = '<td colspan="' + colspan + '"><h3>' +
'<a href="viewQuiz.jsp' + '<a href="viewQuiz.jsp' +
...@@ -20,7 +20,7 @@ $(document).ready(function(){ ...@@ -20,7 +20,7 @@ $(document).ready(function(){
table.appendChild(trQuestion); table.appendChild(trQuestion);
} }
}, },
error: function (a, b, c) { error: function (a) {
alert('Fehler ' + a); alert('Fehler ' + a);
} }
}); });
......
...@@ -33,7 +33,7 @@ function assessPeer(){ ...@@ -33,7 +33,7 @@ function assessPeer(){
} }
for (let peer=0; peer< dataP.length; peer++){ for (let peer=0; peer< dataP.length; peer++){
for (let workRating=0; workRating<rateThis.length;workRating++){ for (let workRating=0; workRating<rateThis.length;workRating++){
if(dataP[peer][workRating]===undefined){ if(dataP[peer].workRating[rateThis[workRating]]===undefined){
$('#notAllRated').show(); $('#notAllRated').show();
return; return;
} }
......
$(document).ready(function(){ $(document).ready(function(){
$('#project1Link').on('click', function(){ $('#project1Link').on('click', function(){
location.href="project-docent.jsp?token="+getUserTokenFromUrl(); location.href="project-docent.jsp?token="+getUserTokenFromUrl()+'&projectId='+'gemeinsamForschen';
}); });
$('#project2Link').on('click', function(){ $('#project2Link').on('click', function(){
location.href="project-docent.jsp?token="+getUserTokenFromUrl(); location.href="project-docent.jsp?token="+getUserTokenFromUrl()+'&projectId='+'Kaleo';
}); });
$('#createProject').on('click', function(){ $('#createProject').on('click', function(){
location.href="createProject.jsp?token="+getUserTokenFromUrl(); location.href="createProject.jsp?token="+getUserTokenFromUrl();
......
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="menu" %>
<%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="headLine" %>
<%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="omniDependencies" %>
<html>
<head>
<omniDependencies:omniDependencies/>
<script src="../assets/js/Quiz-docent.js"></script>
</head>
<body>
<div id="wrapper">
<menu:menu/>
<div class="page-content-wrapper">
<headLine:headLine/>
<table class="table-striped">
<tbody id="tableQuiz">
</tbody>
</table>
<button class="btn btn-primary" id="newQuiz">neues Quiz</button>
</div>
</div>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="menu" %> <%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="menu" %>
<%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="headLine" %> <%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="headLine" %>
<%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="omniDependencies" %> <%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="omniDependencies" %>
...@@ -85,8 +85,6 @@ ...@@ -85,8 +85,6 @@
</div> </div>
<button class="btn btn-default" type="button" id="createProject" style="margin-left:250px;">Projekt erstellen</button> <button class="btn btn-default" type="button" id="createProject" style="margin-left:250px;">Projekt erstellen</button>
</div> </div>
</div>
</body> </body>
</html> </html>
\ No newline at end of file
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix = "communication" uri = "/communication/chatWindow.tld"%> <%@ taglib prefix="communication" uri="/communication/chatWindow.tld" %>
<%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="menu" %> <%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="menu" %>
<%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="headLine" %> <%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="headLine" %>
<%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="omniDependencies" %> <%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="omniDependencies" %>
...@@ -16,11 +16,11 @@ ...@@ -16,11 +16,11 @@
<div id="wrapper"> <div id="wrapper">
<menu:menu/> <menu:menu/>
<div class="page-content-wrapper"> <div class="page-content-wrapper">
<div class="container-fluid"> <headLine:headLine/>
<h1>dummy Projekt1 für Dozent1</h1><button class="btn btn-default" type="button">Gruppen erstellen</button><button class="btn btn-default" type="button">Projekt finalisieren</button><button class="btn btn-default" type="button">Exportiere Projektergebnisse</button> <button
</div> class="btn btn-default" type="button">Exportiere Zwischenstand
<button </button>
class="btn btn-default" type="button">Exportiere Zwischenstand</button><button class="btn btn-default" type="button">Quizfrage erstellen</button> <button class="btn btn-default" type="button">Quizfrage erstellen</button>
<div> <div>
<div class="container"> <div class="container">
<div class="row"> <div class="row">
...@@ -28,60 +28,60 @@ ...@@ -28,60 +28,60 @@
<div class="table-responsive" style="width:294px;"> <div class="table-responsive" style="width:294px;">
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th>Gruppe1 </th> <th>Gruppe1</th>
<th>Beiträge </th> <th>Beiträge</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>student1 </td> <td>student1</td>
<td>Interfaces </td> <td>Interfaces</td>
</tr> </tr>
<tr> <tr>
<td>student2 </td> <td>student2</td>
<td>Design </td> <td>Design</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="table-responsive" style="width:294px;"> <div class="table-responsive" style="width:294px;">
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th>Gruppe2 </th> <th>Gruppe2</th>
<th>Beiträge </th> <th>Beiträge</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>student3 </td> <td>student3</td>
<td>Interfaces </td> <td>Interfaces</td>
</tr> </tr>
<tr> <tr>
<td>student4 </td> <td>student4</td>
<td>Design </td> <td>Design</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="table-responsive" style="width:294px;"> <div class="table-responsive" style="width:294px;">
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th>Gruppe3 </th> <th>Gruppe3</th>
<th>Beiträge </th> <th>Beiträge</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>student5 </td> <td>student5</td>
<td>Interfaces </td> <td>Interfaces</td>
</tr> </tr>
<tr> <tr>
<td>student6 </td> <td>student6</td>
<td>Design </td> <td>Design</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
...@@ -98,12 +98,18 @@ ...@@ -98,12 +98,18 @@
<div class="media-left"><a></a></div> <div class="media-left"><a></a></div>
<div class="media-body"> <div class="media-body">
<div class="media" style="overflow:visible;"> <div class="media" style="overflow:visible;">
<div class="media-left"><a><img src="../assets/img/1.jpg" class="img-rounded" style="width: 25px; height:25px;"></a></div> <div class="media-left"><a><img src="../assets/img/1.jpg"
class="img-rounded"
style="width: 25px; height:25px;"></a>
</div>
<div class="media-body" style="overflow:visible;"> <div class="media-body" style="overflow:visible;">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<p><a href="#">Sara Doe:</a> This guy has been going 100+ MPH on side streets. <br> <p><a href="#">Sara Doe:</a> This guy has been going
<small class="text-muted">August 6, 2016 @ 10:35am </small></p> 100+ MPH on side streets. <br>
<small class="text-muted">August 6, 2016 @ 10:35am
</small>
</p>
</div> </div>
</div> </div>
</div> </div>
...@@ -116,12 +122,18 @@ ...@@ -116,12 +122,18 @@
<div class="media-left"><a></a></div> <div class="media-left"><a></a></div>
<div class="media-body"> <div class="media-body">
<div class="media" style="overflow:visible;"> <div class="media" style="overflow:visible;">
<div class="media-left"><a><img src="../assets/img/1.jpg" class="img-rounded" style="width: 25px; height:25px;"></a></div> <div class="media-left"><a><img src="../assets/img/1.jpg"
class="img-rounded"
style="width: 25px; height:25px;"></a>
</div>
<div class="media-body" style="overflow:visible;"> <div class="media-body" style="overflow:visible;">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<p><a href="#">Brennan Prill:</a> This guy has been going 100+ MPH on side streets. <br> <p><a href="#">Brennan Prill:</a> This guy has been
<small class="text-muted">August 6, 2016 @ 10:35am </small></p> going 100+ MPH on side streets. <br>
<small class="text-muted">August 6, 2016 @ 10:35am
</small>
</p>
</div> </div>
</div> </div>
</div> </div>
...@@ -129,7 +141,11 @@ ...@@ -129,7 +141,11 @@
</div> </div>
</div> </div>
</li> </li>
</ul><button class="btn btn-default" type="button" style="margin-left:601px;margin-top:-9px;">Add Comment</button></div> </ul>
<button class="btn btn-default" type="button"
style="margin-left:601px;margin-top:-9px;">Add Comment
</button>
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -137,7 +153,7 @@ ...@@ -137,7 +153,7 @@
</div> </div>
</div> </div>
</div> </div>
<communication:chatWindow orientation="right"></communication:chatWindow> <communication:chatWindow orientation="right" />
</body> </body>
</html> </html>
\ No newline at end of file
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="menu" %> <%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="menu" %>
<%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="headLine" %> <%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="headLine" %>
<%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="omniDependencies" %> <%@ taglib uri="../core/pages/gemeinsamForschen.tld" prefix="omniDependencies" %>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment