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