-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add template command and template creation #62
Conversation
|
||
public class AddTemplateCommand extends CommandForExercise{ | ||
|
||
public static final String COMMAND_WORD = "temp"; |
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.
maybe better command word? Since temp can mean temporary
|
||
private final Exercise toAdd; | ||
|
||
public AddTemplateCommand(Exercise toAdd) { |
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.
Naming with CreateTemplateCommand is similar
ArgumentTokenizer.tokenize(args, PREFIX_NAME, PREFIX_DESCRIPTION, PREFIX_CALORIES); | ||
|
||
if (!arePrefixesPresent(argMultimap, PREFIX_NAME, PREFIX_DESCRIPTION, PREFIX_CALORIES) | ||
/*|| !argMultimap.getPreamble().isEmpty()*/) { |
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.
commented out
@@ -105,6 +107,12 @@ public void addExercise(Exercise exercise) { | |||
updateFilteredExerciseList(PREDICATE_SHOW_ALL_EXERCISE); | |||
} | |||
|
|||
@Override | |||
public void createTemplate(Template template) { |
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.
createtemplate vs addtemplate: same idea, different naming? Better to use one
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.
Suggestions for future implementation:
- Create JSonTemplate class to write the file in JsonFormat
- Abstract out the load (which is now at TemplateList) and write (which is now at Template) to Storage class.
For now, it is fine. Best to implement for the next iteration.
return list; | ||
} | ||
|
||
public static Template getTemp(String name) { |
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.
Where is this used?
FileWriter fw = new FileWriter("data/template.txt"); | ||
String textToAdd = ""; | ||
|
||
for (int i = 0; i < lists.size(); 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.
Better to extract this and add it to storage
…nto v1.3 # Conflicts: # src/main/java/seedu/address/logic/parser/AddCommandParser.java
Codecov Report
@@ Coverage Diff @@
## v1.3 #62 +/- ##
============================================
- Coverage 60.68% 56.89% -3.79%
Complexity 518 518
============================================
Files 100 106 +6
Lines 1928 2058 +130
Branches 197 213 +16
============================================
+ Hits 1170 1171 +1
- Misses 672 800 +128
- Partials 86 87 +1
Continue to review full report at Codecov.
|
No description provided.