excel2moodle.extra package — excel2moodle 0.3.0 documentation

# excel2moodle.extra package

This extra subpackage conains standalone scripts

The modules inside extra can be run standalone, but are planned to be available from the main Window as well

To run a script execute the following: `python -m excel2moodle.extra.SCRIPT` Note that there is no `.py` at the end!!

## Submodules

## excel2moodle.extra.equationVerification module

Script for verifying the equations written into the `result` field of NFM-type Question

This script does two things.

1. It calculates all the answers obtained from the series of variables.

2. It compares the calculation of the first answer to the `firstResult` field.

### Usage

#### From the main UI

1. Start this tool from the top bar in the main Window under the Tools section

2. A new window will open inside you:

3. Enter the Number of the Category

4. Enter the Number of the Question

5. Click on `Run check now` and Inspect the results

6. Rinse and repeat

#### As Script

1. Start this script with `py -m excel2moodle.extra.equationVerification` inside the top-level Directory

2. Enter the Number of the Category

3. Enter the Number of the Question

4. Inspect the results

5. Rinse and repeat

excel2moodle.extra.equationVerification.checkResult(checkerValue, calculation, tolerance=0.01)

  Checks if the two Arguments are within the tolerance the same value

  Parameters:

    - checkerValue (fleat) -- the value the calculation is compared against

    - calculation (float) -- the value to be compared against checker Value

    - tolerance (float, optional) -- the standart tolerance is 0.01 -> 1%

  Returns:

    True if checkerValue == calculation False if checkerValue != calculation

  Return type:

    bool

excel2moodle.extra.equationVerification.equationChecker(categoryName, qNumber, spreadsheetFile)

  This Function calculates all Results an invokes the checkResult function

  Parameters:

    - categoryName (str) -- The category in which the question to be tested is This must match a sheet name of the spreadsheet

    - qNumber (int) -- The number of the question which results are tested

    - spreadsheetFile (Path) -- The Filepath to the spreadsheet

  Return type:

    `tuple`[`list`[`str`], `list`[`float`], `float`]

  Returns:

    - bulletPointsString (list[str]) -- The string list with the bullet points, with numeric values instead of variables

    - results (list[str]) -- The list with the calculated results

    - checkerValue (float) -- The value taken from the `firstResult` field

excel2moodle.extra.equationVerification.main(spreadsheetFile=PosixPath('../Fragensammlung/Main_question_all.xlsx'), catN=None, qNumber=None)

  Takes the Spreadsheet, and asks for a category and a question number

  Return type:

    `None`