Fix: attributes to answered questions didn't automatically show, questions which became available are now shown if they become avaible because of a tag change. Fix #1587

This commit is contained in:
Pieter Vander Vennet 2023-11-13 01:20:38 +01:00
parent 370b200bb3
commit 7de0af15f1
3 changed files with 22 additions and 27 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "mapcomplete", "name": "mapcomplete",
"version": "0.34.4", "version": "0.34.6",
"repository": "https://github.com/pietervdvn/MapComplete", "repository": "https://github.com/pietervdvn/MapComplete",
"description": "A small website to edit OSM easily", "description": "A small website to edit OSM easily",
"bugs": "https://github.com/pietervdvn/MapComplete/issues", "bugs": "https://github.com/pietervdvn/MapComplete/issues",

View file

@ -25,6 +25,11 @@
let knownTagRenderings = layer.tagRenderings let knownTagRenderings = layer.tagRenderings
.filter(config => (config.condition?.matchesProperties($tags) ?? true) && (config.metacondition?.matchesProperties({ ...$tags, ..._metatags } ?? true) .filter(config => (config.condition?.matchesProperties($tags) ?? true) && (config.metacondition?.matchesProperties({ ...$tags, ..._metatags } ?? true)
&& config.IsKnown($tags))) && config.IsKnown($tags)))
$: {
knownTagRenderings = layer.tagRenderings
.filter(config => (config.condition?.matchesProperties($tags) ?? true) && (config.metacondition?.matchesProperties({ ...$tags, ..._metatags } ?? true)
&& config.IsKnown($tags)))
}
</script> </script>
{#if $tags._deleted === "yes"} {#if $tags._deleted === "yes"}

View file

@ -3,17 +3,16 @@
* Shows all questions for which the answers are unknown. * Shows all questions for which the answers are unknown.
* The questions can either be shown all at once or one at a time (in which case they can be skipped) * The questions can either be shown all at once or one at a time (in which case they can be skipped)
*/ */
import TagRenderingConfig from "../../../Models/ThemeConfig/TagRenderingConfig" import TagRenderingConfig from "../../../Models/ThemeConfig/TagRenderingConfig";
import { UIEventSource } from "../../../Logic/UIEventSource" import { UIEventSource } from "../../../Logic/UIEventSource";
import type { Feature } from "geojson" import type { Feature } from "geojson";
import type { SpecialVisualizationState } from "../../SpecialVisualization" import type { SpecialVisualizationState } from "../../SpecialVisualization";
import LayerConfig from "../../../Models/ThemeConfig/LayerConfig" import LayerConfig from "../../../Models/ThemeConfig/LayerConfig";
import If from "../../Base/If.svelte" import If from "../../Base/If.svelte";
import { onDestroy } from "svelte" import TagRenderingQuestion from "./TagRenderingQuestion.svelte";
import TagRenderingQuestion from "./TagRenderingQuestion.svelte" import Tr from "../../Base/Tr.svelte";
import Tr from "../../Base/Tr.svelte" import Translations from "../../i18n/Translations.js";
import Translations from "../../i18n/Translations.js" import { Utils } from "../../../Utils";
import { Utils } from "../../../Utils"
export let layer: LayerConfig export let layer: LayerConfig
export let tags: UIEventSource<Record<string, string>> export let tags: UIEventSource<Record<string, string>>
@ -69,15 +68,6 @@
[skippedQuestions] [skippedQuestions]
) )
let _questionsToAsk: TagRenderingConfig[]
let _firstQuestion: TagRenderingConfig
onDestroy(
questionsToAsk.subscribe((qta) => {
_questionsToAsk = qta
_firstQuestion = qta[0]
})
)
let answered: number = 0 let answered: number = 0
let skipped: number = 0 let skipped: number = 0
@ -98,9 +88,9 @@
<div <div
bind:this={questionboxElem} bind:this={questionboxElem}
class="marker-questionbox-root" class="marker-questionbox-root"
class:hidden={_questionsToAsk.length === 0 && skipped === 0 && answered === 0} class:hidden={$questionsToAsk.length === 0 && skipped === 0 && answered === 0}
> >
{#if _questionsToAsk.length === 0} {#if $questionsToAsk.length === 0}
{#if skipped + answered > 0} {#if skipped + answered > 0}
<div class="thanks"> <div class="thanks">
<Tr t={Translations.t.general.questionBox.done} /> <Tr t={Translations.t.general.questionBox.done} />
@ -148,26 +138,26 @@
<div> <div>
<If condition={state.userRelatedState.showAllQuestionsAtOnce}> <If condition={state.userRelatedState.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>
<div slot="else"> <div slot="else">
<TagRenderingQuestion <TagRenderingQuestion
config={_firstQuestion} config={$questionsToAsk[0]}
{layer} {layer}
{selectedElement} {selectedElement}
{state} {state}
{tags} {tags}
on:saved={() => { on:saved={() => {
skip(_firstQuestion, true) skip($questionsToAsk[0], true)
}} }}
> >
<button <button
class="secondary" class="secondary"
on:click={() => { on:click={() => {
skip(_firstQuestion) skip(questionsToAsk[0])
}} }}
slot="cancel" slot="cancel"
> >