From e17130db7d952d14fc04c3a98689d60db2c884f2 Mon Sep 17 00:00:00 2001 From: qiujiaaa Date: Mon, 11 Nov 2019 13:14:05 +0800 Subject: [PATCH] Fix archiveordercard to not show schedule tags for cancelled orders + UG complete order --- docs/UserGuide.adoc | 4 +++- src/main/java/seedu/address/ui/cards/ArchivedOrderCard.java | 6 ++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/UserGuide.adoc b/docs/UserGuide.adoc index 6688cf32098..99cd19445a0 100644 --- a/docs/UserGuide.adoc +++ b/docs/UserGuide.adoc @@ -513,7 +513,9 @@ Format: `find-o KEYWORD [KEYWORD]...` ==== Complete an order : `complete` -Completes the order, order status changed to `COMPLETED`. Phone associated with order will also be deleted. + +Completes the order, order status changed to `COMPLETED`. + +Only `SCHEDULED` orders can be completed. + +Phone associated with order will also be deleted. + Format: `complete INDEX` ==== Cancel an order : `cancel` diff --git a/src/main/java/seedu/address/ui/cards/ArchivedOrderCard.java b/src/main/java/seedu/address/ui/cards/ArchivedOrderCard.java index ef7aeed0761..c6d3c83c69f 100644 --- a/src/main/java/seedu/address/ui/cards/ArchivedOrderCard.java +++ b/src/main/java/seedu/address/ui/cards/ArchivedOrderCard.java @@ -87,6 +87,8 @@ public ArchivedOrderCard(Order order, int displayedIndex) { orderPrice.setText(order.getPrice().value); if (order.getStatus().equals(Status.COMPLETED)) { + order.getSchedule().get().getTags().stream().sorted(Comparator.comparing(tag -> tag.tagName)) + .forEach(tag -> scheduleTags.getChildren().add(new Label(tag.tagName))); assert(order.getSchedule().isPresent()); try { orderStatus.setText(String.format("%s : %s | Venue: %s", order.getStatus().toString(), @@ -100,10 +102,6 @@ public ArchivedOrderCard(Order order, int displayedIndex) { orderStatus.setText(order.getStatus().toString()); } - if (order.getSchedule().isPresent()) { - order.getSchedule().get().getTags().stream().sorted(Comparator.comparing(tag -> tag.tagName)) - .forEach(tag -> scheduleTags.getChildren().add(new Label(tag.tagName))); - } if (order.getCustomer() != null) { order.getCustomer().getTags().stream() .sorted(Comparator.comparing(tag -> tag.tagName))