Compare commits

...

6 Commits

2 changed files with 23 additions and 4 deletions

View File

@ -16,6 +16,7 @@ import io.swagger.annotations.ApiModel;
public class AssignmentResponse { public class AssignmentResponse {
private Long id; private Long id;
private String name; private String name;
private String symbol;
private GroupWithCapacityResponse classes; private GroupWithCapacityResponse classes;
private GroupWithCapacityResponse lecture; private GroupWithCapacityResponse lecture;
@ -27,10 +28,18 @@ public class AssignmentResponse {
public AssignmentResponse(Course course, Groups lecture, Groups classes) { public AssignmentResponse(Course course, Groups lecture, Groups classes) {
this.id = course.getId(); this.id = course.getId();
this.name = course.getName(); this.name = course.getName();
this.symbol = course.getSymbol();
this.lecture = lecture == null ? null : new GroupWithCapacityResponse(lecture); this.lecture = lecture == null ? null : new GroupWithCapacityResponse(lecture);
this.classes = classes == null ? null : new GroupWithCapacityResponse(classes); this.classes = classes == null ? null : new GroupWithCapacityResponse(classes);
} }
/**
* @return returns symbol of assigned course
*/
public String getSymbol() {
return symbol;
}
/** /**
* @param course course entity * @param course course entity
* @param lecture lecture Groups entity * @param lecture lecture Groups entity
@ -41,6 +50,7 @@ public class AssignmentResponse {
public AssignmentResponse(Course course, Groups lecture, Groups classes, HashMap<Long, Integer> ammounts) { public AssignmentResponse(Course course, Groups lecture, Groups classes, HashMap<Long, Integer> ammounts) {
this.id = course.getId(); this.id = course.getId();
this.name = course.getName(); this.name = course.getName();
this.symbol = course.getSymbol();
this.lecture = lecture == null ? null : new GroupWithCapacityResponse(lecture, ammounts.get(lecture.getId())); this.lecture = lecture == null ? null : new GroupWithCapacityResponse(lecture, ammounts.get(lecture.getId()));
this.classes = classes == null ? null : new GroupWithCapacityResponse(classes, ammounts.get(classes.getId())); this.classes = classes == null ? null : new GroupWithCapacityResponse(classes, ammounts.get(classes.getId()));
} }
@ -95,9 +105,15 @@ public class AssignmentResponse {
* places * places
*/ */
public AssignmentResponse(Course course, Assignment lecture, Assignment classes, HashMap<Long, Integer> ammounts) { public AssignmentResponse(Course course, Assignment lecture, Assignment classes, HashMap<Long, Integer> ammounts) {
this.id = course.getId();
this.name = course.getName(); this.name = course.getName();
this.classes = new GroupWithCapacityResponse(classes, ammounts.get(classes.getGroup().getId())); this.symbol = course.getSymbol();
this.lecture = new GroupWithCapacityResponse(lecture, ammounts.get(lecture.getGroup().getId())); this.classes = classes != null
? new GroupWithCapacityResponse(classes, ammounts.get(classes.getGroup().getId()))
: null;
this.lecture = lecture != null
? new GroupWithCapacityResponse(lecture, ammounts.get(lecture.getGroup().getId()))
: null;
} }
/** /**
@ -106,9 +122,11 @@ public class AssignmentResponse {
* @param classes class Groups entity * @param classes class Groups entity
*/ */
public AssignmentResponse(Course course, Assignment lecture, Assignment classes) { public AssignmentResponse(Course course, Assignment lecture, Assignment classes) {
this.id = course.getId();
this.name = course.getName(); this.name = course.getName();
this.classes = new GroupWithCapacityResponse(classes); this.symbol = course.getSymbol();
this.lecture = new GroupWithCapacityResponse(lecture); this.classes = classes != null ? new GroupWithCapacityResponse(classes) : null;
this.lecture = lecture != null ? new GroupWithCapacityResponse(lecture) : null;
} }
/** /**

View File

@ -50,6 +50,7 @@ public class GroupWithCapacityResponse extends GroupDefaultResponse {
*/ */
public GroupWithCapacityResponse(Assignment assignment, int takenPlaces) { public GroupWithCapacityResponse(Assignment assignment, int takenPlaces) {
super(assignment, takenPlaces); super(assignment, takenPlaces);
this.capacity = assignment.getGroup().getCapacity();
} }
/** /**