From 840fcb56d1f11cb4091ff42d615328740ddaf88d Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Wed, 26 May 2021 21:28:41 +0200 Subject: [PATCH] [chore] Run prettier --- src/shims.d.ts | 8 ++++---- src/store.ts | 19 ++++--------------- src/utils/filter.ts | 7 +------ src/utils/utils.ts | 13 +++---------- 4 files changed, 12 insertions(+), 35 deletions(-) diff --git a/src/shims.d.ts b/src/shims.d.ts index e051226..7977df5 100644 --- a/src/shims.d.ts +++ b/src/shims.d.ts @@ -1,5 +1,5 @@ declare module '*.vue' { - import { ComponentOptions } from 'vue' - const component: ComponentOptions - export default component -} \ No newline at end of file + import { ComponentOptions } from 'vue'; + const component: ComponentOptions; + export default component; +} diff --git a/src/store.ts b/src/store.ts index 4707cdb..b91d9d8 100644 --- a/src/store.ts +++ b/src/store.ts @@ -1,10 +1,6 @@ import { api } from '@flaschengeist/api'; import { defineStore } from 'pinia'; -import { - calc_volume, - calc_cost_per_volume, - calc_all_min_prices, -} from './utils/utils'; +import { calc_volume, calc_cost_per_volume, calc_all_min_prices } from './utils/utils'; interface DrinkPriceVolume extends Omit { _volume: number; @@ -110,16 +106,11 @@ export const usePricelistStore = defineStore({ if (itm.length > 0) itm[0].name = drinkType.name; }, async getExtraIngredients() { - const { data } = await api.get>( - 'pricelist/ingredients/extraIngredients' - ); + const { data } = await api.get>('pricelist/ingredients/extraIngredients'); this.extraIngredients = data; }, async setExtraIngredient(ingredient: FG.ExtraIngredient) { - const { data } = await api.post( - 'pricelist/ingredients/extraIngredients', - ingredient - ); + const { data } = await api.post('pricelist/ingredients/extraIngredients', ingredient); this.extraIngredients.push(data); }, async updateExtraIngredient(ingredient: FG.ExtraIngredient) { @@ -277,9 +268,7 @@ export const usePricelistStore = defineStore({ this.pricelist_view = data; }, async getPriceListColumnOrder(userid: string) { - const { data } = await api.get>( - `pricelist/users/${userid}/pricecalc_columns_order` - ); + const { data } = await api.get>(`pricelist/users/${userid}/pricecalc_columns_order`); this.pricelist_columns_order = data; }, async updatePriceListColumnOrder(userid: string, data: Array) { diff --git a/src/utils/filter.ts b/src/utils/filter.ts index cb8c5ba..6deb65b 100644 --- a/src/utils/filter.ts +++ b/src/utils/filter.ts @@ -1,11 +1,6 @@ import { Drink } from '../store'; -function filter( - rows: Array, - terms: Search, - cols: Array, - cellValue: { (col: Col, row: Drink): string } -) { +function filter(rows: Array, terms: Search, cols: Array, cellValue: { (col: Col, row: Drink): string }) { if (terms.value) { return rows.filter((row) => { if (!terms.key || terms.key === '') { diff --git a/src/utils/utils.ts b/src/utils/utils.ts index c31b13a..0f29143 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -17,8 +17,7 @@ function calc_volume(volume: DrinkPriceVolume) { function calc_cost_per_volume(drink: Drink) { let retVal = drink._cost_per_volume; if (!!drink.volume && !!drink.package_size && !!drink.cost_per_package) { - retVal = - ((drink.cost_per_package || 0) / ((drink.volume || 0) * (drink.package_size || 0))) * 1.19; + retVal = ((drink.cost_per_package || 0) / ((drink.volume || 0) * (drink.package_size || 0))) * 1.19; } return retVal ? Math.round(retVal * 1000) / 1000 : retVal; @@ -37,9 +36,7 @@ function helper(volume: DrinkPriceVolume, min_price: number) { let extraIngredientPrice = 0; volume.ingredients.forEach((ingredient) => { if (ingredient.drink_ingredient) { - const _drink = usePricelistStore().drinks.find( - (a) => a.id === ingredient.drink_ingredient?.ingredient_id - ); + const _drink = usePricelistStore().drinks.find((a) => a.id === ingredient.drink_ingredient?.ingredient_id); retVal += ingredient.drink_ingredient.volume * (_drink?.cost_per_volume); } if (ingredient.extra_ingredient) { @@ -49,11 +46,7 @@ function helper(volume: DrinkPriceVolume, min_price: number) { return (retVal * min_price) / 100 + extraIngredientPrice; } -function calc_min_prices( - volume: DrinkPriceVolume, - cost_per_volume: number | undefined, - min_prices: Array -) { +function calc_min_prices(volume: DrinkPriceVolume, cost_per_volume: number | undefined, min_prices: Array) { const retVal: Array = []; volume.min_prices = []; if (min_prices) {