Skip to content

Commit

Permalink
Minor change on block command parser to add flexibility and minor cha…
Browse files Browse the repository at this point in the history
…nges fro taskcard
  • Loading branch information
Yichen-D committed Nov 6, 2016
1 parent 9cddfa2 commit 58df78f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
17 changes: 6 additions & 11 deletions src/main/java/seedu/address/logic/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,10 @@ private Command prepareBlock(String args) {
try {

String startInput = matcher.group("startTime");
String endInput = matcher.group("endTime");

List<Date> datesToAdd = DateParser.getInstance().getFromToDatesFromString(startInput);
return new BlockCommand(getTagsFromArgs(matcher.group("tagArguments")),
new TaskDate(DateParser.getInstance().getDateFromString(startInput).getTime()),
new TaskDate(DateParser.getInstance().getDateFromString(endInput).getTime()));
new TaskDate(datesToAdd.get(0)),
new TaskDate(datesToAdd.get(1)));
} catch (IllegalValueException ive) {
return new IncorrectCommand(ive.getMessage());
}
Expand Down Expand Up @@ -754,14 +753,10 @@ private Command prepareView(String arguments) {
public static ArrayList<Date> extractDateInfo(Matcher m) throws IllegalValueException{
ArrayList<Date> resultSet = new ArrayList<Date>();
try {
String[] time = m.group("startTime").replace(" from ", "").split(" to ");
List<Date> datesToAdd = DateParser.getInstance().getFromToDatesFromString(m.group("startTime"));
resultSet.clear();
try {
resultSet.add(DateParser.getInstance().getDateFromString(time[START_TIME_INDEX]));
resultSet.add(DateParser.getInstance().getDateFromString(time[END_TIME_INDEX]));
} catch (IllegalValueException e) {
throw new IllegalValueException(MESSAGE_ILLEGAL_DATE_INPUT);
}
resultSet.add(datesToAdd.get(0));
resultSet.add(datesToAdd.get(1));
} catch (Exception ise) {
resultSet.clear();
try {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/ui/TaskCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private void initializeRecurringType() {

//@@author A0147967J
private void initializaRecurringPeriod() {
if(task.getRecurringPeriod() == Task.NO_RECURRING_PERIOD){
if(task.getRecurringPeriod() == Task.NO_RECURRING_PERIOD && !task.getRecurringType().equals(RecurringType.NONE)){
period.setText("Always");
} else {
period.setText("");
Expand Down

0 comments on commit 58df78f

Please sign in to comment.