Untitled

mail@pastecode.io avatar
unknown
java
a month ago
968 B
3
Indexable
Never
        private void updateEpicStatus(Epic epic) {
        
        boolean allIsInProgress = true; 
        boolean hasNewOrInProgress = false; // Добавлено для правильной проверки 
 
        ArrayList<Subtask> list = epic.getSubtaskList(); 
 
        for (Subtask subtask : list) { 
            if (subtask.getStatus() != Status.DONE) { 
                allIsDone = false; 
            } 
            if (subtask.getStatus() != Status.IN_PROGRESS) { 
                allIsInProgress = false; 
            } 
            if (subtask.getStatus() == Status.NEW || subtask.getStatus() == Status.IN_PROGRESS) { 
                hasNewOrInProgress = true; 
            } 
        } 
 
        if (allIsDone) { 
            epic.setStatus(Status.DONE); 
        } else if (allIsInProgress || hasNewOrInProgress) { 
            epic.setStatus(Status.IN_PROGRESS); 
        } else { 
            epic.setStatus(Status.NEW); 
        } 
    } 
 
Leave a Comment