<commit_before>package seedu.unburden.logic.commands;

import seedu.unburden.commons.core.Messages;
import seedu.unburden.commons.core.UnmodifiableObservableList;
import seedu.unburden.model.task.ReadOnlyTask;
import seedu.unburden.model.task.UniqueTaskList.TaskNotFoundException;

/**
 * Deletes a person identified using it's last displayed index from the address book.
 * @@author A0143095H
 */

//@@<NAME> A0143095H
public class DoneCommand extends Command {

    public static final String COMMAND_WORD = "done";

    public static final String MESSAGE_USAGE = COMMAND_WORD
            + ": Marks the task identified by the index number used in the last task listing as done.\n"
            + "Parameters: INDEX (must be a positive integer)\n"
            + "Example: " + COMMAND_WORD + " 1";

    public static final String MESSAGE_DELETE_TASK_SUCCESS = "Well done! Task Done!";

    public final int targetIndex;

    public DoneCommand(int targetIndex) {
        this.targetIndex = targetIndex;
    }


    @Override
    public CommandResult execute() {

        UnmodifiableObservableList<ReadOnlyTask> lastShownList = model.getFilteredTaskList();

        if (lastShownList.size() < targetIndex) {
            indicateAttemptToExecuteIncorrectCommand();
            return new CommandResult(Messages.MESSAGE_INVALID_TASK_DISPLAYED_INDEX);
        }

        ReadOnlyTask taskToDone = lastShownList.get(targetIndex - 1);

        model.saveToPrevLists();
        model.doneTask(taskToDone, true);

        return new CommandResult(String.format(MESSAGE_DELETE_TASK_SUCCESS, taskToDone));
    }

}<commit_msg>Updated the done command<commit_after>package seedu.unburden.logic.commands;

import java.util.List;

import seedu.unburden.commons.core.Messages;
import seedu.unburden.commons.core.UnmodifiableObservableList;
import seedu.unburden.commons.exceptions.IllegalValueException;
import seedu.unburden.model.tag.UniqueTagList.DuplicateTagException;
import seedu.unburden.model.task.ReadOnlyTask;
import seedu.unburden.model.task.Task;
import seedu.unburden.model.task.UniqueTaskList.TaskNotFoundException;

/**
 * Deletes a person identified using it's last displayed index from the address
 * book.
 * 
 * @@author A0143095H
 */

// @@<NAME> A0143095H
public class DoneCommand extends Command {

	public static final String COMMAND_WORD = "done";

	public static final String MESSAGE_USAGE = COMMAND_WORD
			+ ": Marks the task identified by the index number used in the last task listing as done.\n"
			+ "Parameters: INDEX (must be a positive integer)\n" + "Example: " + COMMAND_WORD + " 1";

	public static final String MESSAGE_DELETE_TASK_SUCCESS = "Well done! Task Done!";

	public final int targetIndex;

	public DoneCommand(int targetIndex) {
		this.targetIndex = targetIndex;
	}

	@Override
	public CommandResult execute() throws DuplicateTagException, IllegalValueException {

		UnmodifiableObservableList<ReadOnlyTask> lastShownList = model.getFilteredTaskList();

		if (lastShownList.size() < targetIndex) {
			indicateAttemptToExecuteIncorrectCommand();
			return new CommandResult(Messages.MESSAGE_INVALID_TASK_DISPLAYED_INDEX);
		}

		ReadOnlyTask taskToDone = lastShownList.get(targetIndex - 1);

		model.saveToPrevLists();
		model.doneTask(taskToDone, true);
		overdueOrNot();
		return new CommandResult(String.format(MESSAGE_DELETE_TASK_SUCCESS, taskToDone));
	}

	// This method checks the entire list to check for overdue tasks
	private void overdueOrNot() throws IllegalValueException, DuplicateTagException {
		List<ReadOnlyTask> currentTaskList = model.getListOfTask().getTaskList();
		for (ReadOnlyTask task : currentTaskList) {
			if (((Task) task).checkOverDue()) {
				((Task) task).setOverdue();
			} else {
				((Task) task).setNotOverdue();
			}
		}
	}
}
{'fraction_non_alphanumeric': 0.0922266139657444, 'fraction_numerical': 0.008432147562582345, 'mean_word_length': 4.399715504978663, 'pattern_counts': {'":': 2, '<': 10, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3870394', 'n_tokens_mistral': 1209, 'n_tokens_neox': 1105, 'n_words': 273}