From 2021f74872c1fb5ca134c7a55a5412384371aa06 Mon Sep 17 00:00:00 2001 From: Sai Naw Wun Date: Wed, 21 Oct 2020 06:24:26 +0630 Subject: [PATCH] fix fcs shipment query --- lib/pages/fcs_shipment/model/fcs_shipment_model.dart | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/pages/fcs_shipment/model/fcs_shipment_model.dart b/lib/pages/fcs_shipment/model/fcs_shipment_model.dart index d7f9883..f48a5d1 100644 --- a/lib/pages/fcs_shipment/model/fcs_shipment_model.dart +++ b/lib/pages/fcs_shipment/model/fcs_shipment_model.dart @@ -31,9 +31,6 @@ class FcsShipmentModel extends BaseModel { void privilegeChanged() { super.privilegeChanged(); _loadFcsShipments(); - - if (_shipped != null) _shipped.close(); - _shipped = _getShipped(); } initData() { @@ -42,6 +39,7 @@ class FcsShipmentModel extends BaseModel { if (_shipped != null) _shipped.close(); _shipped = _getShipped(); + _shipped.load(); } Future _loadFcsShipments() async { @@ -52,8 +50,9 @@ class FcsShipmentModel extends BaseModel { try { listener = Firestore.instance .collection("$path") - .orderBy("shipment_number", descending: true) .where("status", isEqualTo: fcs_shipment_confirmed_status) + .where("is_deleted", isEqualTo: false) + .orderBy("shipment_number", descending: true) .snapshots() .listen((QuerySnapshot snapshot) { _fcsShipments.clear(); @@ -76,7 +75,7 @@ class FcsShipmentModel extends BaseModel { .collection("/$fcs_shipment_collection") .where("status", isEqualTo: fcs_shipment_shipped_status) .where("is_deleted", isEqualTo: false) - .orderBy("status_date", descending: true); + .orderBy("shipment_number", descending: true); var paginator = new Paginator(pageQuery, rowPerLoad: 20, toObj: (data, id) { return FcsShipment.fromMap(data, id); });