-
Notifications
You must be signed in to change notification settings - Fork 252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AY1920S1-CS2113-T09-1] Hustler #91
base: master
Are you sure you want to change the base?
[AY1920S1-CS2113-T09-1] Hustler #91
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall good job. Just some coding quality issues like magic numbers and commenting issues.
taskType = "deadline"; | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation problem here.
taskType = "event"; | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation problem here.
ui.show_message("/" + timeCommand + " is an invalid addition to /add"); | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation problem here.
|
||
Hustler.saveStorage(); | ||
} catch (CommandLineException | IOException e) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
??
public class CommandLog { | ||
|
||
private static ArrayList<String> commandlog; | ||
private static boolean isRestoring = false; | ||
|
||
public CommandLog() { | ||
commandlog = new ArrayList<String>(); | ||
} | ||
|
||
public static void recordCommand(String command) { | ||
commandlog.add(command); | ||
} | ||
|
||
public static void restoreData(int numberOfCommandsToUndo) { | ||
isRestoring = true; | ||
int restoreDataUntil = commandlog.size() - numberOfCommandsToUndo; | ||
|
||
if (restoreDataUntil >= 0) { | ||
for (int i = 0; i < restoreDataUntil; i++) { | ||
try { | ||
CommandParser parser = new CommandParser(); | ||
|
||
Command command = parser.parse(commandlog.get(i)); | ||
command.execute(); | ||
|
||
Hustler.saveStorage(); | ||
} catch (CommandLineException | IOException e) { | ||
|
||
} | ||
} | ||
|
||
while (commandlog.size() > restoreDataUntil) { | ||
commandlog.remove(restoreDataUntil); | ||
} | ||
} else { | ||
System.out.println("Error! You are attempting to undo more commands than is possible!"); | ||
} | ||
isRestoring = false; | ||
} | ||
|
||
public static boolean isRestoring() { | ||
return isRestoring; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing header comments. All non trivial methods should have javadoc format header comments. You have done so for the rest of the classes but not here.
suffix = "st"; | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation problem here.
/** | ||
* Reminder list that contains tasks that are overdue. | ||
*/ | ||
private static ArrayList<Task> overDueList = new ArrayList<>(); | ||
/** | ||
* Reminder list that contain tasks with less than 30 minutes or less till deadline. | ||
*/ | ||
private static ArrayList<Task> lastDayList = new ArrayList<>(); | ||
/** | ||
* Reminder list htat contain tasks with less than 24 hours or less till deadline. | ||
*/ | ||
private static ArrayList<Task> lastThirtyMinutesList = new ArrayList<>(); | ||
/** | ||
* 24 hours converted to seconds. | ||
*/ | ||
private static final int TWENTY_FOUR_HOURS = 86400; | ||
/** | ||
* 30 minutes converted to seconds. | ||
*/ | ||
private static final int THIRTY_MINUTES = 1800; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New lines should seperate these since they have comments
if (!done && checkDeadline || checkEvent || checkRange) { | ||
if (checkOverdue(i)) { | ||
overDueList.add(list.get(i)); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two if statements can be combined into one.
public static void displayReminders() { | ||
if (!overDueList.isEmpty()) { | ||
if (overDueList.size() == 1) { | ||
System.out.println("\t_____________________________________"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines can be saved into some variable since they are used so many times. Also to avoid "magic strings"; if you need to change these in the future, it would be a hassle to do so to all of them.
this.tag.toString() + " " + | ||
this.getDescription(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be on the same line
Please code this PR after reading my comments. |
Fixed null pointer exception
# Conflicts: # src/main/java/seedu/hustler/game/avatar/Inventory.java # src/main/java/seedu/hustler/logic/command/avatar/CheckAvatarCommand.java # src/main/java/seedu/hustler/logic/parser/anomaly/AddCommandAnomaly.java
Rename statusTypes.java to StatusTypes.java
… into branch-Achievements
Fixed small checkstyle error
TaskStorageTest fix
… into branch-Achievements
undo fixes
Fixed checkstyle errors for JUNIT testing
[AY1920S1-CS2113T-T09-1]-jingkang97-Fixed checkstyle for reminders
Fixed reminders checkstyle
fixed comments
final checkstyle fix
fixed checkstyle
Fixed Recommended Schedule bug for test cases
@ngjiewu
@nystera
@jingkang97
@EnriqueKhai
@yzia2000