Goodbye extraneous console logging...
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -23,13 +23,11 @@ export function ProductInfo() {
|
||||
const [isEntryMode, setIsEntryMode] = useState(!isCompleteItem(item));
|
||||
|
||||
useEffect(() => {
|
||||
console.log('item', { item, complete: isCompleteItem(item) });
|
||||
setIsEntryMode(!isCompleteItem(item));
|
||||
}, [item])
|
||||
|
||||
useEffect(() => {
|
||||
if (isCompleteItem(inputItem)) {
|
||||
console.log('inputItem', { inputItem, barcode: `${inputItem?.product}${inputItem?.date}${inputItem?.processor}${inputItem?.weight}` });
|
||||
setItem(barcodeToProduct(`${inputItem?.product}${inputItem?.date}${inputItem?.processor}${inputItem?.weight}`));
|
||||
setInputItem(null);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
.page {
|
||||
padding: 1rem;
|
||||
min-height: 100vh;
|
||||
|
||||
h1 {
|
||||
margin-bottom: 1em;
|
||||
|
||||
@@ -48,11 +48,9 @@ export default function Page() {
|
||||
onDrop={handleDrop}
|
||||
>
|
||||
<h2>{binToLabel(parseInt(k))}</h2>
|
||||
{v.length > 0 && (
|
||||
<ul onDrop={handleDrop}>
|
||||
{v.map((item) => (<li key={(item as BinnedDocument)._id} onDragStart={() => setDragging(item)} draggable>{`${item.product} - ${item.weight}lbs`}</li>))}
|
||||
</ul>
|
||||
)}
|
||||
<ul onDrop={handleDrop}>
|
||||
{v.length > 0 && v.map((item) => (<li key={(item as BinnedDocument)._id} onDragStart={() => setDragging(item)} draggable>{`${item.product} - ${item.weight}lbs`}</li>))}
|
||||
</ul>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -16,14 +16,15 @@ export async function addToBin(bin: number, item: Omit<BinItem, 'bin'>) {
|
||||
|
||||
export async function getBinsContents(): Promise<BinsContents> {
|
||||
await db();
|
||||
const bins = {} as BinsContents;
|
||||
const createdAt = new Date();
|
||||
createdAt.setUTCHours(0,0,0,0);
|
||||
|
||||
createdAt.setDate(createdAt.getDate() - 1);
|
||||
createdAt.setHours(0,0,0,0);
|
||||
// Should be today, but lets do yesterday so there is more to see for demo purposes
|
||||
const binned = await Binned.find({ createdAt: { $gte: createdAt }});
|
||||
binned.forEach((item: BinItem) => bins[item.bin] = [...(bins[item.bin] ?? []), item]);
|
||||
return JSON.parse(JSON.stringify(bins));
|
||||
return JSON.parse(JSON.stringify(binned.reduce((bins: { [key in Bin]: BinItem[] }, cur: BinItem) => {
|
||||
bins[cur.bin] = [...bins[cur.bin], cur];
|
||||
return bins;
|
||||
}, { [Bin.LOSS]: [], [Bin.PROCESS]: [], [Bin.DONATE]: [], [Bin.SHOULDER_TAP]: [] })));
|
||||
}
|
||||
|
||||
export async function switchBin(bin: number, id: StringSchemaDefinition) {
|
||||
|
||||
Reference in New Issue
Block a user