src/main/java/seedu/address/logic/commands/commandDone/DoneOneAssignmentOneStudent.java
@Override
    protected void preprocessUndoableCommand(Model model) throws CommandException {
        ID studentID = this.assignDescriptor.getAssignID(PREFIX_STUDENTID);
        ID assignmentID = this.assignDescriptor.getAssignID(PREFIX_ASSIGNMENTID);

        boolean studentExists = model.has(studentID, Constants.ENTITY_TYPE.STUDENT);
        boolean assignmentExists = model.has(assignmentID, Constants.ENTITY_TYPE.ASSIGNMENT);
        boolean progressExists = model.hasProgress(assignmentID, studentID);

        if (!studentExists) {
            throw new CommandException(MESSAGE_INVALID_STUDENT_ID);
        } else if (!assignmentExists) {
            throw new CommandException(MESSAGE_INVALID_ASSIGNMENT_ID);
        } else if (!progressExists) {
            throw new CommandException(MESSAGE_INVALID_STUDENT_ASSIGNMENT);
        } else {
            Progress progress = model.getProgress(assignmentID, studentID);

            if (progress.getIsDone()) {
                throw new CommandException(MESSAGE_INVALID_ASSIGNMENT_DONE);
            }

        }
    }
/**
     * If require this preprocessing step should override this method.
     *
     * @param model
     */
If require this preprocessing step should override this method.
@param model
If require this preprocessing step should override this method . @param model
@Override
    protected void preprocessUndoableCommand(Model model) throws CommandException {
        ID studentID = this.assignDescriptor.getAssignID(PREFIX_STUDENTID);
        ID assignmentID = this.assignDescriptor.getAssignID(PREFIX_ASSIGNMENTID);
        boolean studentExists = model.has(studentID, Constants.ENTITY_TYPE.STUDENT);
        boolean assignmentExists = model.has(assignmentID, Constants.ENTITY_TYPE.ASSIGNMENT);
        boolean progressExists = model.hasProgress(assignmentID, studentID);
        if (!studentExists) {
            throw new CommandException(MESSAGE_INVALID_STUDENT_ID);
        } else if (!assignmentExists) {
            throw new CommandException(MESSAGE_INVALID_ASSIGNMENT_ID);
        } else if (!progressExists) {
            throw new CommandException(MESSAGE_INVALID_STUDENT_ASSIGNMENT);
        } else {
            Progress progress = model.getProgress(assignmentID, studentID);
            if (progress.getIsDone()) {
                throw new CommandException(MESSAGE_INVALID_ASSIGNMENT_DONE);
            }
        }
    }
@ Override protected void preprocessUndoableCommand ( Model model ) throws CommandException { ID studentID = this . assignDescriptor . getAssignID ( PREFIX_STUDENTID ) ; ID assignmentID = this . assignDescriptor . getAssignID ( PREFIX_ASSIGNMENTID ) ; boolean studentExists = model . has ( studentID , Constants . ENTITY_TYPE . STUDENT ) ; boolean assignmentExists = model . has ( assignmentID , Constants . ENTITY_TYPE . ASSIGNMENT ) ; boolean progressExists = model . hasProgress ( assignmentID , studentID ) ; if ( ! studentExists ) { throw new CommandException ( MESSAGE_INVALID_STUDENT_ID ) ; } else if ( ! assignmentExists ) { throw new CommandException ( MESSAGE_INVALID_ASSIGNMENT_ID ) ; } else if ( ! progressExists ) { throw new CommandException ( MESSAGE_INVALID_STUDENT_ASSIGNMENT ) ; } else { Progress progress = model . getProgress ( assignmentID , studentID ) ; if ( progress . getIsDone ( ) ) { throw new CommandException ( MESSAGE_INVALID_ASSIGNMENT_DONE ) ; } } }
If require this preprocessing step should override this method.
If require this preprocessing step should override this method .