Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial implementation #1

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
10eb0e3
feat: handle post field edit in studio
navinkarkera Jun 20, 2024
25913da
feat: basic html component
navinkarkera Jul 7, 2024
bc14287
feat: bookmarks
navinkarkera Jul 11, 2024
4a615e1
refactor: fix bookmark button alignment
navinkarkera Jul 11, 2024
dbc9684
feat: test scores slide
navinkarkera Jul 22, 2024
f995a0d
fix: child show_correctness based on display_feedback
navinkarkera Jul 25, 2024
c9eda7c
feat: hide see test results button based on display_feedback
navinkarkera Jul 25, 2024
a405488
fix: reset problem bookmark on reset
navinkarkera Jul 25, 2024
296112d
feat: auto advance on submit
navinkarkera Jul 26, 2024
8b104fe
feat: mark block complete based on cut off score
navinkarkera Jul 26, 2024
46187b0
test: add test utils and basic tests
navinkarkera Jul 29, 2024
28abb0d
test: add all basic tests
navinkarkera Jul 30, 2024
af054f8
chore: upgrade deps
navinkarkera Jul 30, 2024
0361dff
fix: remove support for 3.8
navinkarkera Jul 30, 2024
6951f82
fix: student_view_data pickle error
navinkarkera Jul 31, 2024
48bd99e
docs: update readme
navinkarkera Jul 31, 2024
9d0fc3a
docs: add screenshots
navinkarkera Jul 31, 2024
7238d00
feat: add back button in test scores slide
navinkarkera Jul 31, 2024
dffe5dd
docs: update images
navinkarkera Jul 31, 2024
bc60284
fix: gate result api
navinkarkera Jul 31, 2024
cfb83df
feat: add cut-off score to test score slide
navinkarkera Aug 1, 2024
d733533
feat: show/hide back button based on display_feedback
navinkarkera Aug 2, 2024
9b6bd9d
refactor: update display_feedback and showanswer help text
navinkarkera Aug 6, 2024
2243c1d
docs: update readme
navinkarkera Aug 7, 2024
9860668
chore: update variable name in js
navinkarkera Aug 7, 2024
24daef4
build: add support for 3.8
navinkarkera Aug 8, 2024
7dcafb2
feat: add support for olive version
navinkarkera Aug 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .mise.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
[env]
TUTOR_ROOT = "{{env.PWD}}"
_.python.venv = { path = ".venv", create = true } # create the venv if it doesn't exist

[tools]
python = "3.11" # [optional] will be used for the venv
python = "3.8" # [optional] will be used for the venv
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ extract_translations: ## extract strings to be translated, outputting .po files

compile_translations: ## compile translation files, outputting .mo files for each supported language
cd $(WORKING_DIR) && i18n_tool generate -v
python manage.py compilejsi18n --namespace DragAndDropI18N --output $(JS_TARGET)
python manage.py compilejsi18n --namespace MultiProblemI18N --output $(JS_TARGET)

detect_changed_source_translations:
cd $(WORKING_DIR) && i18n_tool changed
Expand Down Expand Up @@ -71,7 +71,7 @@ test.python: ## run python unit tests in the local virtualenv
pytest --cov multi_problem_xblock $(TEST)

test.unit: ## run all unit tests
tox $(TEST)
tox -- $(TEST)

test: test.unit test.quality ## Run all tests
tox -e translations
Expand Down
38 changes: 28 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,39 @@ root folder:

```bash
$ pip install -r requirements.txt

```

#### Install in development mode in tutor

* Clone this repository somewhere locally, for example: `/path/to/multi-problem-xblock`.
* Mount this directory in tutor using `tutor mounts add /path/to/multi-problem-xblock`
* Run `tutor dev launch`

navinkarkera marked this conversation as resolved.
Show resolved Hide resolved
### Enabling in Studio

Go to `Settings -> Advanced` Settings and add `multi-problem` to `Advanced Module List`.
Go to `Settings -> Advanced` Settings and add `multi_problem` to `Advanced Module List`.

### Usage

*TBD*
* Click on `Advanced block` in studio unit authoring page and select `Multi Problem Block`.
* Click on `Edit` button to select a library from which child problems needs to be fetched.
* You can update the number of problems user will see using `Count` field, update cut-off score, display name etc.
* `Display feedback` field allows authors to control when users can see problem answers, this updates `show_correctness` of all the child problems.

#### Screenshots

