Fix todo bugs

This commit is contained in:
Made Baruna 2021-06-08 23:52:30 +07:00
parent e8581f8255
commit 5054f9d87f
No known key found for this signature in database
GPG key ID: 5AA5DA16AA5DCEAD
3 changed files with 16 additions and 32 deletions

View file

@ -390,7 +390,8 @@
"mora": "Mora (approximate ±40)",
"expWasted": "EXP Wasted",
"addToTodo": "Add to Todo List",
"addedToTodo": "Added to Todo List"
"addedToTodo": "Added to Todo List",
"talent": ["Attack", "Skill", "Burst"]
},
"expTable": {
"level": "Level",

View file

@ -284,6 +284,8 @@
}
}
});
moraNeeded = moraNeeded + talentMaterial.mora;
}
function calculateTalent() {
@ -407,6 +409,14 @@
calculateTalent();
}
}
for (const [id, item] of Object.entries(talentMaterial.items)) {
if (ascensionResouce[id]) {
ascensionResouce[id].amount += item.amount;
} else {
ascensionResouce[id] = item;
}
}
}
changed = false;
@ -429,14 +439,6 @@
return prev;
}, {});
const talentRes = Object.keys(talentMaterial.items).reduce((prev, item) => {
if (talentMaterial.items[item].amount > 0) {
prev[item] = talentMaterial.items[item].amount;
}
return prev;
}, {});
addTodo({
type: 'character',
character: withAscension ? selectedCharacter : null,
@ -445,13 +447,11 @@
mora: moraNeeded,
...levelRes,
...ascensionRes,
...talentRes,
},
original: {
mora: moraNeeded,
...levelRes,
...ascensionRes,
...talentRes,
},
});
@ -460,6 +460,7 @@
addedToTodo = false;
}, 2000);
}
</script>
<div class="bg-item rounded-xl p-4">
@ -665,26 +666,6 @@
</tr>
{/if}
{/each}
{#each Object.entries(talentMaterial.items) as [id, item]}
{#if item.amount > 0}
<tr>
<td class="text-right border-b border-gray-700 py-1">
<span class="text-white mr-2 whitespace-no-wrap"
>{item.amount}
<Icon size={0.5} path={mdiClose} /></span
>
</td>
<td class="border-b border-gray-700 py-1">
<span class="text-white">
<span class="w-6 inline-block">
<img class="h-6 inline-block mr-1" src={`/images/items/${id}.png`} alt={item.name} />
</span>
{item.name}
</span>
</td>
</tr>
{/if}
{/each}
<tr>
<td class="text-right border-b border-gray-700 py-1">
<span class="text-white mr-2 whitespace-no-wrap"

View file

@ -270,6 +270,7 @@
$: $todos, updateSummary();
$: columnCount, updateId();
</script>
<svelte:head>
@ -456,7 +457,7 @@
</Button>
</div>
<table class="w-full">
{#each Object.entries(todo.resources) as [id, amount]}
{#each Object.entries(todo.resources).sort((a, b) => b[1] - a[1]) as [id, amount]}
<tr>
<td class="text-right border-b border-gray-700 py-1">
<span class={`${amount === 0 ? 'line-through text-gray-600' : 'text-white'} mr-2 whitespace-no-wrap`}>
@ -496,4 +497,5 @@
@apply border-b-0;
}
}
</style>