change: disable machine status update if not brew

- fix: payload of price get unknown service ref

Signed-off-by: pakintada@gmail.com <Pakin>
This commit is contained in:
pakintada@gmail.com 2026-05-27 07:58:33 +07:00
parent 07977ce896
commit 79a76f5c3e
3 changed files with 30 additions and 26 deletions

View file

@ -336,31 +336,33 @@
$effect(() => {
// interval check 1s
// machine
interval_get_machine_status = setInterval(() => {
if (
getMachineStatus() == undefined ||
getMachineStatus() == null ||
$machineInfoStore?.status === undefined
) {
// set default now
updateMachineStatus('');
}
console.log(
'machine status pinging recipe editor dialog',
getMachineStatus(),
$machineInfoStore?.status
);
// update machine status
// check-connection
sendToAndroid({
type: 'check-connection',
payload: {
start: new Date().toLocaleTimeString()
if (refPage === 'brew') {
interval_get_machine_status = setInterval(() => {
if (
getMachineStatus() == undefined ||
getMachineStatus() == null ||
$machineInfoStore?.status === undefined
) {
// set default now
updateMachineStatus('');
}
});
}, 1000);
console.log(
'machine status pinging recipe editor dialog',
getMachineStatus(),
$machineInfoStore?.status
);
// update machine status
// check-connection
sendToAndroid({
type: 'check-connection',
payload: {
start: new Date().toLocaleTimeString()
}
});
}, 1000);
}
});
onDestroy(() => {

View file

@ -327,8 +327,8 @@ const handlers: Record<string, (payload: any) => void> = {
try {
let raw_payload = JSON.parse(streamRawInstance[request_id]);
let ref_from_raw = raw_payload.ref ?? '';
let from_service_raw = raw_payload.from ?? '';
let ref_from_raw = raw_payload.payload.ref ?? '';
let from_service_raw = raw_payload.payload.from ?? '';
let parsed_payload = raw_payload.payload ?? '';
if (from_service_raw == 'sheet-service') {

View file

@ -37,9 +37,11 @@ export function handleSheetResponseFromNoti(raw_payload: any, ref: string, count
switch (ref) {
case 'price':
let price_contents: PayloadFromSheet[] = raw_payload.content;
console.log(`price content length: ${price_contents.length}`);
let header_idx = PRICE_SHEET_DEFINITION_BY_COUNTRY[country ?? 'unknown'].get_header_idx(
price_contents[0].header
);
console.log(`header idx: ${header_idx}`);
let lastRequestSheetInstance = get(lastRequestSheetPrice);
let products = lastRequestSheetInstance[country ?? 'unknown'];