Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
MaHaWo committed Oct 23, 2024
1 parent e3851fb commit 39ecb04
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions frontend/src/lib/components/UserDataInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
function convertQuestions(questionnaire: GetUserQuestionsResponse): GetUserQuestionsResponse {
// TODO: once questions come from the database we can do this with the questionnaire
// different algorithm that makes use of the component lookup table in '$lib/stores' is needed here then.
questionnaire.map((e) => {
return e;
});
return questionnaire;
}
Expand All @@ -28,13 +25,28 @@
// the backend models
return data.map((e, index) => {
if (e.additionalValue !== '' && e.additionalValue !== null && e.value === e.textTrigger) {
console.log(
'condition: ',
e.additionalValue !== '',
e.additionalValue !== null,
e.value === e.textTrigger,
e.value,
e.additionalValue,
e.props.textTrigger
);
if (
e.additionalValue !== '' &&
e.additionalValue !== null &&
e.value === e.props.textTrigger
) {
console.log('with additional: ', e);
return {
question_id: index,
answer: String(e.additionalValue),
non_standard: true
} as UserAnswerPublic;
} else {
console.log('with normal', e);
return {
question_id: index,
answer: String(e.value),
Expand Down Expand Up @@ -86,7 +98,7 @@
// flags for enabling and disabling visual hints
let showAlert: boolean = false;
$: dataIsCurrent = false;
let dataIsCurrent: boolean = false;
// what is shown in the alert if showAlert === true
let alertMessage: string = $_('userData.alertMessageMissing');
Expand Down Expand Up @@ -188,7 +200,7 @@
{#if dataIsCurrent === true}
<Button
type="button"
class="dark:bg-primay-700 w-full bg-primary-700 text-center text-sm text-white hover:bg-primary-800 hover:text-white dark:hover:bg-primary-800"
class="dark:bg-primay-700 bg-primary-700 hover:bg-primary-800 dark:hover:bg-primary-800 w-full text-center text-sm text-white hover:text-white"
on:click={() => {
console.log('dataiscurrent click');
for (let element of data) {
Expand All @@ -205,7 +217,7 @@
</Button>
{:else}
<Button
class="dark:bg-primay-700 w-full bg-primary-700 text-center text-sm text-white hover:bg-primary-800 hover:text-white dark:hover:bg-primary-800"
class="dark:bg-primay-700 bg-primary-700 hover:bg-primary-800 dark:hover:bg-primary-800 w-full text-center text-sm text-white hover:text-white"
type="submit">{$_('userData.submitButtonLabel')}</Button
>
{/if}
Expand Down

0 comments on commit 39ecb04

Please sign in to comment.