forked from nus-cs2113-AY2324S1/tp
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/AY2324S1-CS2113-F11-1/tp
- Loading branch information
Showing
10 changed files
with
233 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/seedu/duke/commands/logcommands/UpdateLogCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package seedu.duke.commands.logcommands; | ||
|
||
import java.util.List; | ||
|
||
import seedu.duke.commands.Command; | ||
import seedu.duke.commands.CommandResult; | ||
import seedu.duke.Duke; | ||
|
||
public class UpdateLogCommand extends Command { | ||
public static final String COMMAND_WORD = "update"; | ||
public String feedbackToUser; | ||
private List<String> exerciseDetails; | ||
|
||
public UpdateLogCommand() { | ||
super(); | ||
} | ||
|
||
public UpdateLogCommand(List<String> exerciseDetails) { | ||
super(); | ||
this.exerciseDetails = exerciseDetails; | ||
} | ||
|
||
/** | ||
* Extracts the details of the update command and updates the specified exercise. | ||
* | ||
* @return CommandResult that tells the user whether an exercise was successfully updated. | ||
*/ | ||
public CommandResult execute() { | ||
int month = Integer.parseInt(exerciseDetails.get(0)); | ||
int day = Integer.parseInt(exerciseDetails.get(1)); | ||
String oldExerciseName = exerciseDetails.get(2); | ||
int oldCaloriesBurned = Integer.parseInt(exerciseDetails.get(3)); | ||
String newExerciseName = exerciseDetails.get(4); | ||
int newCaloriesBurned = Integer.parseInt(exerciseDetails.get(5)); | ||
|
||
feedbackToUser = Duke.exerciseLog.updateExercise(month, day, oldExerciseName, oldCaloriesBurned, | ||
newExerciseName, newCaloriesBurned) ? "Exercise successfully updated!" : | ||
"Could not find exercise to update."; | ||
|
||
return new CommandResult(feedbackToUser); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
package seedu.duke.data.meal; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
import seedu.duke.data.DateTime; | ||
|
||
public class Meal { | ||
public String name; | ||
public int calories; | ||
public DateTime time; | ||
// public DateTime time; | ||
|
||
public Meal(String name, int calories) throws Exception { | ||
this.name = name; | ||
this.calories = calories; | ||
this.time = new DateTime(LocalDateTime.now().toString()); | ||
// this.time = new DateTime(LocalDateTime.now().toString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters