Skip to content

Commit

Permalink
last fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
youngcw committed Nov 4, 2024
1 parent a0c4326 commit e149f67
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions packages/loot-core/src/server/budget/goaltemplates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@ export async function applyMultipleCategoryTemplates({ month, categoryIds }) {
const query = `SELECT * FROM v_categories WHERE id IN (${placeholders})`;
const categories = await db.all(query, categoryIds);
await storeTemplates();
const category_templates = await getTemplates(categories, 'template');
const category_goals = await getTemplates(categories, 'goal');
const categoryTemplates = await getTemplates(categories);
const ret = await processTemplate(

Check warning on line 31 in packages/loot-core/src/server/budget/goaltemplates.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `⏎····month,⏎····true,⏎····categoryTemplates,⏎····categories,⏎··` with `month,·true,·categoryTemplates,·categories`
month,
true,
category_templates,
categoryTemplates,
categories,
);
await processGoals(category_goals, month);
return ret;
}

Expand All @@ -45,12 +43,7 @@ export async function applySingleCategoryTemplate({ month, category }) {
]);
await storeTemplates();
const categoryTemplates = await getTemplates(categories[0]);
const ret = await processTemplate(
month,
true,
categoryTemplates,
categories,
);
const ret = await processTemplate(month, true, categoryTemplates, categories);
return ret;
}

Expand All @@ -77,17 +70,14 @@ async function getTemplates(category) {

const templates = [];
for (let ll = 0; ll < goalDef.length; ll++) {
templates[goalDef[ll].id] = JSON.parse(goalDef[ll].goalDef);
templates[goalDef[ll].id] = JSON.parse(goalDef[ll].goal_def);
}
if (Array.isArray(category)) {
const multipleCategoryTemplates = [];
for (let dd = 0; dd < category.length; dd++) {
const categoryId = category[dd].id;
if (templates[categoryId] !== undefined) {
multipleCategoryTemplates[categoryId] = templates[categoryId];
multipleCategoryTemplates[categoryId] = multipleCategoryTemplates[
categoryId
].filter(t => t.directive === directive);
}
}
return multipleCategoryTemplates;
Expand Down Expand Up @@ -159,7 +149,7 @@ async function processTemplate(
monthUtils.sheetForMonth(month),
`to-budget`,
);
const priorities = [];
let priorities = [];
let remainderWeight = 0;
const errors = [];
const budgetList = [];
Expand Down

0 comments on commit e149f67

Please sign in to comment.