@@ -33,8 +33,7 @@ public class ClassmateSummaryDataController extends ClassmateDataController {
3333 @ GetMapping ("/student-work/{runId}/{nodeId}/{componentId}/period/{periodId}" )
3434 public List <StudentWork > getClassmateSummaryWorkInPeriod (Authentication auth ,
3535 @ PathVariable ("runId" ) RunImpl run , @ PathVariable Long periodId , @ PathVariable String nodeId ,
36- @ PathVariable String componentId )
37- throws IOException , JSONException , ObjectNotFoundException {
36+ @ PathVariable String componentId ) throws IOException , JSONException , ObjectNotFoundException {
3837 Group period = groupService .retrieveById (periodId );
3938 if (isAllowedToGetData (auth , run , period , nodeId , componentId )) {
4039 return getLatestStudentWork (run , period , nodeId , componentId );
@@ -45,8 +44,7 @@ public List<StudentWork> getClassmateSummaryWorkInPeriod(Authentication auth,
4544 @ GetMapping ("/student-work/{runId}/{nodeId}/{componentId}/class" )
4645 public List <StudentWork > getClassmateSummaryWorkInClass (Authentication auth ,
4746 @ PathVariable ("runId" ) RunImpl run , @ PathVariable String nodeId ,
48- @ PathVariable String componentId )
49- throws IOException , JSONException , ObjectNotFoundException {
47+ @ PathVariable String componentId ) throws IOException , JSONException , ObjectNotFoundException {
5048 if (isAllowedToGetData (auth , run , nodeId , componentId )) {
5149 return getLatestStudentWork (run , nodeId , componentId );
5250 }
@@ -56,8 +54,7 @@ public List<StudentWork> getClassmateSummaryWorkInClass(Authentication auth,
5654 @ GetMapping ("/scores/{runId}/{nodeId}/{componentId}/period/{periodId}" )
5755 public List <Annotation > getClassmateSummaryScoresInPeriod (Authentication auth ,
5856 @ PathVariable ("runId" ) RunImpl run , @ PathVariable Long periodId , @ PathVariable String nodeId ,
59- @ PathVariable String componentId )
60- throws IOException , JSONException , ObjectNotFoundException {
57+ @ PathVariable String componentId ) throws IOException , JSONException , ObjectNotFoundException {
6158 Group period = groupService .retrieveById (periodId );
6259 if (isAllowedToGetData (auth , run , period , nodeId , componentId )) {
6360 return getLatestScoreAnnotations (getAnnotations (run , period , nodeId , componentId ));
@@ -68,8 +65,7 @@ public List<Annotation> getClassmateSummaryScoresInPeriod(Authentication auth,
6865 @ GetMapping ("/scores/{runId}/{nodeId}/{componentId}/class" )
6966 public List <Annotation > getClassmateSummaryScoresInClass (Authentication auth ,
7067 @ PathVariable ("runId" ) RunImpl run , @ PathVariable String nodeId ,
71- @ PathVariable String componentId )
72- throws IOException , JSONException , ObjectNotFoundException {
68+ @ PathVariable String componentId ) throws IOException , JSONException , ObjectNotFoundException {
7369 if (isAllowedToGetData (auth , run , nodeId , componentId )) {
7470 return getLatestScoreAnnotations (getAnnotations (run , nodeId , componentId ));
7571 }
@@ -78,25 +74,23 @@ public List<Annotation> getClassmateSummaryScoresInClass(Authentication auth,
7874
7975 private boolean isAllowedToGetData (Authentication auth , Run run , Group period , String nodeId ,
8076 String componentId ) throws IOException , JSONException , ObjectNotFoundException {
81- return (isStudent (auth ) && isStudentInRunAndPeriod (auth , run , period ) &&
82- isValidSummaryComponent (run , nodeId , componentId )) ||
83- (isTeacher (auth ) && isTeacherOfRun (auth , run ));
77+ return (isStudent (auth ) && isStudentInRunAndPeriod (auth , run , period )
78+ && isValidSummaryComponent (run , nodeId , componentId )) || isTeacherOfRun (auth , run );
8479 }
8580
8681 private boolean isAllowedToGetData (Authentication auth , Run run , String nodeId ,
8782 String componentId ) throws IOException , JSONException , ObjectNotFoundException {
88- return (isStudent (auth ) && isStudentInRun (auth , run ) &&
89- isValidSummaryComponent (run , nodeId , componentId )) ||
90- (isTeacher (auth ) && isTeacherOfRun (auth , run ));
83+ return (isStudent (auth ) && isStudentInRun (auth , run )
84+ && isValidSummaryComponent (run , nodeId , componentId )) || isTeacherOfRun (auth , run );
9185 }
9286
9387 private boolean isValidSummaryComponent (Run run , String nodeId , String componentId )
9488 throws IOException , JSONException , ObjectNotFoundException {
9589 List <ProjectComponent > projectComponents = getProjectComponents (run );
9690 for (ProjectComponent projectComponent : projectComponents ) {
97- if (projectComponent .getString ("type" ).equals (SUMMARY_TYPE ) &&
98- projectComponent .getString ("summaryNodeId" ).equals (nodeId ) &&
99- projectComponent .getString ("summaryComponentId" ).equals (componentId )) {
91+ if (projectComponent .getString ("type" ).equals (SUMMARY_TYPE )
92+ && projectComponent .getString ("summaryNodeId" ).equals (nodeId )
93+ && projectComponent .getString ("summaryComponentId" ).equals (componentId )) {
10094 return true ;
10195 }
10296 }
0 commit comments