Skip to content

Commit e350f99

Browse files
committed
rdy
1 parent 81ab6f6 commit e350f99

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/WebUI/app/pages/shop.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ usePageLoading(loadingItems)
7171
7272
const flatItems = ref<ItemFlat[]>([])
7373
watch(items, () => {
74-
flatItems.value = createItemIndex(items.value, true)
74+
flatItems.value = createItemIndex(items.value, false) // TODO: weaponUsage next iteration
7575
})
7676
7777
const [buyItem] = useAsyncCallback(async (item: ItemFlat) => {

src/WebUI/app/services/item-search-service/indexator.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { cloneDeep } from 'es-toolkit'
2+
13
import type {
24
Item,
35
ItemFlat,
@@ -302,7 +304,7 @@ export const createItemIndex = (items: Item[], cloneMultipleUsageWeapon = false)
302304
const newItemDateThreshold = new Date().setDate(new Date().getDate() - itemIsNewDays)
303305

304306
// TODO: try to remove cloneDeep
305-
const result = structuredClone(items).reduce<ItemFlat[]>((out, item) => {
307+
const result = cloneDeep(items).reduce<ItemFlat[]>((out, item) => {
306308
// TODO: bows have 2 loading modes, so there are several objects in the weapons data structure
307309
if (item.weapons.length > 1 && item.type !== ITEM_TYPE.Bow) {
308310
item.weapons.forEach((w) => {

src/WebUI/app/utils/math.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,11 @@ export const applyPolynomialFunction = (
44
) => coefficients.reduce((acc, coefficient, idx) => acc + coefficient * x ** (coefficients.length - idx - 1), 0)
55

66
export const roundFLoat = (num: number) => Math.round((num + Number.EPSILON) * 100) / 100
7+
8+
export const percentOf = (val: number, of: number) => {
9+
if (of === 0) {
10+
return 0
11+
}
12+
13+
return (val / of) * 100
14+
}

0 commit comments

Comments
 (0)