From 36b80acbca6d9c5c919cdeede29f036c518058f8 Mon Sep 17 00:00:00 2001 From: Axel <wiepke@uni-potsdam.de> Date: Tue, 29 May 2018 15:57:12 +0200 Subject: [PATCH] Peer Assessment Interface by Axel added --- .../gf/interfaces/IPeerAssessment.java | 13 +++-- .../assessment/controller/Assessment.java | 35 ++++++++++++++ .../assessment/controller/AssessmentDAO.java | 6 +-- .../assessment/controller/FBAssessement.java | 26 +++++++++- .../assessment/controller/Performance.java | 48 +++++++++++++++++++ .../controller/StudentIdentifier.java | 35 ++++++++++++++ .../munchkin/controller/MunchkinImpl.java | 4 +- .../modules/assessment/TestAddAssessment.java | 32 +++++++++++++ gemeinsamforschen/web/WEB-INF/web.xml | 6 +++ gemeinsamforschen/web/index.jsp | 16 +++++++ 10 files changed, 210 insertions(+), 11 deletions(-) create mode 100644 gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/Assessment.java create mode 100644 gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/Performance.java create mode 100644 gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/StudentIdentifier.java create mode 100644 gemeinsamforschen/src/test/java/unipotsdam/gf/modules/assessment/TestAddAssessment.java create mode 100644 gemeinsamforschen/web/WEB-INF/web.xml create mode 100644 gemeinsamforschen/web/index.jsp diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/interfaces/IPeerAssessment.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/interfaces/IPeerAssessment.java index aba97d4d..41108334 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/interfaces/IPeerAssessment.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/interfaces/IPeerAssessment.java @@ -1,10 +1,17 @@ package unipotsdam.gf.interfaces; +import unipotsdam.gf.modules.assessment.controller.Assessment; +import unipotsdam.gf.modules.assessment.controller.Performance; +import unipotsdam.gf.modules.assessment.controller.StudentIdentifier; + /** * Created by dehne on 18.05.2018. */ public interface IPeerAssessment { - void addAssessmentData(Object data); - void calculateAssessment(String projectId); - Object getAssessmentResults(String projectId, String assessmentIdentifier); + void addAssessmentDataToDB(Assessment assessment); //student and performance are written to DB + Assessment getAssessmentDataFromDB(StudentIdentifier student); + boolean permission(int feedbackCount); + void createQuiz(StudentIdentifier student, String question, String[] answers); //writes a new question into the DB + int[] calculateAssessment(Performance[] performanceOfAllStudents); // calculates marks for every performance and writes it to an array + int meanOfAssessement(String ProjectId); } diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/Assessment.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/Assessment.java new file mode 100644 index 00000000..bfd450bc --- /dev/null +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/Assessment.java @@ -0,0 +1,35 @@ +package unipotsdam.gf.modules.assessment.controller; + +public class Assessment { + private StudentIdentifier student; + private Performance performance; + + public Assessment(StudentIdentifier student, Performance performance) { + this.student = student; + this.performance = performance; + } + + public StudentIdentifier getStudent() { + return student; + } + + public void setStudent(StudentIdentifier student) { + this.student = student; + } + + public Performance getPerformance() { + return performance; + } + + public void setPerformance(Performance performance) { + this.performance = performance; + } + + @Override + public String toString() { + return "Assessment{" + + "student=" + student + + ", performance=" + performance + + '}'; + } +} diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/AssessmentDAO.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/AssessmentDAO.java index 7873d97f..ed7b43d3 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/AssessmentDAO.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/AssessmentDAO.java @@ -7,13 +7,9 @@ import unipotsdam.gf.interfaces.IPeerAssessment; * Created by dehne on 18.05.2018. */ public abstract class AssessmentDAO implements IPeerAssessment { - @Override - public void addAssessmentData(Object data) { - // here please write DB access - } @Override - public Object getAssessmentResults(String projectId, String assessmentIdentifier) { + public Assessment getAssessmentDataFromDB(StudentIdentifier student) { return null; } } diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/FBAssessement.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/FBAssessement.java index 30b8b7e1..dbb4bf9d 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/FBAssessement.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/FBAssessement.java @@ -4,8 +4,32 @@ package unipotsdam.gf.modules.assessment.controller; * Created by dehne on 18.05.2018. */ public class FBAssessement extends AssessmentDAO { + + @Override + public void addAssessmentDataToDB(Assessment assessment) { + // write it to db + } + @Override - public void calculateAssessment(String projectId) { + public int[] calculateAssessment(Performance[] performanceOfAllStudents){ // calculates marks for every performance and writes it to an array + int[] dummy = new int[4]; + dummy[0]=1; + dummy[1]=4; + dummy[2]=3; + dummy[3]=2; + return dummy; + } + + public void createQuiz(StudentIdentifier student, String question, String[] answers){ //writes a new question into the DB } + + public boolean permission(int feedbackCount){ + return true; + } + + @Override + public int meanOfAssessement(String projectId) { + return 0; + } } diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/Performance.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/Performance.java new file mode 100644 index 00000000..7e05864f --- /dev/null +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/Performance.java @@ -0,0 +1,48 @@ +package unipotsdam.gf.modules.assessment.controller; + +import java.util.Arrays; + +public class Performance { + private int[] quizAnswer; + private String feedback; + private int[] workRating; + + public Performance(int[] quizAnswer, String feedback, int[] workRating) { + this.quizAnswer = quizAnswer; + this.feedback = feedback; + this.workRating = workRating; + } + + public int[] getQuizAnswer() { + return quizAnswer; + } + + public void setQuizAnswer(int[] quizAnswer) { + this.quizAnswer = quizAnswer; + } + + public String getFeedback() { + return feedback; + } + + public void setFeedback(String feedback) { + this.feedback = feedback; + } + + public int[] getWorkRating() { + return workRating; + } + + public void setWorkRating(int[] workRating) { + this.workRating = workRating; + } + + @Override + public String toString() { + return "Performance{" + + "quizAnswer=" + Arrays.toString(quizAnswer) + + ", feedback='" + feedback + '\'' + + ", workRating=" + Arrays.toString(workRating) + + '}'; + } +} diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/StudentIdentifier.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/StudentIdentifier.java new file mode 100644 index 00000000..05799b86 --- /dev/null +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/StudentIdentifier.java @@ -0,0 +1,35 @@ +package unipotsdam.gf.modules.assessment.controller; + +public class StudentIdentifier { + private String projectId; + private String studentId; + + public StudentIdentifier(String projectId, String studentId) { + this.projectId = projectId; + this.studentId = studentId; + } + + public String getProjectId() { + return projectId; + } + + public void setProjectId(String projectId) { + this.projectId = projectId; + } + + public String getStudentId() { + return studentId; + } + + public void setStudentId(String studentId) { + this.studentId = studentId; + } + + @Override + public String toString() { + return "StudentIdentifier{" + + "projectId='" + projectId + '\'' + + ", studentId='" + studentId + '\'' + + '}'; + } +} diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/munchkin/controller/MunchkinImpl.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/munchkin/controller/MunchkinImpl.java index a80be9a9..45853725 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/munchkin/controller/MunchkinImpl.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/munchkin/controller/MunchkinImpl.java @@ -14,8 +14,8 @@ public class MunchkinImpl implements IMunschkin { static final String DB_URL = "jdbc:mysql://localhost"; // Database credentials - static final String USER = "root2"; - static final String PASS = "voyager2"; + static final String USER = "root"; + static final String PASS = ""; // Es gibt natürlich auch libraries, die den Datenbankzugriff einfacher gestalten. Ziel soll sein, dass alle // die Basics können. Es ist auch sinnvoll, die Datenbankzugriffe in eine eigene Klasse auszulagern!! diff --git a/gemeinsamforschen/src/test/java/unipotsdam/gf/modules/assessment/TestAddAssessment.java b/gemeinsamforschen/src/test/java/unipotsdam/gf/modules/assessment/TestAddAssessment.java new file mode 100644 index 00000000..78071ead --- /dev/null +++ b/gemeinsamforschen/src/test/java/unipotsdam/gf/modules/assessment/TestAddAssessment.java @@ -0,0 +1,32 @@ +package unipotsdam.gf.modules.assessment; + +import org.junit.Test; +import unipotsdam.gf.interfaces.IPeerAssessment; +import unipotsdam.gf.modules.assessment.controller.Assessment; +import unipotsdam.gf.modules.assessment.controller.FBAssessement; +import unipotsdam.gf.modules.assessment.controller.Performance; +import unipotsdam.gf.modules.assessment.controller.StudentIdentifier; + +public class TestAddAssessment { + + @Test + public void addTestAssessment() { + IPeerAssessment iPeerAssessment = new FBAssessement(); + int [] quizAnswers = new int[5]; + quizAnswers[0] = 0; + quizAnswers[1] = 1; + quizAnswers[2] = 0; + quizAnswers[3] = 1; + quizAnswers[4] = 1; + int [] workRating = new int[3]; + workRating[0] = 5; //Führungsqualität + workRating[1] = 1; //Pünktlichkeit + workRating[2] = 4; //Hilfsbereitschaft oder so + + StudentIdentifier student = new StudentIdentifier("Spaß", "Haralf"); + Performance performance = new Performance(quizAnswers,"so ein toller Typ", workRating); + Assessment assessment = new Assessment(student, performance); + iPeerAssessment.addAssessmentDataToDB(assessment); + } + +} diff --git a/gemeinsamforschen/web/WEB-INF/web.xml b/gemeinsamforschen/web/WEB-INF/web.xml new file mode 100644 index 00000000..d80081d1 --- /dev/null +++ b/gemeinsamforschen/web/WEB-INF/web.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" + version="4.0"> +</web-app> \ No newline at end of file diff --git a/gemeinsamforschen/web/index.jsp b/gemeinsamforschen/web/index.jsp new file mode 100644 index 00000000..1fd3efe3 --- /dev/null +++ b/gemeinsamforschen/web/index.jsp @@ -0,0 +1,16 @@ +<%-- + Created by IntelliJ IDEA. + User: fides-WHK + Date: 29.05.2018 + Time: 14:12 + To change this template use File | Settings | File Templates. +--%> +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<html> + <head> + <title>$Title$</title> + </head> + <body> + $END$ + </body> +</html> -- GitLab