Added cheks for type and course
This commit is contained in:
parent
4cf6cb58cb
commit
b740562e9d
@ -88,6 +88,14 @@ public class ExchangeController extends TokenBasedController {
|
|||||||
final Assignment assignmentInstance = assignment.get();
|
final Assignment assignmentInstance = assignment.get();
|
||||||
final Groups groupInstance = group.get();
|
final Groups groupInstance = group.get();
|
||||||
|
|
||||||
|
if (assignmentInstance.getGroup().getCourseId().getId() != groupInstance.getCourseId().getId()) {
|
||||||
|
return new ResponseEntity<>("You can performe exchange only within one course.", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (assignmentInstance.getGroup().getType() != groupInstance.getType()) {
|
||||||
|
return new ResponseEntity<>("You can't exchange lecture to class and otherwise.", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
if (!(assignmentInstance.getCommision().getCommisionOwner().getId().equals(asker.getId())
|
if (!(assignmentInstance.getCommision().getCommisionOwner().getId().equals(asker.getId())
|
||||||
&& assignmentInstance.isAccepted())) {
|
&& assignmentInstance.isAccepted())) {
|
||||||
return new ResponseEntity<>(
|
return new ResponseEntity<>(
|
||||||
|
Loading…
Reference in New Issue
Block a user