Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
721 B
0
Indexable
Never
    private void updateEpicStatus(Epic epic) {
        ArrayList<Subtask> subtaskList = epic.getSubtaskList();
        int doneSubtasksCount = 0;
        for (Subtask subtask : subtaskList) {
            if (subtask.getStatus().equals(Status.DONE)) {
                doneSubtasksCount++;
            } else if (subtask.getStatus().equals(Status.IN_PROGRESS)) {
                epic.setStatus(Status.IN_PROGRESS);
                break;
            }
        }
        if (doneSubtasksCount == 0) {
            epic.setStatus(Status.NEW);
        } else if (doneSubtasksCount == subtaskList.size()) {
            epic.setStatus(Status.DONE);
        } else {
            epic.setStatus(Status.IN_PROGRESS);
        }
    }
Leave a Comment