Chore: Reformatted everthing

Fix: Product ledger was not totalling.
This is because for some reason, pydantic was sending the data as string when the field was nullable
This commit is contained in:
2023-08-04 21:00:26 +05:30
parent af27bf74ef
commit ac868257b7
194 changed files with 513 additions and 1580 deletions
@@ -8,8 +8,7 @@ import { map } from 'rxjs/operators';
import { ProductLedgerItem } from './product-ledger-item';
/** Simple sort comparator for example ID/Name columns (for client-side sorting). */
const compare = (a: string | number, b: string | number, isAsc: boolean) =>
(a < b ? -1 : 1) * (isAsc ? 1 : -1);
const compare = (a: string | number, b: string | number, isAsc: boolean) => (a < b ? -1 : 1) * (isAsc ? 1 : -1);
export class ProductLedgerDataSource extends DataSource<ProductLedgerItem> {
constructor(
public data: ProductLedgerItem[],
@@ -63,13 +62,13 @@ export class ProductLedgerDataSource extends DataSource<ProductLedgerItem> {
case 'date':
return compare(a.date, b.date, isAsc);
case 'debitQuantity':
return compare(+a.debitQuantity, +b.debitQuantity, isAsc);
return compare(Number(a.debitQuantity ?? '0'), Number(b.debitQuantity ?? '0'), isAsc);
case 'debitAmount':
return compare(+a.debitAmount, +b.debitAmount, isAsc);
return compare(Number(a.debitAmount ?? '0'), Number(b.debitAmount ?? '0'), isAsc);
case 'creditQuantity':
return compare(+a.creditQuantity, +b.creditQuantity, isAsc);
return compare(Number(a.creditQuantity ?? '0'), Number(b.creditQuantity ?? '0'), isAsc);
case 'creditAmount':
return compare(+a.creditAmount, +b.creditAmount, isAsc);
return compare(Number(a.creditAmount ?? '0'), Number(b.creditAmount ?? '0'), isAsc);
default:
return 0;
}