Skip to content

Commit

Permalink
Fix misc (#342)
Browse files Browse the repository at this point in the history
* fix: Make the area name prioritize the one from the logs

* fix: Make log reading fail properly

* fix: Make mapruns insert replace in case of double entry

* fix: Make the Maprun insert log the run info
  • Loading branch information
Qt-dev authored Aug 21, 2024
1 parent 11fbf6c commit 9be9bea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/main/modules/ClientTxtWatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ function start() {
}
}
});
tail.on('error', (error) => {
logger.error(`Error reading client.txt: ${error}`);
});
tail.watch();
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/modules/OCRWatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ async function processImageBuffer(buffer, timestamp, type) {
logger.debug('Processing area info');
const area = getAreaInfo(lines);
try {
const areaName = await getAreaNameFromDB(timestamp);
logger.info(`Got last entered area from db: ${areaName}`);
const areaName = area.name ?? await getAreaNameFromDB(timestamp);
logger.info(`Got last entered area: ${areaName}`);
area.name = areaName;
} catch (e) {
logger.info(`Got last entered area from ocr: ${area.name}`);
Expand Down
3 changes: 2 additions & 1 deletion src/main/modules/RunParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1064,8 +1064,9 @@ const RunParser = {
},

insertMapRun: async (mapData: MapData): Promise<void> => {
logger.debug('Inserting map run:', mapData);
return OldDB.run(
'INSERT INTO mapruns(id, firstevent, lastevent, iiq, iir, packsize, xp, kills, runinfo) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) ',
'INSERT OR REPLACE INTO mapruns(id, firstevent, lastevent, iiq, iir, packsize, xp, kills, runinfo) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) ',
mapData
)
.then(() => {
Expand Down

0 comments on commit 9be9bea

Please sign in to comment.