Fix: _actually_ fix #1706

This commit is contained in:
Pieter Vander Vennet 2023-11-13 02:36:08 +01:00
parent 0129845d22
commit 6577007717
3 changed files with 17 additions and 14 deletions

View file

@ -29,6 +29,7 @@
*/ */
export let notForLabels: string[] | undefined = undefined export let notForLabels: string[] | undefined = undefined
const _notForLabels = new Set(notForLabels) const _notForLabels = new Set(notForLabels)
let showAllQuestionsAtOnce = state.userRelatedState.showAllQuestionsAtOnce
function allowed(labels: string[]) { function allowed(labels: string[]) {
if (onlyForLabels?.length > 0 && !labels.some((l) => _onlyForLabels.has(l))) { if (onlyForLabels?.length > 0 && !labels.some((l) => _onlyForLabels.has(l))) {
@ -67,11 +68,12 @@
}, },
[skippedQuestions] [skippedQuestions]
) )
let firstQuestion = questionsToAsk.map(qta => qta[0])
let answered: number = 0 let answered: number = 0
let skipped: number = 0 let skipped: number = 0
function skip(question: TagRenderingConfig, didAnswer: boolean = false) { function skip(question: {id: string}, didAnswer: boolean = false) {
skippedQuestions.data.add(question.id) skippedQuestions.data.add(question.id)
skippedQuestions.ping() skippedQuestions.ping()
if (didAnswer) { if (didAnswer) {
@ -136,36 +138,34 @@
{/if} {/if}
{:else} {:else}
<div> <div>
<If condition={state.userRelatedState.showAllQuestionsAtOnce}> {#if $showAllQuestionsAtOnce}
<div> <div>
{#each $questionsToAsk as question (question.id)} {#each $questionsToAsk as question (question.id)}
<TagRenderingQuestion config={question} {tags} {selectedElement} {state} {layer} /> <TagRenderingQuestion config={question} {tags} {selectedElement} {state} {layer} />
{/each} {/each}
</div> </div>
{:else}
<div slot="else"> <TagRenderingQuestion
<TagRenderingQuestion config={$firstQuestion}
config={$questionsToAsk[0]}
{layer} {layer}
{selectedElement} {selectedElement}
{state} {state}
{tags} {tags}
on:saved={() => { on:saved={() => {
skip($questionsToAsk[0], true) skip($firstQuestion, true)
}} }}
> >
<button <button
class="secondary" class="secondary"
on:click={() => { on:click={() => {
skip(questionsToAsk[0]) skip($firstQuestion)
}} }}
slot="cancel" slot="cancel"
> >
<Tr t={Translations.t.general.skip} /> <Tr t={Translations.t.general.skip} />
</button> </button>
</TagRenderingQuestion> </TagRenderingQuestion>
</div> {/if}
</If>
</div> </div>
{/if} {/if}
</div> </div>

View file

@ -29,8 +29,9 @@
let specs: RenderingSpecification[] = [] let specs: RenderingSpecification[] = []
$: { $: {
try { try {
txt = t.textFor($language)
if (txt !== undefined) { if (txt !== undefined) {
const key = "cached_special_spec_" + $language let key = "cached_special_spec_" + $language
specs = t[key] specs = t[key]
if (specs === undefined) { if (specs === undefined) {
specs = SpecialVisualizations.constructSpecification(txt) specs = SpecialVisualizations.constructSpecification(txt)
@ -67,6 +68,6 @@
<WeblateLink context={t.context} /> <WeblateLink context={t.context} />
</span> </span>
{:else if $tags !== undefined} {:else if $tags !== undefined}
<ToSvelte construct={createVisualisation(specpart)} /> <ToSvelte construct={() => createVisualisation(specpart)} />
{/if} {/if}
{/each} {/each}

View file

@ -172,6 +172,8 @@
state?.featureSwitches?.featureSwitchIsDebugging ?? new ImmutableStore(false) state?.featureSwitches?.featureSwitchIsDebugging ?? new ImmutableStore(false)
let showTags = state?.userRelatedState?.showTags ?? new ImmutableStore(undefined) let showTags = state?.userRelatedState?.showTags ?? new ImmutableStore(undefined)
let numberOfCs = state?.osmConnection?.userDetails?.data?.csCount ?? 0 let numberOfCs = state?.osmConnection?.userDetails?.data?.csCount ?? 0
let question = config.question
$: question = config.question
if (state?.osmConnection) { if (state?.osmConnection) {
onDestroy( onDestroy(
state.osmConnection?.userDetails?.addCallbackAndRun((ud) => { state.osmConnection?.userDetails?.addCallbackAndRun((ud) => {
@ -181,7 +183,7 @@
} }
</script> </script>
{#if config.question !== undefined} {#if question !== undefined}
<div <div
class="interactive border-interactive relative flex flex-col overflow-y-auto p-1 px-2" class="interactive border-interactive relative flex flex-col overflow-y-auto p-1 px-2"
style="max-height: 85vh" style="max-height: 85vh"
@ -190,7 +192,7 @@
<div class="interactive sticky top-0 flex justify-between"> <div class="interactive sticky top-0 flex justify-between">
<span class="font-bold"> <span class="font-bold">
<SpecialTranslation <SpecialTranslation
t={config.question} t={question}
{tags} {tags}
{state} {state}
{layer} {layer}