From 9fdd88526c8c918f2296bae7a5d70589744075a0 Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Mon, 8 Sep 2025 10:30:53 -0700 Subject: [PATCH] IO-3358 Resolve update channel & null claim number. --- package.json | 2 +- src/main/decoder/decode-ad1.ts | 4 +++- src/main/decoder/decoder.ts | 16 +++++++++------- src/main/ipc/ipcMainHandler.user.ts | 15 +++++++++++---- src/main/util/checkForAppUpdates.ts | 6 ++++-- 5 files changed, 28 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 319970f..d6ccbf7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bodyshop-desktop", - "version": "1.0.4", + "version": "1.0.5-alpha.1", "description": "Shop Management System Partner", "main": "./out/main/index.js", "author": "Convenient Brands, LLC", diff --git a/src/main/decoder/decode-ad1.ts b/src/main/decoder/decode-ad1.ts index 9116a73..bbf515f 100644 --- a/src/main/decoder/decode-ad1.ts +++ b/src/main/decoder/decode-ad1.ts @@ -182,7 +182,9 @@ const DecodeAD1 = async ( if (!rawAd1Data.ownr_ph1 || _.isEmpty(rawAd1Data.ownr_ph1)) { rawAd1Data.ownr_ph1 = rawAd1Data.ownr_ph2; } - + if (rawAd1Data.clm_no === "") { + rawAd1Data.clm_no = undefined; + } let ownerRecord: OwnerRecordInterface; //Check if the owner information is there. If not, use the insured information as a fallback. if ( diff --git a/src/main/decoder/decoder.ts b/src/main/decoder/decoder.ts index 598e969..fa31bca 100644 --- a/src/main/decoder/decoder.ts +++ b/src/main/decoder/decoder.ts @@ -157,14 +157,16 @@ async function ImportJob(filepath: string): Promise { console.log("Available Job record to upload;", newAvailableJob); setAppProgressbar(0.95); - const existingJobRecord: QueryJobByClmNoResult = await client.request( - QUERY_JOB_BY_CLM_NO_TYPED, - { clm_no: jobObject.clm_no }, - ); + if (jobObject.clm_no) { + const existingJobRecord: QueryJobByClmNoResult = await client.request( + QUERY_JOB_BY_CLM_NO_TYPED, + { clm_no: jobObject.clm_no }, + ); - if (existingJobRecord.jobs.length > 0) { - newAvailableJob.issupplement = true; - newAvailableJob.jobid = existingJobRecord.jobs[0].id; + if (existingJobRecord.jobs.length > 0) { + newAvailableJob.issupplement = true; + newAvailableJob.jobid = existingJobRecord.jobs[0].id; + } } const insertRecordResult: InsertAvailableJobResult = await client.request( diff --git a/src/main/ipc/ipcMainHandler.user.ts b/src/main/ipc/ipcMainHandler.user.ts index faec7fa..eb367d8 100644 --- a/src/main/ipc/ipcMainHandler.user.ts +++ b/src/main/ipc/ipcMainHandler.user.ts @@ -20,10 +20,15 @@ const ipcMainHandleAuthStateChanged = async ( user: User | null, ): Promise => { Store.set("user", user); + log.debug("Received authentication state change from Renderer.", user); + await setReleaseChannel(); + checkForAppUpdatesContinuously(); +}; + +async function setReleaseChannel() { try { //Need to query the currently active shop, and store the metadata as well. //Also need to query the OP Codes for decoding reference. - log.debug("Received authentication state change from Renderer.", user); await handleShopMetaDataFetch(); //Check for updates const bodyshop = Store.get("app.bodyshop"); @@ -33,6 +38,8 @@ const ipcMainHandleAuthStateChanged = async ( } else if (bodyshop?.convenient_company?.toLowerCase() === "beta") { autoUpdater.channel = "beta"; log.debug("Setting update channel to BETA channel."); + } else { + log.debug("Setting update channel to LATEST channel."); } } catch (error) { log.error( @@ -44,8 +51,7 @@ const ipcMainHandleAuthStateChanged = async ( "Error connecting to ImEX Online servers to get shop data. Please try again.", ); } - checkForAppUpdatesContinuously(); -}; +} const handleShopMetaDataFetch = async ( reloadWindow?: boolean, @@ -89,7 +95,8 @@ const ipMainHandleResetPassword = async (): Promise => { }; export { + handleShopMetaDataFetch, ipcMainHandleAuthStateChanged, ipMainHandleResetPassword, - handleShopMetaDataFetch, + setReleaseChannel, }; diff --git a/src/main/util/checkForAppUpdates.ts b/src/main/util/checkForAppUpdates.ts index 26de575..bed4907 100644 --- a/src/main/util/checkForAppUpdates.ts +++ b/src/main/util/checkForAppUpdates.ts @@ -1,6 +1,8 @@ import { autoUpdater } from "electron-updater"; +import { setReleaseChannel } from "../ipc/ipcMainHandler.user"; -function checkForAppUpdatesContinuously(): void { +async function checkForAppUpdatesContinuously(): Promise { + await setReleaseChannel(); checkForAppUpdates(); setInterval( () => { @@ -16,4 +18,4 @@ function checkForAppUpdates(): void { }); } -export { checkForAppUpdatesContinuously, checkForAppUpdates }; +export { checkForAppUpdates, checkForAppUpdatesContinuously };