Skip to content
An XBlock for posing questions to students
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.tx Add transifex config and update Makefile with translation targets. Jun 14, 2019
conf fixed missing translation, undersocre js translations (#220) Dec 29, 2018
doc Add description field to student_view_data for long answer recap block Apr 22, 2018
problem_builder BB-1396 Add 3rd plural form to fix not translated messages. (#239) Jun 21, 2019
screenshots/baseline Fix cross-domain images and images with relative urls or without expl… Mar 17, 2016
xblock-sdk @ 4b90010 add xblock-sdk as a submodule Mar 20, 2019
.coveragerc Parallelize quality, unit and integration tests and create coverage May 6, 2019
.gitignore Move translations to correct place Jun 12, 2019
.gitmodules add xblock-sdk as a submodule Mar 20, 2019
AUTHORS Add Tim Krones to AUTHORS. Sep 18, 2015
LICENSE Add license (AGPLv3) and copyright headers Jan 10, 2014
LICENSE.MIT
Makefile Add transifex config and update Makefile with translation targets. Jun 14, 2019
README.md Add transifex config and update Makefile with translation targets. Jun 14, 2019
circle.yml Parallelize quality, unit and integration tests and create coverage May 6, 2019
manage.py fixed missing translation, undersocre js translations (#220) Dec 29, 2018
pylintrc Parallelize quality, unit and integration tests and create coverage May 6, 2019
requirements-dev.txt Add transifex config and update Makefile with translation targets. Jun 14, 2019
requirements.txt fixed missing translation, undersocre js translations (#220) Dec 29, 2018
run_tests.py Add student_view_data to the Step block and children. Jul 28, 2017
setup.py BB-1396 Add 3rd plural form to fix not translated messages. (#239) Jun 21, 2019
test_requirements.in move direct dependencies to test_requirements.in Mar 20, 2019
test_requirements.txt Parallelize quality, unit and integration tests and create coverage May 6, 2019
tox.ini Parallelize quality, unit and integration tests and create coverage May 6, 2019

README.md

Problem Builder and Step Builder

Circle CI

This repository provides two XBlocks: Problem Builder and Step Builder.

Both blocks allow to create questions of various types. They can be used to simulate the workflow of real-life mentoring, within an edX course.

Supported features include:

  • Free-form answers (textarea) which can be shared accross different XBlock instances (for example, to allow a student to review and edit an answer they gave before).
  • Self-assessment MCQs (multiple choice questions), to display predetermined feedback to a student based on his choices in the self-assessment. Supports rating scales and arbitrary answers.
  • MRQs (Multiple Response Questions), a type of multiple choice question that allows the student to select more than one choice.
  • Answer recaps that display a read-only summary of a user's answer to a free-form question asked earlier in the course.
  • Progression tracking, to require that the student has completed a particular step before allowing them to complete the next step. Provides a link to the next step to the student.
  • Tables, which allow to present answers from the student to free-form answers in a concise way. Supports custom headers.
  • Dashboards, for displaying a summary of the student's answers to multiple choice questions. Details

The following screenshot shows an example of a Problem Builder block containing a free-form question, two MCQs and one MRQ:

Problem Builder Example

Installation

You can install Problem Builder from PyPI using this command:

pip install xblock-problem-builder

For full details, see "Open edX Installation", below.

Usage

See Usage Instructions

Workbench installation and settings

For developers, you can install this XBlock into an XBlock SDK workbench's virtualenv.

Firstly, create a virtualenv:

~/xblock_development $ virtualenv venv
~/xblock_development $ . venv/bin/activate

Now run the following commands from the problem builder repo root to install the problem builder dependencies:

(venv) ~/xblock_development/problem-builder $ pip install -r requirements.txt
(venv) ~/xblock_development/problem-builder $ pip install -r requirements-dev.txt

Switch to the created XBlock SDK repository, install its dependencies, and create its migrations:

(venv) ~/xblock_development/problem-builder $ cd ../venv/src/xblock-sdk
(venv) ~/xblock_development/venv/src/xblock-sdk $ make pip
(venv) ~/xblock_development/venv/src/xblock-sdk $ python manage.py makemigrations workbench

Create the following configuration file in workbench/settings_pb.py:

from settings import *

INSTALLED_APPS += ('problem_builder',)
DATABASES['default']['NAME'] = 'var/workbench.db'

Because this XBlock uses a Django model, you need to sync the database before starting the workbench. Run this from the XBlock repository root:

$ ./manage.py migrate --settings=workbench.settings_pb

Running the workbench

$ ./manage.py runserver 8000 --settings=workbench.settings_pb

Access it at http://localhost:8000/.

Running tests

Install Xvfb. For instance:

$ apt-get install xvfb

Install firefox 38.0.5 in /opt/firefox-38.0.5. For instance:

$ mkdir /opt/firefox-38.0.5
$ cd /opt/firefox-38.0.5
$ wget https://ftp.mozilla.org/pub/firefox/releases/38.0.5/linux-x86_64/en-US/firefox-38.0.5.tar.bz2
$ tar -xvf firefox-38.0.5.tar.bz2

From the xblock-problem-builder repository root, run the tests with the following command:

$ PATH=/opt/firefox-38.0.5/firefox tox

To run only the quality tests run:

$ PATH=/opt/firefox-38.0.5/firefox tox -e quality

To run only the integration tests run:

$ PATH=/opt/firefox-38.0.5/firefox tox -e integration

Translation (i18n)

This repo offers multiple make targets to automate the translation tasks. First, install requirements-dev.txt:

pip install -r requirements-dev.txt

Each make target will be explained below:

  • extract_translations. Use i18n_tool extract to create .po files based on all the tagged strings in the python and javascript code.
  • compile_translations. Use i18n_tool generate to create .mo compiled files.
  • detect_changed_source_translations. Use i18n_tool changed to identify any updated translations.
  • validate_translations. Compile translations and check the source translations haven't changed.

If you want to add a new language:

  1. Add language to problem_builder/translations/config.yaml
  2. Make sure all tagged strings have been extracted:
make extract_translations
  1. Clone en directory to problem_builder/translations/<lang_code>/ for example: problem_builder/translations/fa_IR/
  2. Make necessary changes to translation files headers. Make sure you have proper Language and Plural-Forms lines.
  3. When you finished your modification process, re-compile the translation messages.
make compile_translations

Transifex

This repo offers different make targets to automate interaction with transifex. To use these make targets first install requirements-dev.txt.

pip install -r requirements-dev.txt

These are the different make targets used to interact with transifex:

  • pull_translations. Pull translations from Transifex.
  • push_translations. Push translations to Transifex.

The transifex configuration is stored in .tx. For more information read transifex's documentation

Adding custom scenarios to the workbench

Within the xblock-problem-builder repository, create the templates/xml and add XML scenarios to it - all files with the *.xml extension will be automatically loaded by the workbench:

$ mkdir templates/xml
$ cat > templates/xml/my_pb_scenario.xml

Restart the workbench to take the new scenarios into account.

Upgrading from Version 1

To upgrade a course from xblock-mentoring ("v1") to xblock-problem-builder ("v2"), run the following command on a system with edx-platform, xblock-mentoring, and xblock-problem-builder installed:

$ SERVICE_VARIANT=cms DJANGO_SETTINGS_MODULE="cms.envs.devstack" python -m problem_builder.v1.upgrade "Org/Course/Run"

Where "Org/Course/Run" is replaced with the ID of the course to upgrade.

Open edX Installation

Problem Builder releases are tagged with a version number, e.g. v2.6.0, v2.6.5. We recommend installing the most recently tagged version, with the exception of the following compatibility issues:

  • edx-platform version open-release/eucalyptus.2 and earlier must use ≤v2.6.0. See PR 128 for details.
  • edx-platform version named-release/dogwood.3 and earlier must use v2.0.0.

The edx-platform master branch will generally always be compatible with the most recent Problem Builder tag. See the EDXAPP_PRIVATE_REQUIREMENTS setting for the version currently installed on edx.org.

To install new versions of Problem Builder (v3.1.3+), use pip install xblock-problem-builder or specify a version using e.g. pip install xblock-problem-builder==3.1.3. To do this on Open edX could look like:

$ sudo -Hu edxapp bash
edxapp $ cd && . edxapp_env  && . ./venvs/edxapp/bin/activate && cd edx-platform/
edxapp $ pip install xblock-problem-builder
edxapp $ ./manage.py lms migrate --settings=aws  # or openstack, as appropriate

Then, restart the edxapp services:

$ sudo /edx/bin/supervisorctl restart edxapp:
$ sudo /edx/bin/supervisorctl restart edxapp_workers:

To install old verions of Problem Builder (< v3.1.3) on an Open edX installation, choose the tag you wish to install, follow the above instructions but instead of the pip install xblock-problem-builder command, use:

TAG='v2.6.5' pip install "git+https://github.com/open-craft/problem-builder.git@$TAG#egg=xblock-problem-builder==$TAG"

Note that Problem Builder requires xblock-utils. If you are installing it into a virtualenv used by edx-platform, xblock-utils should already be installed. But if you are installing it into another virtualenv, you may need to first install xblock-utils manually (recent versions of it are not available on PyPI so will not be automatically installed).

See Usage Instructions for how to enable in Studio.

Publishing to PyPI

Whenever we tag a new version, e.g. v3.1.3 and push it to GitHub, CircleCI will build it and deploy it to PyPI automatically. For details on how this works, see this pull request.

License

This XBlock is available under the GNU Affero General Public License (AGPLv3).

You can’t perform that action at this time.