Skip to content

Commit

Permalink
Merge pull request #87 from MauriceTXS/notification
Browse files Browse the repository at this point in the history
Updated Suggest feature and UserGuide
  • Loading branch information
FelixNWJ authored Oct 29, 2019
2 parents e364063 + cb2e9b5 commit d1e314d
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/UserGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,11 @@ Examples:

* `delete 1`

=== Suggesting Meal options
=== Suggesting Meal options: `suggest`

Suggest possible meals based on user calorie intake budget. +
The available meals will be shown under the "Suggested Meals" section of the application.
The available meals will be shown under the "Suggested Meals" section of the application. +
Format: `sugggest`

=== Setting calorie intake budget: `set`

Expand Down
Binary file modified docs/images/Ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions src/main/java/calofit/logic/commands/SuggestCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package calofit.logic.commands;

import calofit.model.Model;

/**
* Suggest meal for user according to calorie budget left.
*/
public class SuggestCommand extends Command {

public static final String COMMAND_WORD = "suggest";

public static final String MESSAGE_SUCCESS = "The suggested meals are listed below!";


@Override
public CommandResult execute(Model model) {

int remain = model.getRemainingCalories();
model.setDishFilterPredicate(null);

return new CommandResult(MESSAGE_SUCCESS);
}
}
4 changes: 4 additions & 0 deletions src/main/java/calofit/logic/parser/CommandParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import calofit.logic.commands.HelpCommand;
import calofit.logic.commands.ListCommand;
import calofit.logic.commands.ReportCommand;
import calofit.logic.commands.SuggestCommand;
import calofit.logic.parser.exceptions.ParseException;

/**
Expand Down Expand Up @@ -72,6 +73,9 @@ public Command parseCommand(String userInput) throws ParseException {
case ReportCommand.COMMAND_WORD:
return new ReportCommand();

case SuggestCommand.COMMAND_WORD:
return new SuggestCommand();

case "set":
return new SetBudgetCommandParser().parse(arguments);

Expand Down

0 comments on commit d1e314d

Please sign in to comment.