![image](https://github.com/user-attachments/assets/b6cec90d-307b-43f8-856f-6cd54f28918a)

![image](https://github.com/user-attachments/assets/645b5ab4-74e9-4237-be87-c81b3d432fdf)

![image](https://github.com/user-attachments/assets/be11fe56-8c90-4f51-bce1-aa20ad852718)

![image](https://github.com/user-attachments/assets/f4243f26-c73a-4ebd-afbe-7e5bc84a9617)

![image](https://github.com/user-attachments/assets/64074714-33cb-4bcb-a03f-c141113288df)



### Testing with tox

Expand All @@ -30,7 +54,6 @@ Inside a fresh virtualenv, `cd` into the root folder of this repository
$ make requirements
```


You can then run the entire test suite via:

```bash
Expand Down Expand Up @@ -69,11 +92,10 @@ To comply with l10n requirements, XBlock is supposed to provide translations in

[edx-docs-i18n]: http://edx.readthedocs.io/projects/xblock-tutorial/en/latest/edx_platform/edx_lms.html#internationalization-support

Drag and Drop v2 XBlock aims to comply with i18n requirements for Open edX platform, including a stricter set of
requirements for `edx.org` itself, thus providing the required files. So far only two translations are available:
Multi Problem XBlock aims to comply with i18n requirements for Open edX platform, including a stricter set of
requirements for `edx.org` itself, thus providing the required files. So far only one translation is available:

* Default English translation
* Fake "Esperanto" translation used to test i18n/l10n.

Updates to translated strings are supposed to be propagated to `text.po` files. EdX [i18n_tools][edx-i18n-tools] is used here along GNU Gettext and a Makefile for automation.

Expand Down Expand Up @@ -107,7 +129,3 @@ translator from edX i18n-tools.
```bash
$ make dummy_translations
```

## Releasing

To release a new version, update .travis.yml and setup.py to point to your new intended version number and create a new release with that version tag via Github.
86 changes: 67 additions & 19 deletions multi_problem_xblock/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,89 @@

import logging

from xblock.core import XBlock

log = logging.getLogger(__name__)


def getLibraryContentBlock():
"""Get LibraryContentBlock from edx-platform if possible"""
try:
from xmodule.library_content_block import LibraryContentBlock
from xmodule.library_content_block import LibraryContentBlock # pylint: disable=import-outside-toplevel
except ModuleNotFoundError:
log.warning('LibraryContentBlock not found, using empty object')
LibraryContentBlock = object
try:
# Support for olive version
from xmodule.library_content_module import LibraryContentBlock # pylint: disable=import-outside-toplevel
except ModuleNotFoundError:
log.warning('LibraryContentBlock not found, using empty object')
LibraryContentBlock = XBlock
return LibraryContentBlock


class SHOWANSWER:
class L_SHOWANSWER:
"""
Local copy of SHOWANSWER from xmodule/capa_block.py in edx-platform
"""
ALWAYS = "always"
ANSWERED = "answered"
ATTEMPTED = "attempted"
CLOSED = "closed"
FINISHED = "finished"
CORRECT_OR_PAST_DUE = "correct_or_past_due"
PAST_DUE = "past_due"
NEVER = "never"
AFTER_SOME_NUMBER_OF_ATTEMPTS = "after_attempts"
AFTER_ALL_ATTEMPTS = "after_all_attempts"
AFTER_ALL_ATTEMPTS_OR_CORRECT = "after_all_attempts_or_correct"
ATTEMPTED_NO_PAST_DUE = "attempted_no_past_due"

ALWAYS = 'always'
ANSWERED = 'answered'
ATTEMPTED = 'attempted'
CLOSED = 'closed'
FINISHED = 'finished'
CORRECT_OR_PAST_DUE = 'correct_or_past_due'
PAST_DUE = 'past_due'
NEVER = 'never'
AFTER_SOME_NUMBER_OF_ATTEMPTS = 'after_attempts'
AFTER_ALL_ATTEMPTS = 'after_all_attempts'
AFTER_ALL_ATTEMPTS_OR_CORRECT = 'after_all_attempts_or_correct'
ATTEMPTED_NO_PAST_DUE = 'attempted_no_past_due'


class L_ShowCorrectness:
"""
Local copy of ShowCorrectness from xmodule/graders.py in edx-platform
"""

# Constants used to indicate when to show correctness
ALWAYS = 'always'
PAST_DUE = 'past_due'
NEVER = 'never'


def getShowAnswerOptions():
"""Get SHOWANSWER constant from xmodule/capa_block.py"""
try:
from xmodule.capa_block import SHOWANSWER
from xmodule.capa_block import SHOWANSWER # pylint: disable=import-outside-toplevel

return SHOWANSWER
except ModuleNotFoundError:
log.warning('SHOWANSWER not found, using local copy')
return SHOWANSWER
try:
# Support for olive version
from xmodule.capa_module import SHOWANSWER # pylint: disable=import-outside-toplevel

return SHOWANSWER
except ModuleNotFoundError:
log.warning('SHOWANSWER not found, using local copy')
return L_SHOWANSWER


def getShowCorrectnessOptions():
"""Get ShowCorrectness constant from xmodule/graders.py"""
try:
from xmodule.graders import ShowCorrectness # pylint: disable=import-outside-toplevel

return ShowCorrectness
except ModuleNotFoundError:
log.warning('ShowCorrectness not found, using local copy')
return L_ShowCorrectness


def getStudentView():
"""Get STUDENT_VIEW constant from xmodule/x_module.py"""
try:
from xmodule.x_module import STUDENT_VIEW # pylint: disable=import-outside-toplevel

return STUDENT_VIEW
except ModuleNotFoundError:
log.warning('STUDENT_VIEW not found, using raw string')
return 'student_view'
Loading
Loading