5 Commits

Author SHA1 Message Date
Filip Izydorczyk
ad4984bdae fixed 2021-01-23 16:45:36 +01:00
63def650c9 Merge pull request 'fix' (#52) from schedule-fix into master
Reviewed-on: http://git.plannaplan.pl/filipizydorczyk/backend/pulls/52
2021-01-22 16:50:30 +01:00
Filip Izydorczyk
a201bcc581 fix 2021-01-22 16:46:53 +01:00
e688f8b71d Merge pull request 'gr_nr + sym' (#51) from new-response-fields into master
Reviewed-on: http://git.plannaplan.pl/filipizydorczyk/backend/pulls/51
2021-01-22 16:20:34 +01:00
Filip Izydorczyk
389e557674 gr_nr + sym 2021-01-22 12:34:54 +01:00
4 changed files with 34 additions and 0 deletions

View File

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

View File

@@ -42,6 +42,8 @@ public class GroupDefaultResponse {
@ApiModelProperty(value = "Used only in resposnes realted to user assignments. For example in /api/v1/users/schedule.")
private Boolean isAccepted;
private Integer grNr;
/**
* creat new entity
*
@@ -55,6 +57,14 @@ public class GroupDefaultResponse {
this.lecturer = group.getLecturer() != null ? group.getLecturer().toString() : "";
this.room = group.getRoom() != null ? group.getRoom() : "";
this.type = group.getType() != null ? GroupType.isLectureOrClass(group.getType()) : null;
this.grNr = group.getGrNr() != null ? group.getGrNr() : null;
}
/**
* @return group number
*/
public Integer getGrNr() {
return grNr;
}
/**

View File

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

View File

@@ -9,6 +9,7 @@ public abstract class CoursesResponse {
private Long id;
private String name;
private String symbol;
/**
* create instance
@@ -18,6 +19,7 @@ public abstract class CoursesResponse {
public CoursesResponse(Course course) {
this.id = course.getId() != null ? course.getId() : null;
this.name = course.getName() != null ? course.getName() : "";
this.symbol = course.getSymbol() != null ? course.getSymbol() : "";
}
/**
@@ -27,6 +29,13 @@ public abstract class CoursesResponse {
return name;
}
/**
* @return course symbol
*/
public String getSymbol() {
return symbol;
}
/**
* @return db id
*/