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

View file

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

View file

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