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

feat finalize course works kinda.

parent 189ed6e9
No related branches found
No related tags found
No related merge requests found
Showing
with 118 additions and 162 deletions
......@@ -6,7 +6,6 @@ import unipotsdam.gf.core.states.model.ConstraintsMessages;
import unipotsdam.gf.core.states.model.ProjectPhase;
import unipotsdam.gf.interfaces.*;
import unipotsdam.gf.modules.assessment.controller.model.StudentIdentifier;
import unipotsdam.gf.modules.assessment.controller.model.cheatCheckerMethods;
import unipotsdam.gf.modules.assessment.controller.service.PeerAssessment;
import unipotsdam.gf.modules.communication.service.CommunicationDummyService;
import unipotsdam.gf.modules.journal.service.IJournalImpl;
......@@ -39,6 +38,7 @@ public class PhasesImpl implements IPhases {
/**
* use this if you don't know how dependency injection works
*
* @param iPeerAssessment
* @param feedback
* @param iCommunication
......@@ -77,54 +77,54 @@ public class PhasesImpl implements IPhases {
public void endPhase(ProjectPhase currentPhase, Project project) {
ProjectPhase changeToPhase = getNextPhase(currentPhase);
Map<StudentIdentifier, ConstraintsMessages> tasks;
if (changeToPhase != null)
switch (changeToPhase) {
switch (currentPhase) {
case CourseCreation:
// saving the state
saveState(project,changeToPhase);
saveState(project, changeToPhase);
break;
case GroupFormation:
// inform users about the formed groups, optionally giving them a hint on what happens next
iCommunication.sendMessageToUsers(project, Messages.GroupFormation(project));
saveState(project,changeToPhase);
saveState(project, changeToPhase);
break;
case DossierFeedback:
// check if everybody has uploaded a dossier
tasks = feedback.checkFeedbackConstraints(project);
if (tasks.size()>0) {
if (tasks.size() > 0) {
iCommunication.informAboutMissingTasks(tasks, project);
} else {
// send a message to the users informing them about the start of the new phase
iCommunication.sendMessageToUsers(project, Messages.NewFeedbackTask(project));
saveState(project,changeToPhase);
saveState(project, changeToPhase);
}
break;
case Execution:
// check if the portfolios have been prepared for evaluation (relevant entries selected)
tasks = iJournal.getPortfoliosForEvaluationPrepared(project);
if (tasks.size()<1) {
if (tasks.size() < 1) {
// inform users about the end of the phase
iCommunication.sendMessageToUsers(project, Messages.AssessmentPhaseStarted(project));
saveState(project,changeToPhase);
saveState(project, changeToPhase);
} else {
iCommunication.informAboutMissingTasks(tasks, project);
}
break;
case Assessment:
tasks = iPeerAssessment.allAssessmentsDone(project.getId());
if(tasks.size()<1){
if (tasks.size() < 1) {
iCommunication.sendMessageToUsers(project, Messages.CourseEnds(project));
iPeerAssessment.finalizeAssessment(project.getId());
saveState(project, changeToPhase);
}else{
} else {
iPeerAssessment.assignMissingAssessmentTasks(project);
}
break;
case Projectfinished:
closeProject();
break;
default:{}
default: {
}
}
}
......@@ -144,16 +144,17 @@ public class PhasesImpl implements IPhases {
return ProjectPhase.Assessment;
case Assessment:
return ProjectPhase.Projectfinished;
default:
return ProjectPhase.Projectfinished;
}
return null;
}
private void saveState(Project project, ProjectPhase currentPhase) {
private void saveState(Project project, ProjectPhase phase) {
assert project.getId() != null;
MysqlConnect connect = new MysqlConnect();
connect.connect();
String mysqlRequest = "UPDATE `projects` SET `phase`=? WHERE id=? LIMIT 1";
connect.issueUpdateStatement(mysqlRequest, currentPhase.name(), project.getId());
connect.issueUpdateStatement(mysqlRequest, phase.name(), project.getId());
connect.close();
}
......
......@@ -24,7 +24,7 @@ public interface IPeerAssessment {
*/
Map<StudentIdentifier, Double> getAssessmentForProject(String projectId);
Map<StudentIdentifier, Double> getAssessmentForStudent(StudentIdentifier student);
Double getAssessmentForStudent(StudentIdentifier student);
//todo: obsolete, get rid of the following function
Map<StudentIdentifier, Double> calculateAssessment(ArrayList<Performance> totalPerformance);
......
......@@ -134,6 +134,21 @@ class AssessmentDBCommunication {
return vereinfachtesResultSet.next();
}
Integer getQuizCount(String projectId){
Integer result = 0;
MysqlConnect connect = new MysqlConnect();
connect.connect();
String mysqlRequest = "SELECT * FROM `quiz` WHERE `projectId`=?";
VereinfachtesResultSet vereinfachtesResultSet =
connect.issueSelectStatement(mysqlRequest, projectId);
Boolean next = vereinfachtesResultSet.next();
while (next){
result++;
next = vereinfachtesResultSet.next();
}
return result;
}
ArrayList<Integer> getAnsweredQuizzes(StudentIdentifier student) {
ArrayList<Integer> result = new ArrayList<>();
MysqlConnect connect = new MysqlConnect();
......@@ -246,6 +261,17 @@ class AssessmentDBCommunication {
connect.close();
}
Double getGradesFromDB(StudentIdentifier student) {
MysqlConnect connect = new MysqlConnect();
connect.connect();
String mysqlRequest = "SELECT * FROM `grades` WHERE `projectId`=? AND `studentId`=?";
//todo: fix this. for some reason it throws an error
VereinfachtesResultSet vereinfachtesResultSet =
connect.issueSelectStatement(mysqlRequest, student.getProjectId(), student.getStudentId());
vereinfachtesResultSet.next();
return vereinfachtesResultSet.getDouble("grade");
}
Map<String, Boolean> getAnswers(String projectId, String question) {
MysqlConnect connect = new MysqlConnect();
connect.connect();
......
......@@ -36,8 +36,8 @@ public class PeerAssessment implements IPeerAssessment {
}
@Override
public Map<StudentIdentifier, Double> getAssessmentForStudent(StudentIdentifier student) {
return null;
public Double getAssessmentForStudent(StudentIdentifier student) {
return new AssessmentDBCommunication().getGradesFromDB(student);
}
@Override
......@@ -113,7 +113,12 @@ public class PeerAssessment implements IPeerAssessment {
Performance performance = new Performance();
StudentIdentifier studentIdentifier = new StudentIdentifier(projectId, student);
groupId = new AssessmentDBCommunication().getGroupByStudent(studentIdentifier);
//todo: answered quizzes vervöllstandigen
Integer numberOfQuizzes = new AssessmentDBCommunication().getQuizCount(projectId);
List<Integer> answeredQuizzes = new AssessmentDBCommunication().getAnsweredQuizzes(studentIdentifier);
for (Integer i=answeredQuizzes.size(); i<numberOfQuizzes;i++){
answeredQuizzes.add(0);
}
ArrayList<Map<String, Double>> workRating = new AssessmentDBCommunication().getWorkRating(studentIdentifier);
ArrayList<Map<String, Double>> contributionRating =
new AssessmentDBCommunication().getContributionRating(groupId);
......
......@@ -118,10 +118,10 @@ public class QuizView {
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/get/project/{projectId}/student/{studentId}")
public Map<StudentIdentifier, Double> getAssessmentForStudent(@PathParam("projectId") String projectId, @PathParam("studentId") String studentId) {
public Double getAssessmentForStudent(@PathParam("projectId") String projectId, @PathParam("studentId") String studentId) {
StudentIdentifier student = new StudentIdentifier(projectId, studentId);
return peer.getAssessmentForStudent(student);
} //////////dummy//////////////funktioniert wie geplant//////////////////////////////////
}
@POST
......
$(document).ready(function(){
let projectId="gemeinsamForschen";
updateStatus(projectId);
$('#project1Link').on('click', function(){
location.href="project-student.jsp?token="+getUserTokenFromUrl()+'&projectId='+'gemeinsamForschen';
});
......@@ -8,4 +10,61 @@ $(document).ready(function(){
$('#enrollProject').on('click', function(){
location.href="enrollProject.jsp?token="+getUserTokenFromUrl();
});
});
\ No newline at end of file
});
function updateStatus(projectId){
$.ajax({
url: 'rest/phases/projects/'+projectId,
headers: {
"Content-Type": "application/json",
"Cache-Control": "no-cache"
},
type: 'GET',
success: function (response) {
let statusField = $('#status'+projectId);
switch (response){
case "CourseCreation":
statusField.html("Der Kurs wurde gerade angelegt. Sie können sich nun anmelden.");
break;
case "GroupFormation":
statusField.html("Ihr Dozent ordnet Sie nun einer Gruppe zu.");
break;
case "DossierFeedback":
statusField.html("Geben sie wenigstens einem Gruppenmitglied Feedback und erstellen sie ein Dossier in Ihrer Gruppe.");
break;
case "Execution":
statusField.html("Forschen Sie zu Ihrer Forschungsfrage und reflektieren Sie ihr Vorgehen mit dem Journal");
break;
case "Assessment":
statusField.html("Nehmen Sie die Bewertungen vor.");
break;
case "Projectfinished":
getGrade(projectId);
break;
default:
break;
}
},
error: function (a) {
}
});
}
function getGrade(projectId){
let studentId = $('#user').html().trim();
$.ajax({
url: 'rest/assessments/get/project/'+projectId+'/student/'+studentId,
headers: {
"Content-Type": "application/json",
"Cache-Control": "no-cache"
},
type: 'GET',
success: function (response) {
$('#status'+projectId).html("Sie erreichten "+response+"%");
},
error: function(a){
}
});
}
\ No newline at end of file
......@@ -34,7 +34,7 @@
<div class="alert" id="Assessment">
<p>Bewertungsphase</p>
</div>
<div class="alert" id="end">
<div class="alert" id="Projectfinished">
<p>Ende</p>
</div>
</div>
......
......@@ -19,6 +19,6 @@
.arrowAssessment{
margin-top:305px;
}
.arrowDone{
.arrowProjectfinished{
visibility: hidden;
}
\ No newline at end of file
......@@ -50,7 +50,7 @@ function changePhase(currentPhase){
},
type: 'POST',
success: function () {
location.reload(1);
location.reload(true);
},
error: function (a) {
......
$(document).ready(function(){
$('#project1Link').on('click', function(){
window.location.href="project-docent_CG.jsp?token="+getUserTokenFromUrl();
location.href="project-docent_CG.jsp?token="+getUserTokenFromUrl()+'&projectId='+'gemeinsamForschen';
});
$('#project2Link').on('click', function(){
window.location.href="project-docent_CG.jsp?token="+getUserTokenFromUrl();
location.href="project-docent_CG.jsp?token="+getUserTokenFromUrl()+'&projectId='+'Kaleo';
});
$('#createProject').on('click', function(){
location.href="createProject.jsp?token="+getUserTokenFromUrl();
});
});
\ No newline at end of file
$(document).ready(function(){
$('#project1Link').on('click', function(){
location.href="project-student.jsp?token="+getUserTokenFromUrl()+'&projectId='+'gemeinsamForschen';
});
$('#project2Link').on('click', function(){
location.href="project-student.jsp?token="+getUserTokenFromUrl()+'&projectId='+'Kaleo';
});
$('#enrollProject').on('click', function(){
location.href="enrollProject.jsp?token="+getUserTokenFromUrl();
});
});
\ No newline at end of file
$(document).ready(function(){
// fetch all submission part project representations from database
getSubmissionPartsByProjectId(getQueryVariable("projectId"), function (response) {
// iterate over response and display each element
for (let i = 0; i < response.length; i++) {
displaySubmission(response[i].user, response[i].category, response[i].fullSubmissionId);
}
// add click listener to feedback buttons
$('.annotationview').click(function () {
let fullSubmissionId = $(this).closest("li").data("fullSubmissionId");
let category = $(this).closest("li").data("category");
location.href="annotation-document.jsp?token=" + getUserTokenFromUrl() +
"&projectId=" + getQueryVariable("projectId") +
"&fullSubmissionId=" + fullSubmissionId +
"&category=" + category;
});
}, function () {
// display empty view
displayEmptyView()
});
/*
var memberTable = $('#myGroupMembers');
memberTable.hide();
$('#nextPhase').on('click',function(){
memberTable.show();
});
*/
$('.givefeedback').click(function () {
location.href="give-feedback.jsp?token="+getUserTokenFromUrl();
});
$('.viewfeedback').click(function () {
location.href="view-feedback.jsp?token="+getUserTokenFromUrl();
});
$('.annotationview').click(function () {
location.href="annotation-document.jsp?token="+getUserTokenFromUrl();
});
$('#btnUnstructuredUpload').click(function () {
location.href="upload-unstructured-annotation.jsp?token="+getUserTokenFromUrl() + "&projectId=" + getQueryVariable("projectId");
})
$('.viewprojectstudent').click(function () {
location.href="project-student.jsp?token="+getUserTokenFromUrl();
})
});
/**
* Display category of submission part in list
*
* @param user The user of the submission part
* @param category The category of the submission part
* @param fullSubmissionId The id of the full submission the submission part belongs to
*/
function displaySubmission(user, category, fullSubmissionId) {
// build link
$('#submissionUpload').append(
$('<li>')
.append($('<span>').append(category.toUpperCase() + " eingereicht"))
.append($('<a>').attr("class", "annotationview").attr("role", "button")
.append($('<label>').css("font-size", "10px")
.append($('<i>').attr("class", "far fa-comments").css("font-size", "15px"))
.append("feedback")
)
)
// add data to link
.data("fullSubmissionId", fullSubmissionId)
.data("category", category)
);
}
/**
* Display a not found message if there are no submission parts in the database (or on error)
*/
function displayEmptyView() {
// build link
$('#submissionUpload').append(
$('<li>')
.append($('<span>').append("keine Daten gefunden"))
);
}
/**
* GET: Get all representations of a submission part for a given project id
*
* @param projectId The id of the project
* @param responseHandler The response handler
* @param errorHandler The error handler
*/
function getSubmissionPartsByProjectId(projectId, responseHandler, errorHandler) {
var url = "../rest/submissions/project/" + projectId;
$.ajax({
url: url,
type: "GET",
dataType: "json",
success: function (response) {
// handle the response
responseHandler(response);
},
error: function () {
// handle the error
errorHandler();
}
})
}
\ 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/gemeinsamForschen.tld" prefix="menu" %>
<%@ taglib uri="../core/gemeinsamForschen.tld" prefix="headLine" %>
<%@ taglib uri="../core/gemeinsamForschen.tld" prefix="omniDependencies" %>
......@@ -33,7 +33,7 @@
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Newsfeed </h3>
Status: abgeschlossen mit Bewertung 2+
Status: <p id="statusgemeinsamForschen"></p>
</div>
<div class="panel-body">
<ul class="list-group">
......@@ -67,7 +67,7 @@
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Newsfeed </h3>
Status: Gruppenbildung
Status: <p id="statusKaleo"></p>
</div>
<div class="panel-body">
<ul class="list-group">
......
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