diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 03d62d167dc479a2cbe39237d40f9d6e78e67321..6949108dc4b88df199e7a3dda3d80c076e88361f 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,7 +3,9 @@ <component name="ChangeListManager"> <list default="true" id="b207c042-3fc9-4102-bf50-ee6c9b45c20d" name="Default" comment=""> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" /> - <change type="MODIFICATION" beforePath="$PROJECT_DIR$/gemeinsamforschen/src/main/java/unipotsdam/gf/interfaces/IPeerAssessment.java" afterPath="$PROJECT_DIR$/gemeinsamforschen/src/main/java/unipotsdam/gf/interfaces/IPeerAssessment.java" /> + <change type="MODIFICATION" beforePath="$PROJECT_DIR$/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/model/Assessment.java" afterPath="$PROJECT_DIR$/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/model/Assessment.java" /> + <change type="MODIFICATION" beforePath="$PROJECT_DIR$/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/service/PeerAssessmentDummy.java" afterPath="$PROJECT_DIR$/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/service/PeerAssessmentDummy.java" /> + <change type="MODIFICATION" beforePath="$PROJECT_DIR$/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/view/QuizView.java" afterPath="$PROJECT_DIR$/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/view/QuizView.java" /> </list> <ignored path="fltrail.iws" /> <ignored path=".idea/workspace.xml" /> @@ -44,11 +46,29 @@ </provider> </entry> </file> - <file leaf-file-name="projects.php" pinned="false" current-in-tab="true"> + <file leaf-file-name="projects.php" pinned="false" current-in-tab="false"> <entry file="file://$PROJECT_DIR$/studentview/pages/projects.php"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="21"> - <caret line="125" column="34" lean-forward="false" selection-start-line="125" selection-start-column="34" selection-end-line="125" selection-end-column="34" /> + <caret line="111" column="34" lean-forward="false" selection-start-line="111" selection-start-column="34" selection-end-line="111" selection-end-column="34" /> + <folding> + <marker date="1528377403200" expanded="true" signature="10969:10996" ph="..." /> + <marker date="1528377403200" expanded="true" signature="10969:11019" ph="..." /> + <marker date="1528377403200" expanded="true" signature="10969:11038" ph="..." /> + <marker date="1528377403200" expanded="true" signature="10969:11053" ph="..." /> + <marker date="1528377403200" expanded="true" signature="10969:11064" ph="..." /> + <marker date="1528377403200" expanded="true" signature="10969:11071" ph="..." /> + <marker date="1528377403200" expanded="true" signature="10969:11079" ph="..." /> + </folding> + </state> + </provider> + </entry> + </file> + <file leaf-file-name="newProject.js" pinned="false" current-in-tab="true"> + <entry file="file://$PROJECT_DIR$/studentview/assets/js/newProject.js"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="-651"> + <caret line="20" column="7" lean-forward="false" selection-start-line="20" selection-start-column="7" selection-end-line="20" selection-end-column="7" /> <folding /> </state> </provider> @@ -67,9 +87,19 @@ <file leaf-file-name="overview.js" pinned="false" current-in-tab="false"> <entry file="file://$PROJECT_DIR$/studentview/assets/js/overview.js"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="1806"> - <caret line="86" column="0" lean-forward="false" selection-start-line="86" selection-start-column="0" selection-end-line="86" selection-end-column="0" /> - <folding /> + <state relative-caret-position="1827"> + <caret line="87" column="0" lean-forward="false" selection-start-line="87" selection-start-column="0" selection-end-line="87" selection-end-column="0" /> + <folding> + <marker date="1528377403191" expanded="true" signature="2039:2586" ph="{...}" /> + <marker date="1528377403191" expanded="true" signature="2116:2586" ph="{"url": url...}" /> + <marker date="1528377403191" expanded="true" signature="2253:2586" ph="{...}" /> + <marker date="1528377403191" expanded="true" signature="2478:2586" ph="{...}" /> + <marker date="1528377403191" expanded="true" signature="5783:6754" ph="{"url": innerurl...}" /> + <marker date="1528377403191" expanded="true" signature="5783:6758" ph="{...}" /> + <marker date="1528377403191" expanded="true" signature="5932:6673" ph="{...}" /> + <marker date="1528377403191" expanded="true" signature="6102:6663" ph="{...}" /> + <marker date="1528377403191" expanded="true" signature="6709:6748" ph="{...}" /> + </folding> </state> </provider> </entry> @@ -124,13 +154,13 @@ <option value="$PROJECT_DIR$/studentview/pages/deleteProject.php" /> <option value="$PROJECT_DIR$/studentview/pages/enrollment.php" /> <option value="$PROJECT_DIR$/studentview/pages/newproject.php" /> - <option value="$PROJECT_DIR$/studentview/pages/projects.php" /> <option value="$PROJECT_DIR$/studentview/register.php" /> <option value="$PROJECT_DIR$/studentview/pages/preferences.php" /> <option value="$PROJECT_DIR$/studentview/assets/js/config.js" /> <option value="$PROJECT_DIR$/studentview/database/config.php" /> <option value="$PROJECT_DIR$/studentview/assets/js/overview.js" /> <option value="$PROJECT_DIR$/gemeinsamforschen/src/main/java/unipotsdam/gf/interfaces/ResearchReport.java" /> + <option value="$PROJECT_DIR$/studentview/pages/projects.php" /> </list> </option> </component> @@ -266,8 +296,8 @@ </PATH> </subPane> </pane> - <pane id="Scratches" /> <pane id="Scope" /> + <pane id="Scratches" /> <pane id="PackagesPane" /> <pane id="AndroidView" /> </panes> @@ -365,26 +395,28 @@ <workItem from="1524585513713" duration="57000" /> <workItem from="1528200793936" duration="888000" /> <workItem from="1528354427057" duration="403000" /> + <workItem from="1528809757337" duration="102000" /> </task> <servers /> </component> <component name="TimeTrackingManager"> - <option name="totallyTimeSpent" value="75305000" /> + <option name="totallyTimeSpent" value="75407000" /> </component> <component name="ToolWindowManager"> <frame x="-9" y="-9" width="1938" height="1050" extended-state="6" /> + <editor active="true" /> <layout> <window_info id="Remote Host" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" /> - <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.2125" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" x="9" y="79" width="408" height="943" /> + <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.2125" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" x="9" y="79" width="408" height="943" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.23455825" sideWeight="0.47734374" order="8" side_tool="true" content_ui="tabs" /> <window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.15729167" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> - <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" /> <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.35496482" sideWeight="0.71510416" order="2" side_tool="false" content_ui="tabs" /> + <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" /> <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" /> - <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="true" content_ui="tabs" /> <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.331509" sideWeight="0.52265626" order="3" side_tool="false" content_ui="tabs" /> + <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="true" content_ui="tabs" /> <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" /> <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> @@ -582,13 +614,6 @@ </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/studentview/assets/js/newProject.js"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="0"> - <caret line="92" column="40" lean-forward="false" selection-start-line="92" selection-start-column="40" selection-end-line="92" selection-end-column="40" /> - </state> - </provider> - </entry> <entry file="dbDummy://dbtable:/fc3764cf/14340c2c-ac4b-492f-ac4f-18c0853598a8/fltrail.projects" /> <entry file="file://$PROJECT_DIR$/studentview/assets/js/createPreferences.js"> <provider selected="true" editor-type-id="text-editor"> @@ -711,16 +736,42 @@ </entry> <entry file="file://$PROJECT_DIR$/studentview/assets/js/overview.js"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="1806"> - <caret line="86" column="0" lean-forward="false" selection-start-line="86" selection-start-column="0" selection-end-line="86" selection-end-column="0" /> - <folding /> + <state relative-caret-position="1827"> + <caret line="87" column="0" lean-forward="false" selection-start-line="87" selection-start-column="0" selection-end-line="87" selection-end-column="0" /> + <folding> + <marker date="1528377403191" expanded="true" signature="2039:2586" ph="{...}" /> + <marker date="1528377403191" expanded="true" signature="2116:2586" ph="{"url": url...}" /> + <marker date="1528377403191" expanded="true" signature="2253:2586" ph="{...}" /> + <marker date="1528377403191" expanded="true" signature="2478:2586" ph="{...}" /> + <marker date="1528377403191" expanded="true" signature="5783:6754" ph="{"url": innerurl...}" /> + <marker date="1528377403191" expanded="true" signature="5783:6758" ph="{...}" /> + <marker date="1528377403191" expanded="true" signature="5932:6673" ph="{...}" /> + <marker date="1528377403191" expanded="true" signature="6102:6663" ph="{...}" /> + <marker date="1528377403191" expanded="true" signature="6709:6748" ph="{...}" /> + </folding> </state> </provider> </entry> <entry file="file://$PROJECT_DIR$/studentview/pages/projects.php"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="21"> - <caret line="125" column="34" lean-forward="false" selection-start-line="125" selection-start-column="34" selection-end-line="125" selection-end-column="34" /> + <caret line="111" column="34" lean-forward="false" selection-start-line="111" selection-start-column="34" selection-end-line="111" selection-end-column="34" /> + <folding> + <marker date="1528377403200" expanded="true" signature="10969:10996" ph="..." /> + <marker date="1528377403200" expanded="true" signature="10969:11019" ph="..." /> + <marker date="1528377403200" expanded="true" signature="10969:11038" ph="..." /> + <marker date="1528377403200" expanded="true" signature="10969:11053" ph="..." /> + <marker date="1528377403200" expanded="true" signature="10969:11064" ph="..." /> + <marker date="1528377403200" expanded="true" signature="10969:11071" ph="..." /> + <marker date="1528377403200" expanded="true" signature="10969:11079" ph="..." /> + </folding> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/studentview/assets/js/newProject.js"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="-651"> + <caret line="20" column="7" lean-forward="false" selection-start-line="20" selection-start-column="7" selection-end-line="20" selection-end-column="7" /> <folding /> </state> </provider> diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/interfaces/IPeerAssessment.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/interfaces/IPeerAssessment.java index 3c56086717309771fc7ca2c1b69bca9349348737..a39dbe55732d56e831d78fa6500bf1a10e3abc41 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/interfaces/IPeerAssessment.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/interfaces/IPeerAssessment.java @@ -1,9 +1,6 @@ package unipotsdam.gf.interfaces; -import unipotsdam.gf.modules.assessment.controller.model.Assessment; -import unipotsdam.gf.modules.assessment.controller.model.Performance; -import unipotsdam.gf.modules.assessment.controller.model.Quiz; -import unipotsdam.gf.modules.assessment.controller.model.StudentIdentifier; +import unipotsdam.gf.modules.assessment.controller.model.*; /** * Created by dehne on 18.05.2018. @@ -29,19 +26,18 @@ public interface IPeerAssessment { /** * writes a quiz-question into the DB so other students can benefit from another's insights. * - * @param student - * @param quiz + * @param studentAndQuiz */ - void createQuiz(StudentIdentifier student, Quiz quiz); + void createQuiz(StudentAndQuiz studentAndQuiz); /** * calculate grades for everyone in a list. * either it will be overwritten by choice of co- or peer-assessment or it gets a parameter which specifies it. * - * @param performanceOfAllStudents - * @return + * + * @param totalPerformance @return */ - int[] calculateAssessment(Performance[] performanceOfAllStudents); // calculates marks for every performance and writes it to an array + Grades calculateAssessment(TotalPerformance totalPerformance); // calculates marks for every performance and writes it to an array /** * calculates the mean value of all assessments in a project. diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/model/Assessment.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/model/Assessment.java index 4fc531131d7ed72ff78727e96fc10db45a82d2f4..6cbfbf46dc891c0532292c68bdf5b098f46dedf7 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/model/Assessment.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/model/Assessment.java @@ -1,5 +1,9 @@ package unipotsdam.gf.modules.assessment.controller.model; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement + public class Assessment { private StudentIdentifier student; private Performance performance; @@ -9,6 +13,8 @@ public class Assessment { this.performance = performance; } + public Assessment(){} + public StudentIdentifier getStudent() { return student; } diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/model/Grades.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/model/Grades.java new file mode 100644 index 0000000000000000000000000000000000000000..98f4b3479c266d8e1d54efb0dda18bf9a4ab65dd --- /dev/null +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/model/Grades.java @@ -0,0 +1,27 @@ +package unipotsdam.gf.modules.assessment.controller.model; + +public class Grades { + private Grading[] grading; + + public Grades(){} + + public Grades(Grading[] grading) { + this.grading = grading; + } + + public Grading[] getGrading() { + return grading; + } + + public void setGrading(Grading[] grading) { + this.grading = grading; + } + + @Override + public String toString() { + return "Grades{" + + "grading=" + grading + + '}'; + } + +} diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/model/Grading.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/model/Grading.java new file mode 100644 index 0000000000000000000000000000000000000000..73913ebb40f6e10c1e1c664f6402fe87375cb2ed --- /dev/null +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/model/Grading.java @@ -0,0 +1,38 @@ +package unipotsdam.gf.modules.assessment.controller.model; + +public class Grading { + private StudentIdentifier studentIdentifier; + private int grade; + + public Grading(){} + + public Grading(StudentIdentifier studentIdentifier, int grade) { + this.studentIdentifier = studentIdentifier; + this.grade = grade; + } + + public int getGrade() { + return grade; + } + + public void setGrade(int grade) { + this.grade = grade; + } + + public StudentIdentifier getStudentIdentifier() { + return studentIdentifier; + } + + public void setStudentIdentifier(StudentIdentifier studentIdentifier) { + this.studentIdentifier = studentIdentifier; + } + + @Override + public String toString() { + return "Grading{" + + "studentIdentifier=" + studentIdentifier + + ", grade=" + grade + + '}'; + } + +} diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/model/StudentAndQuiz.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/model/StudentAndQuiz.java new file mode 100644 index 0000000000000000000000000000000000000000..4f5f5c0976bffc1bc51602c7c1cc886f294ac1d5 --- /dev/null +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/model/StudentAndQuiz.java @@ -0,0 +1,38 @@ +package unipotsdam.gf.modules.assessment.controller.model; + +public class StudentAndQuiz { + @Override + public String toString() { + return "StudentAndQuiz{" + + "studentIdentifier=" + studentIdentifier + + ", quiz=" + quiz + + '}'; + } + + public StudentAndQuiz(){} + + private StudentIdentifier studentIdentifier; + + public StudentIdentifier getStudentIdentifier() { + return studentIdentifier; + } + + public void setStudentIdentifier(StudentIdentifier studentIdentifier) { + this.studentIdentifier = studentIdentifier; + } + + public Quiz getQuiz() { + return quiz; + } + + public void setQuiz(Quiz quiz) { + this.quiz = quiz; + } + + private Quiz quiz; + + public StudentAndQuiz(StudentIdentifier studentIdentifier, Quiz quiz) { + this.studentIdentifier = studentIdentifier; + this.quiz = quiz; + } +} diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/model/TotalPerformance.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/model/TotalPerformance.java new file mode 100644 index 0000000000000000000000000000000000000000..b5e01faa2db263539823d5e3b01354add282a35b --- /dev/null +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/model/TotalPerformance.java @@ -0,0 +1,42 @@ +package unipotsdam.gf.modules.assessment.controller.model; + +import java.util.Arrays; + +public class TotalPerformance { + + private StudentIdentifier[] studentIdentifier; + private Performance[] performances; + + public TotalPerformance(StudentIdentifier[] studentIdentifier, Performance[] performances) { + this.studentIdentifier = studentIdentifier; + this.performances = performances; + } + + public TotalPerformance() { + } + + public Performance[] getPerformances() { + return performances; + } + + public void setPerformances(Performance[] performances) { + this.performances = performances; + } + + public StudentIdentifier[] getStudentIdentifier() { + return studentIdentifier; + } + + public void setStudentIdentifier(StudentIdentifier[] studentIdentifier) { + this.studentIdentifier = studentIdentifier; + } + + @Override + public String toString() { + return "TotalPerformance{" + + "studentIdentifier=" + studentIdentifier + + ", performances=" + Arrays.toString(performances) + + '}'; + } + +} diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/service/FBAssessement.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/service/FBAssessement.java index 64f2b331345df5a1c54768eadc04faf215943f80..e7f98ab5bab6ca87ab671b45432cb469ebc35407 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/service/FBAssessement.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/service/FBAssessement.java @@ -1,9 +1,6 @@ package unipotsdam.gf.modules.assessment.controller.service; -import unipotsdam.gf.modules.assessment.controller.model.Assessment; -import unipotsdam.gf.modules.assessment.controller.model.Performance; -import unipotsdam.gf.modules.assessment.controller.model.Quiz; -import unipotsdam.gf.modules.assessment.controller.model.StudentIdentifier; +import unipotsdam.gf.modules.assessment.controller.model.*; /** * Created by dehne on 18.05.2018. @@ -21,19 +18,15 @@ public class FBAssessement extends AssessmentDAO { } @Override - public void createQuiz(StudentIdentifier student, Quiz quiz) { + public void createQuiz(StudentAndQuiz studentAndQuiz) { } @Override - 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 Grades calculateAssessment(TotalPerformance totalPerformance){ // calculates marks for every performance and writes it to an array + Grades grades = new Grades(); + return grades; } public void createQuiz(StudentIdentifier student, String question, String[] answers){ //writes a new question into the DB diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/service/PeerAssessment.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/service/PeerAssessment.java index 0e960479aa619742de1277ef4ae34a9d333e9638..be25ff2f59dd2f6315d081e6e5fb3a636c395fca 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/service/PeerAssessment.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/service/PeerAssessment.java @@ -1,10 +1,7 @@ package unipotsdam.gf.modules.assessment.controller.service; import unipotsdam.gf.interfaces.IPeerAssessment; -import unipotsdam.gf.modules.assessment.controller.model.Assessment; -import unipotsdam.gf.modules.assessment.controller.model.Performance; -import unipotsdam.gf.modules.assessment.controller.model.Quiz; -import unipotsdam.gf.modules.assessment.controller.model.StudentIdentifier; +import unipotsdam.gf.modules.assessment.controller.model.*; public class PeerAssessment implements IPeerAssessment { @Override @@ -23,13 +20,14 @@ public class PeerAssessment implements IPeerAssessment { } @Override - public void createQuiz(StudentIdentifier student, Quiz quiz) { + public void createQuiz(StudentAndQuiz studentAndQuiz) { } @Override - public int[] calculateAssessment(Performance[] performanceOfAllStudents) { - return new int[0]; + public Grades calculateAssessment(TotalPerformance totalPerformance) { + Grades grades = new Grades(); + return grades; } @Override diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/service/PeerAssessmentDummy.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/service/PeerAssessmentDummy.java index 4df8e22307b8e1c8fa4915faf8d74156a00d4a15..be139b0a9bc858458486fd8f77cbd9b6594dfe30 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/service/PeerAssessmentDummy.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/service/PeerAssessmentDummy.java @@ -1,10 +1,7 @@ package unipotsdam.gf.modules.assessment.controller.service; import unipotsdam.gf.interfaces.IPeerAssessment; -import unipotsdam.gf.modules.assessment.controller.model.Assessment; -import unipotsdam.gf.modules.assessment.controller.model.Performance; -import unipotsdam.gf.modules.assessment.controller.model.Quiz; -import unipotsdam.gf.modules.assessment.controller.model.StudentIdentifier; +import unipotsdam.gf.modules.assessment.controller.model.*; public class PeerAssessmentDummy implements IPeerAssessment { @Override @@ -27,17 +24,39 @@ public class PeerAssessmentDummy implements IPeerAssessment { @Override public Assessment getAssessmentDataFromDB(StudentIdentifier student) { - return null; + int[] quizAnswer = {1,1,1,0,0,0,1,0,0,1,1}; + int[] workRating = {1,5,3,4,1,5,5}; + Performance performance = new Performance(quizAnswer, "what a nice guy", workRating); + Assessment assessment = new Assessment(student, performance); + return assessment; } @Override - public void createQuiz(StudentIdentifier student, Quiz quiz) { + public void createQuiz(StudentAndQuiz studentAndQuiz) { } @Override - public int[] calculateAssessment(Performance[] performanceOfAllStudents) { - return new int[0]; + public Grades calculateAssessment(TotalPerformance totalPerformance) { + Performance[] performanceOfAllStudents = totalPerformance.getPerformances(); + StudentIdentifier[] allStudents = totalPerformance.getStudentIdentifier(); + int[] allAssessements = new int[performanceOfAllStudents.length] ; + Grades grades = new Grades(); + Grading[] grading = new Grading[performanceOfAllStudents.length]; + + for (int i=0; i< performanceOfAllStudents.length;i++) { + for (int j=0; j< performanceOfAllStudents[i].getQuizAnswer().length;j++) { + allAssessements[i] += performanceOfAllStudents[i].getQuizAnswer()[j]; + } + allAssessements[i] = allAssessements[i]/performanceOfAllStudents[i].getQuizAnswer().length; + } + for (int i=0; i<performanceOfAllStudents.length; i++){ + grading[i].setStudentIdentifier(allStudents[i]); + grading[i].setGrade(allAssessements[i]); + } + + grades.setGrading(grading); + return grades; } @Override diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/view/QuizView.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/view/QuizView.java index 414d444cc7e4bb887f287da32a8030ef3bf5b024..5c4886da8336ca3f132c7fa304471bb0ba865b86 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/view/QuizView.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/assessment/controller/view/QuizView.java @@ -1,10 +1,7 @@ package unipotsdam.gf.modules.assessment.controller.view; import unipotsdam.gf.interfaces.IPeerAssessment; -import unipotsdam.gf.modules.assessment.controller.model.Assessment; -import unipotsdam.gf.modules.assessment.controller.model.Performance; -import unipotsdam.gf.modules.assessment.controller.model.Quiz; -import unipotsdam.gf.modules.assessment.controller.model.StudentIdentifier; +import unipotsdam.gf.modules.assessment.controller.model.*; import unipotsdam.gf.modules.assessment.controller.service.PeerAssessmentDummy; import javax.ws.rs.*; @@ -30,27 +27,45 @@ public class QuizView implements IPeerAssessment { peer.addAssessmentDataToDB(assessment); } - @GET - @Produces(MediaType.TEXT_PLAIN) - @Path("/project/{projectId}/student/{studentId}") + @Override - public Assessment getAssessmentDataFromDB(StudentIdentifier student){//@PathParam("projectId") String projectId,@PathParam("studentId") String studentId){ - //StudentIdentifier student = new StudentIdentifier(projectId, studentId); + public Assessment getAssessmentDataFromDB(StudentIdentifier student){ return peer.getAssessmentDataFromDB(student); } - @Override - public void createQuiz(StudentIdentifier student, Quiz quiz) { + @GET + @Produces(MediaType.APPLICATION_JSON) + @Path("/project/{projectId}/student/{studentId}") + public Assessment getAssessmentDataFromDB(@PathParam("projectId") String projectId,@PathParam("studentId") String studentId){ + StudentIdentifier student = new StudentIdentifier(projectId, studentId); + return getAssessmentDataFromDB(student); + } + + @POST + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + @Path("/quiz") + @Override + public void createQuiz(StudentAndQuiz studentAndQuiz) { + peer.createQuiz(studentAndQuiz); } + @POST + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + @Path("/calculate") @Override - public int[] calculateAssessment(Performance[] performanceOfAllStudents) { - return new int[0]; + public Grades calculateAssessment(TotalPerformance totalPerformance) { //todo: maybe the return variable is the problem why it doesnt work. + + return peer.calculateAssessment(totalPerformance); } + @GET + @Produces(MediaType.APPLICATION_JSON) + @Path("/mean/project/{projectId}") @Override - public int meanOfAssessement(String ProjectId) { - return 0; + public int meanOfAssessement(@PathParam("projectId") String ProjectId) { + return peer.meanOfAssessement(ProjectId); } } diff --git a/gemeinsamforschen/src/main/webapp/assets/js/assessmentCalculator.js b/gemeinsamforschen/src/main/webapp/assets/js/assessmentCalculator.js new file mode 100644 index 0000000000000000000000000000000000000000..b138e592ca67c426c4bd3e3c45b502e6ffee77e0 --- /dev/null +++ b/gemeinsamforschen/src/main/webapp/assets/js/assessmentCalculator.js @@ -0,0 +1,48 @@ +$(document).ready(function(){ + $("#calculateNow").on("click", function(){ + var data = [{ + StudentIdentifier: { + projectId: 'gemeinsamForschn', + student: 'Max*i Mustermann*ine' + }, + Performance: { + quizAnswers: [1,0,1,1,0,0,0,0,1], + feedback: 'ganz feiner Student war das', + workRating: [4,3,5,1,1,5,3] + } + },{ + StudentIdentifier: { + projectId: 'gemeinsamForschn', + student: 'John Doe' + }, + Performance: { + quizAnswers: [1,0,1,1,0,1,1,1,1], + feedback: 'ganz feiner Student war das', + workRating: [2,3,2,3,1,2,3] + } + },{ + StudentIdentifier: { + projectId: 'gemeinsamForschn', + student: 'Harri Gründler' + }, + Performance: { + quizAnswers: [0,0,0,0,0,0,0,0,0], + feedback: 'ganz feiner Student war das', + workRating: [1,1,1,1,1,1,1] + } + } + ]; + $.ajax({ + url: "http://localhost:8080/gemeinsamforschen/rest/assessments/calculate", + type: 'POST', + contentType: 'application/json; charset=utf-8', + data: data, + success: function(data){ + alert(data); + }, + error: function(a,b,c){ + alert('some error'+a); + } + }) + }) +}); \ No newline at end of file diff --git a/gemeinsamforschen/src/main/webapp/pages/assessmentCalculator.html b/gemeinsamforschen/src/main/webapp/pages/assessmentCalculator.html new file mode 100644 index 0000000000000000000000000000000000000000..13fc7b1effa2f202442f2c8d7570167368c4b77f --- /dev/null +++ b/gemeinsamforschen/src/main/webapp/pages/assessmentCalculator.html @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>assessment calculator</title> + <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> + <script src="../assets/js/assessmentCalculator.js"></script> +</head> +<body> +<button id="calculateNow">click mich</button> +</body> +</html> \ No newline at end of file