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 {NameQuestion} from "../Questions/NameQuestion";
import {NameInline} from "../Questions/NameInline";
import {DescriptionQuestion} from "../Questions/DescriptionQuestion";
export class Bos extends LayerDefinition {
@ -34,7 +35,8 @@ export class Bos extends LayerDefinition {
this.elementsToShow = [
new NameQuestion(),
new AccessTag(),
new OperatorTag()
new OperatorTag(),
new DescriptionQuestion("bos")
];
}
@ -46,7 +48,7 @@ export class Bos extends LayerDefinition {
let questionSeverity = 0;
for (const qd of self.elementsToShow) {
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 {NameQuestion} from "../Questions/NameQuestion";
import {NameInline} from "../Questions/NameInline";
import {DescriptionQuestion} from "../Questions/DescriptionQuestion";
export class NatureReserves extends LayerDefinition {
@ -25,6 +26,7 @@ export class NatureReserves extends LayerDefinition {
new NameQuestion(),
new AccessTag(),
new OperatorTag(),
new DescriptionQuestion("natuurgebied")
];
}

View file

@ -6,6 +6,7 @@ import {OperatorTag} from "../Questions/OperatorTag";
import {TagRenderingOptions} from "../TagRendering";
import {NameQuestion} from "../Questions/NameQuestion";
import {NameInline} from "../Questions/NameInline";
import {DescriptionQuestion} from "../Questions/DescriptionQuestion";
export class Park extends LayerDefinition {
@ -50,7 +51,8 @@ export class Park extends LayerDefinition {
this.title = new NameInline("park");
this.elementsToShow = [new NameQuestion(),
this.accessByDefault,
this.operatorByDefault
this.operatorByDefault,
new DescriptionQuestion("park"),
];
@ -65,7 +67,7 @@ export class Park extends LayerDefinition {
let questionSeverity = 0;
for (const qd of self.elementsToShow) {
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>" +
"<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>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 ook zelf een gebied toevoegen door op de kaart te klikken</li>" +
"</ul>" +

View file

@ -23,6 +23,27 @@ export class OnlyShowIfConstructor implements TagDependantUIElementConstructor{
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?",
primer: "Dit gebied is ",
freeform: {
key: "access",
extraTags: new Tag("fixme", "Freeform access tag used: possibly a wrong value"),
key: "access:description",
template: "Iets anders: $$$",
renderTemplate: "De toegangekelijkheid van dit gebied is: {access}",
renderTemplate: "De toegankelijkheid van dit gebied is: {access:description}",
placeholder: "Specifieer"
},
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{
static options = {
priority: 20,
question: "Wat is de <i>officiële</i> naam van dit gebied?",
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?<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: {
key: "name",
template: "De naam is $$$",

View file

@ -77,7 +77,7 @@ export class TagRenderingOptions implements TagDependantUIElementConstructor {
IsQuestioning(tags: any): boolean {
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)) {
return false;
}
@ -97,6 +97,14 @@ export class TagRenderingOptions implements TagDependantUIElementConstructor {
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 {
@ -285,7 +293,7 @@ class TagRendering extends UIElement implements TagDependantUIElement {
if (isEditing) {
return "<span class='skip-button'>Annuleren</span>";
} 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

View file

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

View file

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