This file holds a couple of editors notes regarding the mod.

https://gitea.your-land.de/your-land/bugtracker/issues/7371

Approximate plan:

Playerfacing, we need a way to take part in a specific survey.

yl_survey.answer(playername, surveyid)

This should create a book of the answers of the survey and place it in the player's inv. Or take a book from the player and write the results in.

yl_survey.create_book(playername, surveyid)

Creating the survey is a bit more complex:

create_survey(owner, allow_names, allow_anonymous, allow_changes, timestamp_start, timestamp_end) return s_id
edit_survey(s_id, owner, allow_names, allow_anonymous, allow_changes, timestamp_start, timestamp_end, delete_responses)
remove_survey(s_id)
list_surveys()
evaluate(s_id)

create_question(s_id, question, category, sort, {allowed_types}, {answers}) return q_id
edit_question(s_id, q_id, question, sort, category, {allowed_types}, {answers}, delete_responses)
remove_question(q_id)
list_questions()

validate_questions(s_id)

###

This is the planned data structure:

{
    "metadata": {
        "id": 0,
        "owner": "Alias",
        "allow_names": true,
        "allow_anonymous": true,
        "allow_changes": true,
        "creation_date": 3475345,
        "modification_date": 3475346,
        "start_date": 3475347
        "end_date": 3475348
    },
    "1": {
        "id": 1,
        "category": "Getting Started",
        "sort": 99,
        "question": "How did you find out about Minetest in general?",
        "enabled" : true,
        "allowed_types": [
            "singlechoice",
            "multiplechoice",
            "freetext"
        ],
        "answers": {
            "1": "Friend dragged me over",
            "2": "I came here of my own free will"
        },
        "responses": {
            "AliasAlreadyTaken": {
                "1": true
            },
            "Boris": {
                "1": true
            },
            "Violetta": {
                "1": true
            }
        }
    },
    "2": {
        "id": 2,
        "category": "Getting Started",
        "sort": 2,
        "question": "What do you think about the current state of the server?",
        "enabled" : true,
        "allowed_types": [
            "singlechoice",
            "multiplechoice",
            "freetext"
        ],
        "answers": {
            "0": "Write your answer here",
            "1": "Terrible",
            "2": "Not soo bad"
        },
        "responses": {
            "AliasAlreadyTaken": {
                "0": "Neither nor"
            },
            "Boris": {
                "0": "I get to test stuff!",
                "1": true
            },
            "Violetta": {
                "0": "I write here and check all boxes",
                "1": true,
                "2": true
            }
        }
    }
}