diff --git a/barker/barker/routers/voucher/show.py b/barker/barker/routers/voucher/show.py index c0cf102..854fe1a 100644 --- a/barker/barker/routers/voucher/show.py +++ b/barker/barker/routers/voucher/show.py @@ -40,10 +40,10 @@ def from_bill( ): with SessionFuture() as db: query = select(Voucher) - if re.compile(r"^\d{2,}-\d{4}$").match(id_): - query = query.where( - Voucher.bill_id == int(id_.replace("-", "")), Voucher.voucher_type == VoucherType.REGULAR_BILL - ) + if re.compile(r"^\d{1,3}-\d{1,4}$").match(id_): + s, n = id_.split("-") + i = int(s * 10000) + int(n) + query = query.where(Voucher.bill_id == i, Voucher.voucher_type == VoucherType.REGULAR_BILL) elif re.compile(r"^K-\d+$").match(id_): query = query.where( Voucher.kot_id == int(id_.replace("K-", "")), diff --git a/bookie/src/app/settings/settings.service.ts b/bookie/src/app/settings/settings.service.ts index 1432507..4ab31ca 100644 --- a/bookie/src/app/settings/settings.service.ts +++ b/bookie/src/app/settings/settings.service.ts @@ -21,11 +21,9 @@ export class SettingsService { setPrefillCustomerDiscount(value: boolean): Observable { const url = '/api/settings/prefill-customer-discount'; - return this.http - .post<{ value: boolean }>(url, { value: value }) - .pipe( - map((x) => x.value), - catchError(this.log.handleError(serviceName, 'setPrefillCustomerDiscount')), - ) as Observable; + return this.http.post<{ value: boolean }>(url, { value: value }).pipe( + map((x) => x.value), + catchError(this.log.handleError(serviceName, 'setPrefillCustomerDiscount')), + ) as Observable; } } diff --git a/lint.sh b/lint.sh index c572fb3..ca784c3 100755 --- a/lint.sh +++ b/lint.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd -P ) cd "$parent_path/bookie" || exit -npx prettier --write src/ +npx prettier --write src/app npx ng lint --fix cd "$parent_path/barker" || exit isort barker