Browse Source

tweak goal composition and fix label in goal form.

main
Gisle Aune 4 years ago
parent
commit
99cc6fac3c
  1. 18
      svelte-ui/src/components/Composition.svelte
  2. 2
      svelte-ui/src/forms/GoalForm.svelte

18
svelte-ui/src/components/Composition.svelte

@ -20,18 +20,18 @@ import type { TaskResult } from "../models/task";
if (mode === "item") { if (mode === "item") {
for (const log of logs) { for (const log of logs) {
const item = log.item; const item = log.item;
if (!map[item.name]) {
map[item.name] = {name: item.name, amount: log.itemAmount, link: `/items#${item.id}`};
if (!map[item.id]) {
map[item.id] = {name: item.name, amount: log.itemAmount, link: `/items#${item.id}`};
} else { } else {
map[item.name].amount += log.itemAmount;
map[item.id].amount += log.itemAmount;
} }
if (log.secondaryItem) { if (log.secondaryItem) {
const item = log.secondaryItem; const item = log.secondaryItem;
if (!map[item.name]) {
map[item.name] = {name: item.name, amount: log.secondaryItemAmount, link: `/items#${item.id}`};
if (!map[item.id]) {
map[item.id] = {name: item.name, amount: log.secondaryItemAmount, link: `/items#${item.id}`};
} else { } else {
map[item.name].amount += log.secondaryItemAmount;
map[item.id].amount += log.secondaryItemAmount;
} }
} }
} }
@ -41,10 +41,10 @@ import type { TaskResult } from "../models/task";
const amount = log.secondaryItem ? log.secondaryItemAmount + log.itemAmount : log.itemAmount; const amount = log.secondaryItem ? log.secondaryItemAmount + log.itemAmount : log.itemAmount;
if (!map[task.name]) {
map[task.name] = {name: task.name, amount, link: `/questlog#${task.projectId}`};
if (!map[task.id]) {
map[task.id] = {name: task.name, amount, link: `/questlog#${task.projectId}`};
} else { } else {
map[task.name].amount += amount;
map[task.id].amount += amount;
} }
} }
} }

2
svelte-ui/src/forms/GoalForm.svelte

@ -119,7 +119,7 @@ import type { GroupResult } from "../models/group";
<GroupItemSelect disabled={deletion} optional optionalLabel="Whole Group" group={selectedGroup} name="itemId" bind:value={itemId}/> <GroupItemSelect disabled={deletion} optional optionalLabel="Whole Group" group={selectedGroup} name="itemId" bind:value={itemId}/>
<label for="amount">Amount</label> <label for="amount">Amount</label>
<input disabled={deletion} name="amount" type="number" bind:value={amount} /> <input disabled={deletion} name="amount" type="number" bind:value={amount} />
<label for="compositionMode">Composition Mode (does nothing right now)</label>
<label for="compositionMode">Composition Mode</label>
<select name="compositionMode" bind:value={compositionMode} disabled={deletion}> <select name="compositionMode" bind:value={compositionMode} disabled={deletion}>
<option value="item" selected={"item" === compositionMode}>Item</option> <option value="item" selected={"item" === compositionMode}>Item</option>
<option value="task" selected={"task" === compositionMode}>Task</option> <option value="task" selected={"task" === compositionMode}>Task</option>

Loading…
Cancel
Save