From 57874136b582533fe5a7b5467929303e89db8eea Mon Sep 17 00:00:00 2001 From: midblep Date: Wed, 25 May 2022 01:08:10 +0200 Subject: [PATCH] fixes --- src/lib/calculator/Calculator.svelte | 43 +++++++++++++++++++++------- src/lib/en-lang.json | 6 +--- 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/src/lib/calculator/Calculator.svelte b/src/lib/calculator/Calculator.svelte index 3cf6250..8f6fef5 100644 --- a/src/lib/calculator/Calculator.svelte +++ b/src/lib/calculator/Calculator.svelte @@ -138,9 +138,11 @@ function update_price(commission: Commission) { commission.price = 0; - for (let index = 0; index < commission.questions.length; index++) { - const question = commission.questions[index]; + for (let index = 0; index < commission.answers.length; index++) { const answer = commission.answers[index]; + const question = commission.questions.filter(value => { + return value['name'] == answer['name']; + })[0]; question['options'].forEach(value => { if(value['name'] == answer['option']) { @@ -259,7 +261,7 @@
{update_example(commission)}}>
- {update_commission_type(commission)}}> {#each types as question} {/each} @@ -267,14 +269,35 @@
{#each commission.questions as question, key} -
- - {update_price(commission)}}> + {#each question.options as option} + + {/each} + +
{/each} - - +
+ + {#if commission.answers.filter(value => { return value['name'] == question.name; }).length > 1} + + {/if} +
+ + {:else} +
+ + +
+ {/if} {/each}
diff --git a/src/lib/en-lang.json b/src/lib/en-lang.json index bdcb1ac..30610e5 100644 --- a/src/lib/en-lang.json +++ b/src/lib/en-lang.json @@ -233,10 +233,6 @@ "name": "basic", "url": "/commissions/fullbodybasic.jpg" }, - { - "name": "ultralineart", - "url": "/commissions/fullbodyultralineart.jpg" - }, { "name": "basiclineless", "url": "/commissions/fullbodybasiclineless.jpg" @@ -266,7 +262,6 @@ }, { "name": "Ultra Lineart", - "example": "ultralineart", "price": 45 } ] @@ -344,6 +339,7 @@ }, { "name": "Additions", + "multiple": true, "options": [ { "name": "None",