Fix: Open bill regex and the data sent by front-end was not compatible.
This commit is contained in:
parent
83aa47b33a
commit
d9a6c5d20f
|
@ -40,10 +40,10 @@ def from_bill(
|
||||||
):
|
):
|
||||||
with SessionFuture() as db:
|
with SessionFuture() as db:
|
||||||
query = select(Voucher)
|
query = select(Voucher)
|
||||||
if re.compile(r"^\d{2,}-\d{4}$").match(id_):
|
if re.compile(r"^\d{1,3}-\d{1,4}$").match(id_):
|
||||||
query = query.where(
|
s, n = id_.split("-")
|
||||||
Voucher.bill_id == int(id_.replace("-", "")), Voucher.voucher_type == VoucherType.REGULAR_BILL
|
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_):
|
elif re.compile(r"^K-\d+$").match(id_):
|
||||||
query = query.where(
|
query = query.where(
|
||||||
Voucher.kot_id == int(id_.replace("K-", "")),
|
Voucher.kot_id == int(id_.replace("K-", "")),
|
||||||
|
|
|
@ -21,11 +21,9 @@ export class SettingsService {
|
||||||
|
|
||||||
setPrefillCustomerDiscount(value: boolean): Observable<boolean> {
|
setPrefillCustomerDiscount(value: boolean): Observable<boolean> {
|
||||||
const url = '/api/settings/prefill-customer-discount';
|
const url = '/api/settings/prefill-customer-discount';
|
||||||
return this.http
|
return this.http.post<{ value: boolean }>(url, { value: value }).pipe(
|
||||||
.post<{ value: boolean }>(url, { value: value })
|
map((x) => x.value),
|
||||||
.pipe(
|
catchError(this.log.handleError(serviceName, 'setPrefillCustomerDiscount')),
|
||||||
map((x) => x.value),
|
) as Observable<boolean>;
|
||||||
catchError(this.log.handleError(serviceName, 'setPrefillCustomerDiscount')),
|
|
||||||
) as Observable<boolean>;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
lint.sh
2
lint.sh
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd -P )
|
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" || exit ; pwd -P )
|
||||||
cd "$parent_path/bookie" || exit
|
cd "$parent_path/bookie" || exit
|
||||||
npx prettier --write src/
|
npx prettier --write src/app
|
||||||
npx ng lint --fix
|
npx ng lint --fix
|
||||||
cd "$parent_path/barker" || exit
|
cd "$parent_path/barker" || exit
|
||||||
isort barker
|
isort barker
|
||||||
|
|
Loading…
Reference in New Issue