Skip to content

Commit

Permalink
Use xblock get_mode method to determine completion mode. (#27)
Browse files Browse the repository at this point in the history
* Use xblock get_mode method to determine completion mode.

* Bump XBlock==1.2.2
  • Loading branch information
jcdyer authored Dec 21, 2018
1 parent 4e703be commit c24db32
Show file tree
Hide file tree
Showing 8 changed files with 167 additions and 165 deletions.
2 changes: 1 addition & 1 deletion completion/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def scorable_block_completion(sender, **kwargs): # pylint: disable=unused-argum
course_key = CourseKey.from_string(kwargs['course_id'])
block_key = UsageKey.from_string(kwargs['usage_id'])
block_cls = XBlock.load_class(block_key.block_type)
if getattr(block_cls, 'completion_mode', XBlockCompletionMode.COMPLETABLE) != XBlockCompletionMode.COMPLETABLE:
if XBlockCompletionMode.get_mode(block_cls) != XBlockCompletionMode.COMPLETABLE:
return
if getattr(block_cls, 'has_custom_completion', False):
return
Expand Down
2 changes: 1 addition & 1 deletion completion/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def can_mark_block_complete_on_view(self, block):
This is true of any non-customized, non-scorable, completable block.
"""
return (
getattr(block, 'completion_mode', XBlockCompletionMode.COMPLETABLE) == XBlockCompletionMode.COMPLETABLE
XBlockCompletionMode.get_mode(block) == XBlockCompletionMode.COMPLETABLE
and not getattr(block, 'has_custom_completion', False)
and not getattr(block, 'has_score', False)
)
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ djangorestframework>=3.2.0,<3.7.0 # REST API framework
edx-opaque-keys[django] # Create and introspect course and xblock identities
edx-drf-extensions>=2.0.0,<3.0.0 # Provides JWT authentication
pytz # Time zone support
XBlock # Courseware component architecture
XBlock>=1.2.2 # Courseware component architecture
93 changes: 46 additions & 47 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,80 +4,79 @@
#
# pip-compile --output-file requirements/dev.txt requirements/dev.in
#

appdirs==1.4.3 # via fs
argparse==1.4.0 # via caniusepython3
astroid==1.5.2 # via edx-lint, pylint, pylint-celery, pylint-plugin-utils
attrs==17.4.0 # via pytest
backports.functools-lru-cache==1.5 # via astroid, caniusepython3, pylint
caniusepython3==6.0.0
certifi==2018.1.18 # via requests
astroid==1.5.2 # via edx-lint, pylint, pylint-celery
atomicwrites==1.2.1 # via pytest
attrs==18.2.0 # via pytest
backports.functools-lru-cache==1.5 # via caniusepython3
caniusepython3==7.0.0
certifi==2018.8.24 # via requests
chardet==3.0.4 # via requests
click-log==0.1.8 # via edx-lint
click==6.7 # via click-log, edx-lint, pip-tools
configparser==3.5.0 # via pylint
coverage==4.5.1 # via pytest-cov
ddt==1.1.2
diff-cover==1.0.2
distlib==0.2.6 # via caniusepython3
django-model-utils==3.1.1
django==1.11.11
ddt==1.2.0
diff-cover==1.0.4
distlib==0.2.7 # via caniusepython3
django-model-utils==3.1.2
django==1.11.15
djangorestframework==3.6.4
edx-i18n-tools==0.4.3
edx-i18n-tools==0.4.7
edx-lint==0.5.5
edx-opaque-keys[django]==0.4.3
enum34==1.1.6 # via astroid, fs
factory-boy==2.10.0
faker==0.8.12 # via factory-boy
edx-opaque-keys[django]==0.4.4
factory-boy==2.11.1
faker==0.9.0 # via factory-boy
first==2.0.1 # via pip-tools
freezegun==0.3.10
fs==2.0.20 # via xblock
funcsigs==1.0.2 # via mock, pytest
fs==2.1.0 # via xblock
futures==3.1.1 ; python_version >= "3"
idna==2.6 # via requests
inflect==0.2.5 # via jinja2-pluralize
ipaddress==1.0.19 # via faker
idna==2.7 # via requests
inflect==1.0.0 # via jinja2-pluralize
isort==4.3.4
jinja2-pluralize==0.3.0 # via diff-cover
jinja2==2.10 # via diff-cover, jinja2-pluralize
lazy-object-proxy==1.3.1 # via astroid
lxml==4.2.1 # via xblock
lxml==4.2.4 # via xblock
markupsafe==1.0 # via jinja2, xblock
mccabe==0.6.1 # via pylint
mock==2.0.0
more-itertools==4.1.0 # via pytest
more-itertools==4.3.0 # via pytest
packaging==17.1 # via caniusepython3
path.py==11.0 # via edx-i18n-tools
pbr==3.1.1 # via mock, stevedore
pip-tools==1.11.0
pluggy==0.6.0 # via pytest, tox
path.py==11.1.0 # via edx-i18n-tools
pathlib2==2.3.2 # via pytest
pbr==4.2.0 # via mock, stevedore
pip-tools==2.0.2
pluggy==0.7.1 # via pytest, tox
polib==1.1.0 # via edx-i18n-tools
py==1.5.3 # via pytest, tox
pycodestyle==2.3.1
py==1.6.0 # via pytest, tox
pycodestyle==2.4.0
pydocstyle==2.1.1
pygments==2.2.0 # via diff-cover
pylint-celery==0.3 # via edx-lint
pylint-django==0.7.2 # via edx-lint
pylint-plugin-utils==0.2.6 # via pylint-celery, pylint-django
pylint-plugin-utils==0.4 # via pylint-celery, pylint-django
pylint==1.7.1 # via edx-lint, pylint-celery, pylint-django, pylint-plugin-utils
pymongo==3.6.1 # via edx-opaque-keys
pymongo==3.7.1 # via edx-opaque-keys
pyparsing==2.2.0 # via packaging
pytest-cov==2.5.1
pytest-django==3.1.2
pytest==3.5.0 # via pytest-cov, pytest-django
python-dateutil==2.7.0 # via faker, freezegun, xblock
pytz==2018.3
pyyaml==3.12 # via edx-i18n-tools, xblock
requests==2.18.4 # via caniusepython3
singledispatch==3.4.0.3 # via astroid, pylint
six==1.11.0 # via astroid, diff-cover, edx-i18n-tools, edx-lint, edx-opaque-keys, faker, freezegun, fs, mock, more-itertools, packaging, pip-tools, pydocstyle, pylint, pytest, python-dateutil, singledispatch, stevedore, tox, xblock
pytest-cov==2.6.0
pytest-django==3.4.2
pytest==3.8.0 # via pytest-cov, pytest-django
python-dateutil==2.7.3 # via faker, freezegun, xblock
pytz==2018.5
pyyaml==3.13 # via edx-i18n-tools, xblock
requests==2.19.1 # via caniusepython3
six==1.11.0 # via astroid, diff-cover, edx-i18n-tools, edx-lint, edx-opaque-keys, faker, freezegun, fs, mock, more-itertools, packaging, pathlib2, pip-tools, pydocstyle, pylint, pytest, python-dateutil, stevedore, tox, xblock
snowballstemmer==1.2.1 # via pydocstyle
stevedore==1.28.0 # via edx-opaque-keys
stevedore==1.29.0 # via edx-opaque-keys
text-unidecode==1.2 # via faker
tox-battery==0.5
tox==2.9.1
urllib3==1.22 # via requests
virtualenv==15.2.0 # via tox
tox-battery==0.5.1
tox==3.2.1
typing==3.6.6 # via fs
urllib3==1.23 # via requests
virtualenv==16.0.0 # via tox
web-fragments==0.2.2 # via xblock
webob==1.7.4 # via xblock
webob==1.8.2 # via xblock
wrapt==1.10.11 # via astroid
xblock==1.1.1
xblock==1.2.2
84 changes: 43 additions & 41 deletions requirements/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,64 +4,66 @@
#
# pip-compile --output-file requirements/doc.txt requirements/doc.in
#
alabaster==0.7.10 # via sphinx

alabaster==0.7.11 # via sphinx
appdirs==1.4.3 # via fs
attrs==17.4.0 # via pytest
babel==2.5.3 # via sphinx
bleach==2.1.3 # via readme-renderer
certifi==2018.1.18 # via requests
atomicwrites==1.2.1 # via pytest
attrs==18.2.0 # via pytest
babel==2.6.0 # via sphinx
bleach==2.1.4 # via readme-renderer
certifi==2018.8.24 # via requests
cffi==1.11.5 # via cmarkgfm
chardet==3.0.4 # via doc8, requests
commonmark==0.7.5 # via readme-renderer
cmarkgfm==0.4.2 # via readme-renderer
coverage==4.5.1 # via pytest-cov
ddt==1.1.2
django-model-utils==3.1.1
django==1.11.11
ddt==1.2.0
django-model-utils==3.1.2
django==1.11.15
djangorestframework==3.6.4
doc8==0.8.0
docutils==0.14 # via doc8, readme-renderer, restructuredtext-lint, sphinx
edx-opaque-keys[django]==0.4.3
edx-opaque-keys[django]==0.4.4
edx-sphinx-theme==1.3.0
enum34==1.1.6 # via fs
factory-boy==2.10.0
faker==0.8.12 # via factory-boy
factory-boy==2.11.1
faker==0.9.0 # via factory-boy
freezegun==0.3.10
fs==2.0.20 # via xblock
funcsigs==1.0.2 # via mock, pytest
future==0.16.0 # via commonmark
fs==2.1.0 # via xblock
future==0.16.0 # via readme-renderer
html5lib==1.0.1 # via bleach
idna==2.6 # via requests
imagesize==1.0.0 # via sphinx
ipaddress==1.0.19 # via faker
idna==2.7 # via requests
imagesize==1.1.0 # via sphinx
jinja2==2.10 # via sphinx
lxml==4.2.1 # via xblock
lxml==4.2.4 # via xblock
markupsafe==1.0 # via jinja2, xblock
mock==2.0.0
more-itertools==4.1.0 # via pytest
more-itertools==4.3.0 # via pytest
packaging==17.1 # via sphinx
pbr==3.1.1 # via mock, stevedore
pluggy==0.6.0 # via pytest
py==1.5.3 # via pytest
pathlib2==2.3.2 # via pytest
pbr==4.2.0 # via mock, stevedore
pluggy==0.7.1 # via pytest
py==1.6.0 # via pytest
pycparser==2.18 # via cffi
pygments==2.2.0 # via readme-renderer, sphinx
pymongo==3.6.1 # via edx-opaque-keys
pymongo==3.7.1 # via edx-opaque-keys
pyparsing==2.2.0 # via packaging
pytest-cov==2.5.1
pytest-django==3.1.2
pytest==3.5.0 # via pytest-cov, pytest-django
python-dateutil==2.7.0 # via faker, freezegun, xblock
pytz==2018.3
pyyaml==3.12 # via xblock
readme-renderer==17.4
requests==2.18.4 # via sphinx
pytest-cov==2.6.0
pytest-django==3.4.2
pytest==3.8.0 # via pytest-cov, pytest-django
python-dateutil==2.7.3 # via faker, freezegun, xblock
pytz==2018.5
pyyaml==3.13 # via xblock
readme-renderer==21.0
requests==2.19.1 # via sphinx
restructuredtext-lint==1.1.3 # via doc8
six==1.11.0 # via bleach, doc8, edx-opaque-keys, edx-sphinx-theme, faker, freezegun, fs, html5lib, mock, more-itertools, packaging, pytest, python-dateutil, readme-renderer, sphinx, stevedore, xblock
six==1.11.0 # via bleach, doc8, edx-opaque-keys, edx-sphinx-theme, faker, freezegun, fs, html5lib, mock, more-itertools, packaging, pathlib2, pytest, python-dateutil, readme-renderer, sphinx, stevedore, xblock
snowballstemmer==1.2.1 # via sphinx
sphinx==1.7.2
sphinxcontrib-websupport==1.0.1 # via sphinx
stevedore==1.28.0 # via doc8, edx-opaque-keys
sphinx==1.7.9
sphinxcontrib-websupport==1.1.0 # via sphinx
stevedore==1.29.0 # via doc8, edx-opaque-keys
text-unidecode==1.2 # via faker
typing==3.6.4 # via sphinx
urllib3==1.22 # via requests
typing==3.6.6 # via fs
urllib3==1.23 # via requests
web-fragments==0.2.2 # via xblock
webencodings==0.5.1 # via html5lib
webob==1.7.4 # via xblock
xblock==1.1.1
webob==1.8.2 # via xblock
xblock==1.2.2
77 changes: 38 additions & 39 deletions requirements/quality.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,67 +4,66 @@
#
# pip-compile --output-file requirements/quality.txt requirements/quality.in
#

appdirs==1.4.3 # via fs
argparse==1.4.0 # via caniusepython3
astroid==1.5.2 # via edx-lint, pylint, pylint-celery, pylint-plugin-utils
attrs==17.4.0 # via pytest
backports.functools-lru-cache==1.5 # via astroid, caniusepython3, pylint
caniusepython3==6.0.0
certifi==2018.1.18 # via requests
astroid==1.5.2 # via edx-lint, pylint, pylint-celery
atomicwrites==1.2.1 # via pytest
attrs==18.2.0 # via pytest
backports.functools-lru-cache==1.5 # via caniusepython3
caniusepython3==7.0.0
certifi==2018.8.24 # via requests
chardet==3.0.4 # via requests
click-log==0.1.8 # via edx-lint
click==6.7 # via click-log, edx-lint
configparser==3.5.0 # via pylint
coverage==4.5.1 # via pytest-cov
ddt==1.1.2
distlib==0.2.6 # via caniusepython3
django-model-utils==3.1.1
django==1.11.11
ddt==1.2.0
distlib==0.2.7 # via caniusepython3
django-model-utils==3.1.2
django==1.11.15
djangorestframework==3.6.4
edx-lint==0.5.5
edx-opaque-keys[django]==0.4.3
enum34==1.1.6 # via astroid, fs
factory-boy==2.10.0
faker==0.8.12 # via factory-boy
edx-opaque-keys[django]==0.4.4
factory-boy==2.11.1
faker==0.9.0 # via factory-boy
freezegun==0.3.10
fs==2.0.20 # via xblock
funcsigs==1.0.2 # via mock, pytest
fs==2.1.0 # via xblock
futures==3.1.1 ; python_version >= "3"
idna==2.6 # via requests
ipaddress==1.0.19 # via faker
idna==2.7 # via requests
isort==4.3.4
lazy-object-proxy==1.3.1 # via astroid
lxml==4.2.1 # via xblock
lxml==4.2.4 # via xblock
markupsafe==1.0 # via xblock
mccabe==0.6.1 # via pylint
mock==2.0.0
more-itertools==4.1.0 # via pytest
more-itertools==4.3.0 # via pytest
packaging==17.1 # via caniusepython3
pbr==3.1.1 # via mock, stevedore
pluggy==0.6.0 # via pytest
py==1.5.3 # via pytest
pycodestyle==2.3.1
pathlib2==2.3.2 # via pytest
pbr==4.2.0 # via mock, stevedore
pluggy==0.7.1 # via pytest
py==1.6.0 # via pytest
pycodestyle==2.4.0
pydocstyle==2.1.1
pylint-celery==0.3 # via edx-lint
pylint-django==0.7.2 # via edx-lint
pylint-plugin-utils==0.2.6 # via pylint-celery, pylint-django
pylint-plugin-utils==0.4 # via pylint-celery, pylint-django
pylint==1.7.1 # via edx-lint, pylint-celery, pylint-django, pylint-plugin-utils
pymongo==3.6.1 # via edx-opaque-keys
pymongo==3.7.1 # via edx-opaque-keys
pyparsing==2.2.0 # via packaging
pytest-cov==2.5.1
pytest-django==3.1.2
pytest==3.5.0 # via pytest-cov, pytest-django
python-dateutil==2.7.0 # via faker, freezegun, xblock
pytz==2018.3
pyyaml==3.12 # via xblock
requests==2.18.4 # via caniusepython3
singledispatch==3.4.0.3 # via astroid, pylint
six==1.11.0 # via astroid, edx-lint, edx-opaque-keys, faker, freezegun, fs, mock, more-itertools, packaging, pydocstyle, pylint, pytest, python-dateutil, singledispatch, stevedore, xblock
pytest-cov==2.6.0
pytest-django==3.4.2
pytest==3.8.0 # via pytest-cov, pytest-django
python-dateutil==2.7.3 # via faker, freezegun, xblock
pytz==2018.5
pyyaml==3.13 # via xblock
requests==2.19.1 # via caniusepython3
six==1.11.0 # via astroid, edx-lint, edx-opaque-keys, faker, freezegun, fs, mock, more-itertools, packaging, pathlib2, pydocstyle, pylint, pytest, python-dateutil, stevedore, xblock
snowballstemmer==1.2.1 # via pydocstyle
stevedore==1.28.0 # via edx-opaque-keys
stevedore==1.29.0 # via edx-opaque-keys
text-unidecode==1.2 # via faker
urllib3==1.22 # via requests
typing==3.6.6 # via fs
urllib3==1.23 # via requests
web-fragments==0.2.2 # via xblock
webob==1.7.4 # via xblock
webob==1.8.2 # via xblock
wrapt==1.10.11 # via astroid
xblock==1.1.1
xblock==1.2.2
Loading

0 comments on commit c24db32

Please sign in to comment.