Skip to content

[BD-27] [TNL-7455] [TNL-7457] Add support for True/False and Fill in the Blank problem types#11

Merged
azarembok merged 1 commit into
openedx:masterfrom
open-craft:patrick/BB-2946-bd-27-add-support-for-truefalse-problem-type
Sep 18, 2020
Merged

[BD-27] [TNL-7455] [TNL-7457] Add support for True/False and Fill in the Blank problem types#11
azarembok merged 1 commit into
openedx:masterfrom
open-craft:patrick/BB-2946-bd-27-add-support-for-truefalse-problem-type

Conversation

@pcockwell

@pcockwell pcockwell commented Sep 9, 2020

Copy link
Copy Markdown
Contributor

Provides conversion support for these question types:

  • cc.true_false.v0p1
  • cc.fib.v0p1

This PR also fixes conversion support for cc.multiple_choice.v0p1 problems, and given that the logic for parsing QTI cc.true_false.v0p1 problems is identical to the logic for parsing cc.multiple_choice.v0p1 problems, the code is reused. Similarly, the logic for generating OLX Multiple Choice and OLX True/False questions are identical, and code is reused there as well.

JIRA tickets:
BLENDED-581
TNL-7455
TNL-7457

Dependencies: Builds directly upon #5

Testing instructions:

Note: Requires Python 3.8.X to work on my machine

Unit Tests:

  1. Create and activate a virtual environment for this project
  2. Install requirements with make requirements
  3. Run tests with make test

Manual Testing:

  1. Create and activate a virtual environment for this project
  2. Install requirements with make requirements
  3. Install the cc2olx CLI with make install
  4. Make note of the install location listed at the end of the install process:
...
creating /home/USERNAME/.pyenv/versions/3.6.10/envs/cc2olx/lib/python3.6/site-packages/cc2olx-0.1.0-py3.6.egg
Extracting cc2olx-0.1.0-py3.6.egg to /home/USERNAME/.pyenv/versions/3.6.10/envs/cc2olx/lib/python3.6/site-packages
cc2olx 0.1.0 is already the active version in easy-install.pth
Installing cc2olx script to /home/USERNAME/.pyenv/versions/cc2olx/bin              # <-------- This line

Installed /home/USERNAME/.pyenv/versions/3.6.10/envs/cc2olx/lib/python3.6/site-packages/cc2olx-0.1.0-py3.6.egg
Processing dependencies for cc2olx==0.1.0
Finished processing dependencies for cc2olx==0.1.0
  1. Find a Common Cartridge course (.imscc file) that contains both True/False questions, and Fill in the Blank questions
  2. Inspect the course on https://common-cartridge-viewer.netlify.app/#/ to locate where the True/False and Fill in the Blank questions are. You will need to navigate to the same location in the Studio after importing your course
  3. Convert the Common Cartridge course with
/home/USERNAME/.pyenv/versions/cc2olx/bin/cc2olx -i /path/to/course.imscc -r zip
  1. This file will be stored in the output directory. Navigate to your Studio, select a course, and import the generated .tar.gz file to overwrite the course.
  2. Navigate to the course outline, and find the sections containing the True/False and Fill in the Blank questions, and inspect the resulting rendering

Reviewers

@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @pcockwell! I've created BLENDED-581 to keep track of it in Jira. More details are on the BD-27 project page.

When this pull request is ready, tag your edX technical lead.

@openedx-webhooks openedx-webhooks added blended PR is managed through 2U's blended developmnt program needs triage labels Sep 9, 2020
@pcockwell pcockwell marked this pull request as draft September 9, 2020 10:19
@pcockwell pcockwell changed the title [BD-27] Add support for True/False and Fill in the Blank problem types [BD-27] [TNL-7455] [TNL-7457] Add support for True/False and Fill in the Blank problem types Sep 9, 2020
@pcockwell pcockwell marked this pull request as ready for review September 10, 2020 06:43
Also fixes logic for Multiple Choice, and reuses multiple choice code for True/False problems to reduce code duplication
@pcockwell pcockwell force-pushed the patrick/BB-2946-bd-27-add-support-for-truefalse-problem-type branch from 230f86b to 92c7863 Compare September 12, 2020 03:27

@0x29a 0x29a left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Looks good to me.

  • I tested that:
  • Tests are passing locally for both python versions.
  • Fill-in-the blank problems are being rendered correctly:
    Screenshot from 2020-09-16 16-05-25
  • True/false problems are being rendered correctly:
    Screenshot from 2020-09-16 16-15-43
  • I read through the code
  • I checked for accessibility issues
  • Includes documentation
  • I made sure any change in configuration variables is reflected in the corresponding client's configuration-secure repository.

Comment thread src/cc2olx/filesystem.py
Comment on lines +52 to +57
# Disregard any file that isn't found
try:
archive.add(file, alternative_name)
except FileNotFoundError:
print("{} was not found. Skipping".format(str(file)))
pass

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread src/cc2olx/qti.py
Comment on lines +276 to +293
@property
def _problem_parsers_map(self):
"""
Returns: mapping between Common Cartridge profile value and function
that parses actual problem node.

Note: Since True/False problems in QTI are constructed identically to
QTI Multiple Choice problems, we reuse `_parse_multiple_choice_problem`
for BOOLEAN type problems
"""
return {
MULTIPLE_CHOICE: self._parse_multiple_choice_problem,
MULTIPLE_RESPONSE: self._parse_multiple_response_problem,
FILL_IN_THE_BLANK: self._parse_fib_problem,
ESSAY: self._parse_essay_problem,
BOOLEAN: self._parse_multiple_choice_problem,
PATTERN_MATCH: self._parse_pattern_match_problem,
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for refactoring this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@azarembok azarembok left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

Comment thread src/cc2olx/qti.py
Comment on lines +276 to +293
@property
def _problem_parsers_map(self):
"""
Returns: mapping between Common Cartridge profile value and function
that parses actual problem node.

Note: Since True/False problems in QTI are constructed identically to
QTI Multiple Choice problems, we reuse `_parse_multiple_choice_problem`
for BOOLEAN type problems
"""
return {
MULTIPLE_CHOICE: self._parse_multiple_choice_problem,
MULTIPLE_RESPONSE: self._parse_multiple_response_problem,
FILL_IN_THE_BLANK: self._parse_fib_problem,
ESSAY: self._parse_essay_problem,
BOOLEAN: self._parse_multiple_choice_problem,
PATTERN_MATCH: self._parse_pattern_match_problem,
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@azarembok azarembok merged commit 5fa6f35 into openedx:master Sep 18, 2020
@0x29a 0x29a deleted the patrick/BB-2946-bd-27-add-support-for-truefalse-problem-type branch September 22, 2020 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blended PR is managed through 2U's blended developmnt program merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants