Skip to content

Commit

Permalink
skipJob filter jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
ceddybi committed Feb 8, 2024
1 parent 8fdb588 commit d90b251
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,11 @@ async function runApplying(ondemandJob?: AppJob): Promise<any> {
ipcMain.handle('app:skip', async (event, app: Application) => {
if (!app) return;

const jobId = _get(app, "job.id", "");
const newState = await getState();

if (newState.skippedApps) {
if (newState.skippedApps.some((a) => a.job?.id === app.job?.id)) {
if (newState.skippedApps.some((a) => a.job?.id === jobId)) {
return;
}
newState.skippedApps.push(app);
Expand All @@ -244,9 +245,12 @@ ipcMain.handle('app:skip', async (event, app: Application) => {
}
newState.activeJob = null;

if (newState.jobs) {
newState.jobs = newState.jobs.filter((j) => j.id !== jobId);
}

await setState(newState);

const jobId = _get(app, "job.id", "");
appEvents.emit(APPEVENTS.APP_STOP, jobId);

return newState;
Expand Down

0 comments on commit d90b251

Please sign in to comment.