Skip to content

SonicZedt/VStudent

Repository files navigation

VStudent

A BOT to answer multiple choice quiz in moodle platform such as vclass.

What VStudent needs

  • Internet connection to access vclass platform
  • An answer document (.docx, .txt, or .pdf) in certain format to answer the quiz. Read Answer document format for more information.
  • An URL to the quiz in vclass platform

Answer document format

The answer document should be in .docx, .txt, or .pdf.

.DOCX

There are two types of .docx document that are currently readable by the BOT, type 1 and type 2.

  • Type 1 will scan for unique paragraph style uses by answer choices to determine the answer from the other answer choices.
  • Type 2 will scan for string "The correct answer is:" occurrences to determine the answer.

Download format: answer_type1.docx or answer_type2.docx

.TXT

A .txt document is currently the best and safest readable format for the BOT. The format should be a question, followed by the answer on the next line, and followed by blank line on the next line.

Download format: answer.txt

.PDF

An exported pdf document from review page is preferable.

Work principle of .PDF

  1. The BOT will extract all text and images from the pdf document along with their coordinates.
  2. Extracted images are images of button (radio button) used to select the answer.
  3. If an image has more white pixels than specified threshold, it will be considered as an answer.
  4. A paragraph from extracted text will be deleted if it contains "Question" and "Mark" because of these strings are not needed and could mess up with paragraph order.
  5. The BOT will scan for string "The correct answer is:" occurrences to determine the answer if available. If not, continue to next step.
  6. The BOT will scan for string "Select one:" occurrences to determine the question and answer choices. The question paragraph would be right before this string [i-1] or right with it [i] and the four of answer choices would be on the next two to five paragraphs [i+2:i+6].
  7. The set of answer choices will be paired with the button images. The answer is determined by how many white pixel is in the button image.

Possible issue with .PDF

Any differences in visual arrangement in a PDF document could cause the BOT to fail to do extraction process.


Setup

  • Download latest version of VStudent here
  • Extract
  • Open and edit config.ini file using any text editor, enter your vclass username and password under login section.

Configuration

Configration is done in config.ini file.

Section Key Type Description
login username str your vclass username
login password str your vclass password
vclass login_confirmation bool ask for confirmation before login to vclass platform
vclass submit_quiz_confirmation bool ask for confirmation before submitting in last question page
vclass submit_summary_confirmation bool ask for confirmation before submitting in summary page
vclass answer_delay int delay in seconds before moving to the next question

Usage

  1. Launch BOT executable file (vsg.exe)
  2. A file explorer will appear, select the answer document.
  3. Paste quiz URL. the URL should be looks like https://v-class.gunadarma.ac.id/mod/quiz/view.php?id=XXXXXX where XXXXXX is the quiz ID.
  4. A Firefox webdriver will be opened, and the BOT will attempt to login to vclass using given username and password in config.ini.
  5. BOT will ask login confirmation if login_confirmation is set to True in config.ini file, otherwise it will automatically login.
  6. BOT will go to the quiz page using the given URL and attempt or continue the quiz.
  7. After reaching last question, BOT will ask for confirmation before submitting in last question page if all question is successfully answered and submit_quiz_confirmation is set to True in config.ini file, otherwise it will automatically submit.
  8. After submitting, BOT will ask for confirmation before submitting in summary page submit_summary_confirmation is set to True in config.ini file, otherwise it will automatically submit.

Known Issues:

  1. Suppose there are two answers with similar words, e. g. a. IGPB and b. GPB, both contains GPB in their answer while answer in the answer document is GPB, any first option that contains GPB will be selected, thus the a. IGPB will be selected and answer is wrong. source.
  2. Failed to extract question and answer from type 2 document (.docx) because the paragraph is inside of textbox. source.
  3. Failed to extract question and answer from type 1 document (.txt) with UTF-8 encoding. Temporary workaround is to change the encoding to ANSI which can be done by opening the file in Notepad and save as new document with ANSI is selected as Encoding option.
  4. Failed to launch BOT executable file (vsg.exe) if mozila firefox has not been installed. This could be fixed by launching the driver executable inside driver/ folder.
  5. Any differences in visual arrangement in a PDF document could cause the BOT to fail to do extraction process.