Metadata-Version: 2.5
Name: trytond_etude_eval
Version: 8.0.0.1
Summary: Etude Form Server — Assessment Rules and Response Scoring
Author: Clemens Hupka
Maintainer-email: Clemens Hupka <clemens.hupka@backend.at>
License-Expression: GPL-3.0-or-later
License-File: COPYRIGHT
License-File: LICENSE
Keywords: assessment,form,grading,points,score,survey,tryton
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Environment :: Plugins
Classifier: Framework :: Tryton
Classifier: Topic :: Office/Business
Requires-Python: >=3.10
Requires-Dist: trytond-etude-logic<8.1,>=8.0
Requires-Dist: trytond-etude<8.1,>=8.0
Requires-Dist: trytond<8.1,>=8.0
Provides-Extra: test
Requires-Dist: trytond-etude-collect<8.1,>=8.0; extra == 'test'
Description-Content-Type: text/x-rst

Etude Eval Module
=================

The ``etude_eval`` module grades the forms of the ``etude`` group: a *quiz*
awards points for the answers of a participant, an *assessment* reads the
answers of a form as a result, and a *graded form* tells the participant who
took it what it scored rather than only what it answered.  It adds the
*assessment rule* that awards the points of a form and the *score* of a
response, per group of the form and as a total, with the pass/fail result and
the feedback of the rules the response matched.

It is a companion of the logic of a form - it depends on ``etude_logic`` and
extends the definition of the core module - and it scores the responses of
``etude_collect`` when that module is installed beside it, so a deployment
that grades its forms without storing responses gets the assessment of a form
and no score.

The points of a form are data
-----------------------------

A rule is an ``etude.assessment.rule``: an expression and the points the
response earns when the expression holds.  The expression is written in the
sandboxed language of the logic of the module - it is **parsed, walked and
interpreted** by an allowlist of node types and functions, never compiled and
never handed to the interpreter of the host - so what points a form awards is
data a designer writes and an administrator reads rather than a program of the
deployment.

A rule reads the answers of the response under ``answers``, by the code of a
question (``answers['q1'] == 'yes'``), and the date of the evaluation under
``current_date``.  That is what makes the three granularities of an assessment
one thing to write: a rule about one answer matches that answer, a rule about a
question reads the answers of its subquestions, and a rule about a group reads
several answers of it.  The points may be negative, which is what a penalty is
written as, and the rules of a form are read in their order, which is the order
the feedback of a response is shown in.

The points of a rule are attributed to the group of the question it names,
which is what makes the score of a response readable per group of its form, and
a rule that names no question is about the response as a whole and is counted
in the total alone.

The score of a response
-----------------------

``etude.response.score`` stores the points a group of the form earned and
``etude.response`` gains the total, the pass/fail result, the feedback and the
moment the scoring ran.  The form declares the score a response must reach to
pass; a form that declares none passes every response it grades, and a form
that holds no active rule is not graded at all - its responses hold no total
and no result rather than a total of zero.

A response is scored when it is submitted, inside the transaction that stores
its answers, so a submit which is refused leaves no score behind.  It can be
scored again from the answers it holds, which is what the *Rescore* button of a
response and ``Response.store_score`` do: the evaluation reads the answers and
the rules and writes nothing else, so scoring a stored response twice answers
the same score, and a response is re-scored with the result of the definition
it answers to now after the rules of its form moved.

The assessment a version freezes
--------------------------------

Editing the assessment of a form is an edit of its definition: a published form
opens the draft version the next publish completes, exactly like editing a
question or a rule of the logic.  The pass score of a form and its assessment
rules - their expression, their points, their question and their feedback - are
frozen in the definition payload a version holds, so a response is graded
against the assessment of the version it pinned, and restoring a version writes
the assessment back with the pages of the form.

See ``doc/index.rst`` for the module documentation and ``ETUDE.md`` in
``modules-cch/`` for the architecture of the whole group.
