Change quest descriptions and orders in order to improve data quality

This commit is contained in:
Pieter Vander Vennet 2020-07-13 12:10:43 +02:00
parent 49cab66a72
commit 6828699a4c
11 changed files with 77 additions and 13 deletions

View file

@ -6,6 +6,7 @@ import {OperatorTag} from "../Questions/OperatorTag";
import {TagRenderingOptions} from "../TagRendering"; import {TagRenderingOptions} from "../TagRendering";
import {NameQuestion} from "../Questions/NameQuestion"; import {NameQuestion} from "../Questions/NameQuestion";
import {NameInline} from "../Questions/NameInline"; import {NameInline} from "../Questions/NameInline";
import {DescriptionQuestion} from "../Questions/DescriptionQuestion";
export class Bos extends LayerDefinition { export class Bos extends LayerDefinition {
@ -34,7 +35,8 @@ export class Bos extends LayerDefinition {
this.elementsToShow = [ this.elementsToShow = [
new NameQuestion(), new NameQuestion(),
new AccessTag(), new AccessTag(),
new OperatorTag() new OperatorTag(),
new DescriptionQuestion("bos")
]; ];
} }
@ -46,7 +48,7 @@ export class Bos extends LayerDefinition {
let questionSeverity = 0; let questionSeverity = 0;
for (const qd of self.elementsToShow) { for (const qd of self.elementsToShow) {
if (qd.IsQuestioning(properties)) { if (qd.IsQuestioning(properties)) {
questionSeverity = Math.max(questionSeverity, qd.options.priority ?? 0); questionSeverity = Math.max(questionSeverity, qd.Priority());
} }
} }

View file

@ -5,6 +5,7 @@ import {AccessTag} from "../Questions/AccessTag";
import {OperatorTag} from "../Questions/OperatorTag"; import {OperatorTag} from "../Questions/OperatorTag";
import {NameQuestion} from "../Questions/NameQuestion"; import {NameQuestion} from "../Questions/NameQuestion";
import {NameInline} from "../Questions/NameInline"; import {NameInline} from "../Questions/NameInline";
import {DescriptionQuestion} from "../Questions/DescriptionQuestion";
export class NatureReserves extends LayerDefinition { export class NatureReserves extends LayerDefinition {
@ -25,6 +26,7 @@ export class NatureReserves extends LayerDefinition {
new NameQuestion(), new NameQuestion(),
new AccessTag(), new AccessTag(),
new OperatorTag(), new OperatorTag(),
new DescriptionQuestion("natuurgebied")
]; ];
} }

View file

@ -6,6 +6,7 @@ import {OperatorTag} from "../Questions/OperatorTag";
import {TagRenderingOptions} from "../TagRendering"; import {TagRenderingOptions} from "../TagRendering";
import {NameQuestion} from "../Questions/NameQuestion"; import {NameQuestion} from "../Questions/NameQuestion";
import {NameInline} from "../Questions/NameInline"; import {NameInline} from "../Questions/NameInline";
import {DescriptionQuestion} from "../Questions/DescriptionQuestion";
export class Park extends LayerDefinition { export class Park extends LayerDefinition {
@ -50,7 +51,8 @@ export class Park extends LayerDefinition {
this.title = new NameInline("park"); this.title = new NameInline("park");
this.elementsToShow = [new NameQuestion(), this.elementsToShow = [new NameQuestion(),
this.accessByDefault, this.accessByDefault,
this.operatorByDefault this.operatorByDefault,
new DescriptionQuestion("park"),
]; ];
@ -65,7 +67,7 @@ export class Park extends LayerDefinition {
let questionSeverity = 0; let questionSeverity = 0;
for (const qd of self.elementsToShow) { for (const qd of self.elementsToShow) {
if (qd.IsQuestioning(properties)) { if (qd.IsQuestioning(properties)) {
questionSeverity = Math.max(questionSeverity, qd.options.priority ?? 0); questionSeverity = Math.max(questionSeverity, qd.Priority() ?? 0);
} }
} }

View file

@ -35,6 +35,7 @@ export class Groen extends Layout {
"<ul>" + "<ul>" +
"<li>Over groen ingekleurde gebieden weten we alles wat we willen weten.</li>" + "<li>Over groen ingekleurde gebieden weten we alles wat we willen weten.</li>" +
"<li>Bij rood ingekleurde gebieden ontbreekt nog heel wat info: klik een gebied aan en beantwoord de vragen.</li>" + "<li>Bij rood ingekleurde gebieden ontbreekt nog heel wat info: klik een gebied aan en beantwoord de vragen.</li>" +
"<li>Je kan altijd een vraag overslaan als je het antwoord niet weet of niet zeker bent</li>" +
"<li>Je kan altijd een foto toevoegen</li>" + "<li>Je kan altijd een foto toevoegen</li>" +
"<li>Je kan ook zelf een gebied toevoegen door op de kaart te klikken</li>" + "<li>Je kan ook zelf een gebied toevoegen door op de kaart te klikken</li>" +
"</ul>" + "</ul>" +

View file

@ -22,7 +22,28 @@ export class OnlyShowIfConstructor implements TagDependantUIElementConstructor{
this._embedded.construct(tags, changes), this._embedded.construct(tags, changes),
this._tagsFilter); this._tagsFilter);
} }
IsKnown(properties: any): boolean {
if(!this.Matches(properties)){
return true;
}
return this._embedded.IsKnown(properties);
}
IsQuestioning(properties: any): boolean {
if(!this.Matches(properties)){
return false;
}
return this._embedded.IsQuestioning(properties);
}
Priority(): number {
return this._embedded.Priority();
}
private Matches(properties: any) : boolean{
return this._tagsFilter.matches(TagUtils.proprtiesToKV(properties));
}
} }

View file

@ -10,10 +10,9 @@ export class AccessTag extends TagRenderingOptions {
question: "Is dit gebied toegankelijk?", question: "Is dit gebied toegankelijk?",
primer: "Dit gebied is ", primer: "Dit gebied is ",
freeform: { freeform: {
key: "access", key: "access:description",
extraTags: new Tag("fixme", "Freeform access tag used: possibly a wrong value"),
template: "Iets anders: $$$", template: "Iets anders: $$$",
renderTemplate: "De toegangekelijkheid van dit gebied is: {access}", renderTemplate: "De toegankelijkheid van dit gebied is: {access:description}",
placeholder: "Specifieer" placeholder: "Specifieer"
}, },
mappings: [ mappings: [

View file

@ -0,0 +1,19 @@
import {TagRenderingOptions} from "../TagRendering";
export class DescriptionQuestion extends TagRenderingOptions{
constructor(category: string) {
super({
question: "Zijn er bijzonderheden die we moeten weten over dit "+category+"?<br>" +
"<span class='question-subtext'>Je hoeft niet te herhalen wat je net hebt aangeduid.<br/>" +
"Voel je vrij om dit veld over te slaan.</span>",
freeform:{
key:"description:0",
renderTemplate: "{description:0}",
template: "$$$"
}
});
}
}

View file

@ -9,8 +9,11 @@ import {Tag} from "../../Logic/TagsFilter";
export class NameQuestion extends TagRenderingOptions{ export class NameQuestion extends TagRenderingOptions{
static options = { static options = {
priority: 20, priority: -1, // Move this last on the priority list, in order to prevent ppl to enter access restrictions and descriptions
question: "Wat is de <i>officiële</i> naam van dit gebied?", question: "Wat is de <i>officiële</i> naam van dit gebied?<br><span class='question-subtext'>" +
"Zelf een naam bedenken wordt afgeraden.<br/>" +
"Een beschrijving van het gebied geven kan in een volgende stap.<br/>" +
"</span>",
freeform: { freeform: {
key: "name", key: "name",
template: "De naam is $$$", template: "De naam is $$$",

View file

@ -77,7 +77,7 @@ export class TagRenderingOptions implements TagDependantUIElementConstructor {
IsQuestioning(tags: any): boolean { IsQuestioning(tags: any): boolean {
const tagsKV = TagUtils.proprtiesToKV(tags); const tagsKV = TagUtils.proprtiesToKV(tags);
for (const oneOnOneElement of this.options.mappings) { for (const oneOnOneElement of this.options.mappings ?? []) {
if (oneOnOneElement.k === null || oneOnOneElement.k.matches(tagsKV)) { if (oneOnOneElement.k === null || oneOnOneElement.k.matches(tagsKV)) {
return false; return false;
} }
@ -97,6 +97,14 @@ export class TagRenderingOptions implements TagDependantUIElementConstructor {
return new TagRendering(tags, changes, this.options); return new TagRendering(tags, changes, this.options);
} }
IsKnown(properties: any): boolean {
return !this.IsQuestioning(properties);
}
Priority(): number {
return this.options.priority ?? 0;
}
} }
class TagRendering extends UIElement implements TagDependantUIElement { class TagRendering extends UIElement implements TagDependantUIElement {
@ -285,7 +293,7 @@ class TagRendering extends UIElement implements TagDependantUIElement {
if (isEditing) { if (isEditing) {
return "<span class='skip-button'>Annuleren</span>"; return "<span class='skip-button'>Annuleren</span>";
} else { } else {
return "<span class='skip-button'>Ik weet het niet zeker...</span>"; return "<span class='skip-button'>Overslaan (Ik weet het niet zeker...)</span>";
} }
}); });
// And at last, set up the skip button // And at last, set up the skip button

View file

@ -6,7 +6,9 @@ import {UIElement} from "../UI/UIElement";
export interface TagDependantUIElementConstructor { export interface TagDependantUIElementConstructor {
construct(tags: UIEventSource<any>, changes: Changes): TagDependantUIElement; construct(tags: UIEventSource<any>, changes: Changes): TagDependantUIElement;
IsKnown(properties: any): boolean;
IsQuestioning(properties: any): boolean;
Priority(): number;
} }
export abstract class TagDependantUIElement extends UIElement { export abstract class TagDependantUIElement extends UIElement {

View file

@ -679,6 +679,11 @@ form {
font-weight: bold; font-weight: bold;
} }
.question-subtext{
font-size: medium;
font-weight: normal;
}
.answer { .answer {
display: inline-block; display: inline-block;
margin: 0.1em; margin: 0.1em;