Added tests and service
This commit is contained in:
@ -18,14 +18,7 @@ public interface GroupRepository extends JpaRepository<Groups, Long> {
|
||||
@Query("FROM Groups WHERE course_id = ?1")
|
||||
List<Groups> getByCourse(@Param("id") Long id);
|
||||
|
||||
// SELECT group_id, COUNT(*) AS assinged_times FROM assignment WHERE
|
||||
// is_past_assignment=0 GROUP BY group_id HAVING group_id=7;
|
||||
|
||||
@Query("SELECT COUNT(*) AS assinged_times FROM Assignment WHERE isPastAssignment=false GROUP BY group HAVING group_id=?1")
|
||||
Number getAssignedAmount(Long groupId);
|
||||
|
||||
// @Query("SELECT group_id, COUNT(*) AS assinged_times FROM assignment WHERE
|
||||
// is_past_assignment=0 GROUP BY group_id HAVING group_id=7;")
|
||||
// Number getTmpSqlAssignedAmount(Long groupId);
|
||||
Optional<Number> getAssignedAmount(Long groupId);
|
||||
|
||||
}
|
@ -52,7 +52,6 @@ public class GroupService {
|
||||
}
|
||||
|
||||
public int getAssignedAmount(Long groupId) {
|
||||
this.repo.getAssignedAmount(groupId);
|
||||
return 0;
|
||||
return this.repo.getAssignedAmount(groupId).orElse(Integer.valueOf(0)).intValue();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user