WZYCX / RSStodge-STUDENT

Files for Rugby School Stodge Application
2 stars 0 forks source link

Write CONFIRM order code #36

Closed WZYCX closed 1 year ago

WZYCX commented 1 year ago

Turn basket into an order Update stock values Generate unique code etc. Sort out firebase stuff

WZYCX commented 1 year ago

Screenshot 2023-01-15 at 22 50 57

WZYCX commented 1 year ago

Basket turns to an order on Firestore

WZYCX commented 1 year ago

Issue 1: Basket still full after order -- SOLVED: basket.currentBasket = []

Issue 2: Timestamp not transferring properly:

  1. FieldValue.serverTimestamp *DOESNT WORK
  2. NSDate().timeIntervalSince1970 DOESNT WORK -- SOLVED: Timestamp(date: Date()) WORKS

Issue 3: couldn't get last/ most recent order

  1. Firestore.firestore().collection("paperHole").order(by: "date", descending: true).limit(to: 1) * DOESNT WORK
  2. String(Int(Orders.all.last!.number)! + 1) * DOESNT WORK
WZYCX commented 1 year ago

SOLVED -- String(Int(Double(Orders.all.count)) + 1 *WORKS

Subtract order cost from balance

WZYCX commented 1 year ago

Also check for insufficient balance

WZYCX commented 1 year ago

All done! insufficient balance is here: https://github.com/WZYCX/RSStodge-STUDENT/issues/41