This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
<script lang="ts">
|
||||
import type { GoalCompositionMode } from "../models/goal";
|
||||
import type { GoalCompositionMode, GoalLogResult } from "../models/goal";
|
||||
import type { LogResult } from "../models/log";
|
||||
import type { TaskResult } from "../models/task";
|
||||
|
||||
interface CompositionItem {
|
||||
link: string
|
||||
@@ -19,14 +18,16 @@ import type { TaskResult } from "../models/task";
|
||||
|
||||
if (mode === "item") {
|
||||
for (const log of logs) {
|
||||
const item = log.item;
|
||||
if (!map[item.id]) {
|
||||
map[item.id] = {name: item.name, amount: log.itemAmount, link: `/items#${item.id}`};
|
||||
} else {
|
||||
map[item.id].amount += log.itemAmount;
|
||||
if (log.itemCounted !== false) {
|
||||
const item = log.item;
|
||||
if (!map[item.id]) {
|
||||
map[item.id] = {name: item.name, amount: log.itemAmount, link: `/items#${item.id}`};
|
||||
} else {
|
||||
map[item.id].amount += log.itemAmount;
|
||||
}
|
||||
}
|
||||
|
||||
if (log.secondaryItem) {
|
||||
if (log.secondaryItem && log.secondaryItemCounted !== false) {
|
||||
const item = log.secondaryItem;
|
||||
if (!map[item.id]) {
|
||||
map[item.id] = {name: item.name, amount: log.secondaryItemAmount, link: `/items#${item.id}`};
|
||||
@@ -49,7 +50,7 @@ import type { TaskResult } from "../models/task";
|
||||
}
|
||||
}
|
||||
|
||||
list = Object.keys(map).sort((a, b) => map[b].amount - map[a].amount).map(k => map[k]);
|
||||
list = Object.keys(map).sort((a, b) => map[b].amount - map[a].amount).map(k => map[k]).filter(e => e.amount > 0);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user