Moodle SQL Evaluator for SQLite
368
This project is intended to help teachers grade SQL exercises for exams run on Moodle, when a fully automated approach is not the most appropriate and the professors want to grade manually but with some assistance for automatically running the queries written by students.
Using these scripts you will be able to download the Excel spreadsheet with all your students' answers, provide your own suggestions for the correct SQL query for each exercise in separate .sql files, and see if the queries written by the students return the same tuples as you expect.
These scripts will produce a text file per answer that looks more or less like this:
In the courses that I teach, we evaluate our students using two distinct database scripts.
While they both share the same database schema, one is provided to the students during the exam and contains fewer records than a second script with additional entries designed to test additional edge cases. We shall call them script-students.sql and script-correction.sql in this guide.
Open Terminal
Clone the repository or download the ZIP:
git clone https://github.com/silvae86/moodle-autocorrect-sqliteOpen a command line and go to the directory where the unzipped files are, for example:
cd moodle-autocorrect-sqlite
Prepare the environment as shown below.
Run the commands that produce the corrections:
In Linux / Mac
docker pull joaorosilva/moodle-autocorrect-sqlite:latest
docker run -v "$(pwd)/correction":/data/correction -v "$(pwd)/Results":/data/Results -w /data joaorosilva/moodle-autocorrect-sqlite:latest
cmd.exe -> Enter)docker pull joaorosilva/moodle-autocorrect-sqlite:latest
docker run -v "%cd%\correction":/data/correction -v "%cd%\Results":/data/Results -w /data joaorosilva/moodle-autocorrect-sqlite:latest
docker pull joaorosilva/moodle-autocorrect-sqlite:latest
docker run -v "${PWD}/correction":/data/correction -v /data "${PWD}/Results":/data/Results -w joaorosilva/moodle-autocorrect-sqlite:latest
See the results in the Results/ folder.
Download the answers of your students from moodle
1.1. Access the Exam in Moodle
1.2. Select the 'Responses' option to access the list of answers given by the students
1.2. Sort the answers by the first name of the students (or any other criteria, as the SQL evaluator will produce a list of answers ordered by that same criteria). This is important, because you want an ordering that is consistent in Moodle. I always use the first name.
1.3. Select Microsoft Excel as the download format for the answers.
1.4. Click 'Download'. An Excel file will be produced by moodle and start downloading.
Change the name of the downloaded file to student_answers.xlsx and place it in the correction folder.
Place the scripts that create the database schema and insert the necessary records in the correction folder: script-students.sql for the script given to the students and script-correction.sql to your correction script.
Now we need to place your proposed solutions for the SQL questions in the correction/proposed_answers folder.
4.1. For every question that you want to automatically correct, place a .sql file with the same name as the header of the column in the Excel file downloaded from Moodle.
Response 15 column in the Excel file contains SQL answers, you need to create a correction/proposed_answers/Response 15.sql file with your proposed solution (in SQL) for that question.4.2. The script will detect these .sql files and try to correct only those answers where there is a proposed answer.
Access the exam in Moodle and go to the little gear at the top right and select "Manual Grading". After choosing the question you want to grade, change the settings like this:
Then, open the text file by the side of the manual grading window. Scroll in parallel and start grading!
I have taught some courses involving databases and SQL (Databases in the Integrated Masters in Informatics Engineering) and Information Systems and Databases (Integrated Masters in Electrical Engineering) and Information Systems Engineering (Integrated Masters in Bioengineering + Masters in Biomedical Engineering).
These scripts saved me a ton of copy-paste. Hope they can save some for you too!
This command mounts the current folder in a Docker container, more specifically at its /data location; this way, it has bidirectional access to all files placed in the current directory (sql scripts...). Then it runs the script, placing outputs in the correction/ folder.
To build and test the image locally, this is the command:
docker build -t moodle-autocorrect-sqlite:latest . && docker run -v "$(pwd)/correction":/data/correction -v "$(pwd)/Results":/data/Results -w /data moodle-autocorrect-sqlite:latest
Content type
Image
Digest
Size
153.7 MB
Last updated
over 6 years ago
docker pull joaorosilva/moodle-autocorrect-sqlite