-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9cf39a0
Showing
56 changed files
with
3,337 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Developed by OpenCraft | ||
http://opencraft.com/ | ||
|
||
Xavier Antoviaque <[email protected]> | ||
Filippo Valsorda <[email protected]> | ||
Matjaz Gregoric <[email protected]> | ||
David Gabor Bodor <[email protected]> | ||
Alan Boudreault <[email protected]> | ||
Eugeny Kolpakov <[email protected]> | ||
Braden MacDonald <[email protected]> | ||
Jonathan Piacenti <[email protected]> | ||
Tim Krones <[email protected]> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
------------------------------------------------------------------------------ | ||
This license applies to the following third-party libraries included | ||
in this repository: | ||
|
||
- backbone.paginator | ||
- Backbone.js | ||
- Underscore.js | ||
------------------------------------------------------------------------------ | ||
|
||
The MIT License (MIT) | ||
|
||
Copyright (c) [year] [fullname] | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
.DEFAULT_GOAL := help | ||
|
||
WORKING_DIR := problem_builder | ||
JS_TARGET := $(WORKING_DIR)/public/js/translations | ||
EXTRACT_DIR := $(WORKING_DIR)/translations/en/LC_MESSAGES | ||
|
||
help: ## display this help message | ||
@echo "Please use \`make <target>' where <target> is one of" | ||
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-25s\033[0m %s\n", $$1, $$2}' | ||
|
||
upgrade: | ||
pip-compile --output-file test_requirements.txt test_requirements.in | ||
|
||
extract_translations: ## extract strings to be translated, outputting .po files | ||
cd $(WORKING_DIR) && i18n_tool extract | ||
cd $(EXTRACT_DIR) && \ | ||
msgcat underscore.po djangojs-partial.po -o textjs.po && \ | ||
cat django-partial.po > text.po && \ | ||
sed -i'' -e 's/nplurals=INTEGER/nplurals=2/' -- text.po textjs.po && \ | ||
sed -i'' -e 's/plural=EXPRESSION/plural=\(n != 1\)/' -- text.po textjs.po && \ | ||
rm -fv django*.*o underscore.*o | ||
|
||
compile_translations: ## compile translation files, outputting .mo files for each supported language | ||
cd $(WORKING_DIR) && i18n_tool generate | ||
python manage.py compilejsi18n --namespace ProblemBuilderXBlockI18N --output $(JS_TARGET) | ||
|
||
detect_changed_source_translations: | ||
cd $(WORKING_DIR) && i18n_tool changed | ||
|
||
dummy_translations: ## generate dummy translation (.po) files | ||
cd $(WORKING_DIR) && i18n_tool dummy | ||
|
||
build_dummy_translations: dummy_translations compile_translations ## generate and compile dummy translation files | ||
|
||
validate_translations: build_dummy_translations detect_changed_source_translations ## validate translations | ||
|
||
pull_translations: ## pull translations from transifex | ||
cd $(WORKING_DIR) && i18n_tool transifex pull | ||
|
||
push_translations: ## push translations to transifex | ||
cd $(WORKING_DIR) && i18n_tool transifex push | ||
|
||
isort: ## run isort on python source files | ||
isort -rc problem_builder | ||
|
||
quality: ## run quality checkers on the codebase | ||
pycodestyle problem_builder | ||
pylint problem_builder | ||
|
||
test.unit: ## run python unit tests with coverage | ||
coverage run run_tests.py problem_builder/v1/tests | ||
coverage run run_tests.py problem_builder/tests/unit | ||
|
||
test.integration: ## run python selenium tests with coverage | ||
coverage run run_tests.py problem_builder/tests/integration | ||
|
||
test: quality test.unit test.integration ## Run all tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,273 @@ | ||
Problem Builder and Step Builder | ||
-------------------------------- | ||
|
||
[](https://circleci.com/gh/open-craft/problem-builder) | ||
|
||
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](doc/Dashboard.md) | ||
|
||
The following screenshot shows an example of a Problem Builder block | ||
containing a free-form question, two MCQs and one MRQ: | ||
|
||
 | ||
|
||
Installation | ||
------------ | ||
|
||
You can install Problem Builder from [PyPI](https://pypi.org/project/xblock-problem-builder/) | ||
using this command: | ||
|
||
``` | ||
pip install xblock-problem-builder | ||
``` | ||
|
||
For full details, see "Open edX Installation", below. | ||
|
||
Usage | ||
----- | ||
|
||
See [Usage Instructions](doc/Usage.md) | ||
|
||
Workbench installation and settings | ||
----------------------------------- | ||
|
||
For developers, you can install this XBlock into an XBlock SDK workbench's | ||
virtualenv. | ||
|
||
Firstly, create a virtualenv: | ||
|
||
```bash | ||
~/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: | ||
|
||
```bash | ||
(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: | ||
|
||
```bash | ||
(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`: | ||
|
||
```python | ||
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: | ||
|
||
```bash | ||
$ ./manage.py migrate --settings=workbench.settings_pb | ||
``` | ||
|
||
Running the workbench | ||
--------------------- | ||
|
||
```bash | ||
$ ./manage.py runserver 8000 --settings=workbench.settings_pb | ||
``` | ||
|
||
Access it at [http://localhost:8000/](http://localhost:8000). | ||
|
||
Running tests | ||
------------- | ||
|
||
The integration tests require a recent Firefox and geckodriver (CI | ||
uses Firefox 70 and geckodriver 0.26). These can be installed locally for | ||
testing if required. For example on Linux: | ||
|
||
``` | ||
mkdir external | ||
cd external | ||
wget https://archive.mozilla.org/pub/firefox/releases/70.0.1/linux-x86_64/en-US/firefox-70.0.1.tar.bz2 | ||
tar jxf firefox-70.0.1.tar.bz2 | ||
wget https://github.com/mozilla/geckodriver/releases/download/v0.26.0/geckodriver-v0.26.0-linux64.tar.gz | ||
tar xzf geckodriver-v0.26.0-linux64.tar.gz | ||
export PATH="$(pwd):$(pwd)/firefox/:$PATH" | ||
# now can run integration tests using this firefox version | ||
cd .. | ||
make test.integration | ||
``` | ||
|
||
From the problem-builder repository root, run the tests with the | ||
following command: | ||
|
||
```bash | ||
$ make test | ||
``` | ||
|
||
See also the following for more scoped tests: | ||
|
||
```bash | ||
$ make quality | ||
$ make test.unit | ||
$ make test.integration | ||
``` | ||
|
||
Working with Translations | ||
------------------------- | ||
|
||
For information about working with translations, see the | ||
[Internationalization Support](http://edx.readthedocs.io/projects/xblock-tutorial/en/latest/edx_platform/edx_lms.html#internationalization-support) | ||
section of the [Open edX XBlock Tutorial](https://xblock-tutorial.readthedocs.io/en/latest/). | ||
|
||
[Prepare your virtualenv](#workbench-installation-and-settings) and ensure that the | ||
[Transifex authentication file](https://openedx.atlassian.net/wiki/display/OpenOPS/Running+Fullstack) | ||
(``~/.transifexrc``) is properly set up. | ||
|
||
Push new strings to Transifex: | ||
|
||
```bash | ||
$ make extract_translations | ||
$ make push_translations | ||
``` | ||
|
||
To get the latest translations from Transifex: | ||
|
||
```bash | ||
$ make pull_translations | ||
$ make compile_translations | ||
``` | ||
|
||
For testing purposes it's faster to avoid Transifex and work on dummy Esperanto translations: | ||
|
||
```bash | ||
$ make build_dummy_translations | ||
``` | ||
|
||
The Transifex configuration is stored in `.tx`. For more information read | ||
[transifex's documentation](https://docs.transifex.com/client/client-configuration) | ||
|
||
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 and push to Transifex as described above. | ||
3. Go to Transifex and translate both of the | ||
[Problem Builder](https://www.transifex.com/open-edx/xblocks/problem-builder/) | ||
and the [Problem Builder JS](https://www.transifex.com/open-edx/xblocks/problem-builder-js/) resources. | ||
4. When you're done with the translations pull from Transifex as described above. | ||
|
||
|
||
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: | ||
|
||
```bash | ||
$ 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: | ||
|
||
```bash | ||
$ 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`](https://github.com/open-craft/problem-builder/tree/v2.6.0), | ||
[`v2.6.5`](https://github.com/open-craft/problem-builder/tree/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](https://github.com/open-craft/problem-builder/tree/v2.6.0). See | ||
[PR 128](https://github.com/open-craft/problem-builder/pull/128) for details. | ||
* `edx-platform` version `named-release/dogwood.3` and earlier must use | ||
[v2.0.0](https://github.com/open-craft/problem-builder/tree/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](https://github.com/edx/configuration/blob/master/playbooks/roles/edxapp/defaults/main.yml) for the version | ||
currently installed on [edx.org](https://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: | ||
|
||
```bash | ||
$ 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: | ||
```bash | ||
$ 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](https://github.com/edx/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](doc/Usage.md) 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](https://github.com/open-craft/problem-builder/pull/199). | ||
|
||
License | ||
------- | ||
|
||
This XBlock is available under the GNU Affero General Public License (AGPLv3). |
Oops, something went wrong.