Skip to content

Commit

Permalink
Merge pull request #54 from eduNEXT/lfc/sumac-support
Browse files Browse the repository at this point in the history
perf: sumac release support
  • Loading branch information
jignaciopm authored Jan 28, 2025
2 parents e3dae07 + 4f00b13 commit df12bae
Show file tree
Hide file tree
Showing 36 changed files with 983 additions and 299 deletions.
73 changes: 0 additions & 73 deletions .circleci/config.yml

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Test suite workflow

on:
push:
branches: [master]
pull_request:
branches:
- '**'


jobs:
run_tests:
name: tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
python-version: ['3.11']
toxenv: [django42]

steps:
- uses: actions/checkout@v4
- name: setup python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install pip
run: pip install -r requirements/pip.txt

- name: Install Dependencies
run: pip install -r requirements/ci.txt

- name: Run Tests
env:
TOXENV: ${{ matrix.toxenv }}
run: tox
10 changes: 10 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Run commitlint on the commit messages in a pull request.

name: Lint Commit Messages

on:
- pull_request

jobs:
commitlint:
uses: openedx/.github/.github/workflows/commitlint.yml@master
30 changes: 30 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,36 @@ Unreleased

*

[2.0.0] - 2025-01-23
**********************************************

Added
=====

* Support for Python 3.11 and Django 4.2
* Add github workflow

Removed
_______

* **BREAKING CHANGE**: Dropped support for Python 3.5
* Drop CircleCI support
* Remove support to "redirect to another unit in the same subsection" action

Changed
=======

* Fix UI issues

[1.0.1] - 2020-10-14
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixed
_____

* Python3 and Juniper issues
* Fix applyFlowControl in injection to applied correctly the actions of flow-control


[1.0.0] - 2020-06-18
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
29 changes: 29 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
.DEFAULT_GOAL := help

ifdef TOXENV
TOX := tox -- #to isolate each tox environment if TOXENV is defined
endif

.PHONY: help test install upgrade requirements

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}'

install-dev-dependencies: ## install tox
pip install -r requirements/tox.txt

clean: ## delete most git-ignored files
find . -name '__pycache__' -exec rm -rf {} +
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +

# Define PIP_COMPILE_OPTS=-v to get more information during make upgrade.
PIP_COMPILE = pip-compile --upgrade $(PIP_COMPILE_OPTS)

install: ## install the flow-control xblock
pip install .

requirements: ## fetch development requirements
pip install -r requirements/base.txt
pip install -qr requirements/pip-tools.txt

test: ## test using tox
pip install -r requirements/tox.txt
Expand All @@ -17,8 +36,18 @@ test: ## test using tox
upgrade: export CUSTOM_COMPILE_COMMAND=make upgrade
upgrade: ## update the pip requirements files to use the latest releases satisfying our constraints
pip install -r requirements/pip-tools.txt
pip-compile --rebuild --upgrade --allow-unsafe -o requirements/pip.txt requirements/pip.in
pip-compile --rebuild --upgrade -o requirements/pip-tools.txt requirements/pip-tools.in
pip install -qr requirements/pip.txt
pip-compile --rebuild --upgrade -o requirements/base.txt requirements/base.in
pip-compile --rebuild --upgrade -o requirements/test.txt requirements/test.in
pip-compile --rebuild --upgrade -o requirements/tox.txt requirements/tox.in
pip-compile --rebuild --upgrade -o requirements/quality.txt requirements/quality.in
pip-compile --rebuild --upgrade -o requirements/ci.txt requirements/ci.in
pip-compile --rebuild --upgrade -o requirements/dev.txt requirements/dev.in

test-python: clean ## Run test suite.
$(TOX) pip install -r requirements/base.txt --exists-action w
$(TOX) coverage run --source="." -m pytest ./flow_control_xblock

run-tests: test-python quality
23 changes: 10 additions & 13 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,16 @@ XBlock Flow Control

The Flow Control XBlock provides a way to display the content of a unit or to redirect the user elsewhere based on compliance with a condition that evaluates the submission or the score of a problem or a set of problems.

Installing on Open edX Devstack
-------------------------------

Inside both LMS and Studio shells, using `make lms-shell` and `make studio-shell` in your devstack directory do::

pip install flow-control-xblock

However, if you want to further develop this XBlock, you might want to instead clone this repository and do::

pip install -e path/to/flow-control

⚠️ Since the Open edX Olive release, some features could fail because of the integration of [Learning MFE](https://github.com/eduNEXT/frontend-app-learning).
Compatibility Notes
===================

+------------------+--------------+
| Open edX Release | Version |
+==================+==============+
| Redwood | >= 2.0.0 |
+------------------+--------------+
| Sumac | >= 2.0.0 |
+------------------+--------------+

Enabling in Studio
------------------
Expand Down Expand Up @@ -83,7 +80,7 @@ Features include
**Actions:** This actions can be applied when a condition is met:

* Display a message
* Redirect to another unit in the same subsection (without reloading the page)
* Redirect to another unit in the same subsection (without reloading the page) :warning:[DEPRECATED: Since version 2.0.0 and not working with the Learning MFE]
* Redirect to another unit using jump_to_id (reloading the page)
* Redirect to a given url

Expand Down
2 changes: 1 addition & 1 deletion flow_control/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
Init for main Flow-Control XBlock
"""
from .flow import FlowCheckPointXblock
__version__ = '1.0.1'
__version__ = '2.0.0'
27 changes: 27 additions & 0 deletions flow_control/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""
Flow Control Django application initialization.
"""

from django.apps import AppConfig


class FlowControlConfig(AppConfig):
"""
Configuration for the Flow Control Django application.
"""
name = "flow_control"

plugin_app = {
"settings_config": {
"lms.djangoapp": {
"common": {"relative_path": "settings.common"},
"test": {"relative_path": "settings.test"},
"production": {"relative_path": "settings.production"},
},
"cms.djangoapp": {
"common": {"relative_path": "settings.common"},
"test": {"relative_path": "settings.test"},
"production": {"relative_path": "settings.production"},
},
}
}
Empty file.
Empty file.
15 changes: 15 additions & 0 deletions flow_control/edxapp_wrapper/backends/score_s_v1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
Score module definitions for Open edX Sumac release.
"""
# pylint: disable=import-error
from lms.djangoapps.courseware.model_data import ScoresClient


def get_score_module(*args, **kwargs):
"""
Get ScoresClient model.
Returns:
ScoresClient: ScoresClient object.
"""
return ScoresClient(*args, **kwargs)
18 changes: 18 additions & 0 deletions flow_control/edxapp_wrapper/score.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""
Score module generalized definitions.
"""

from importlib import import_module
from django.conf import settings


def get_score_module_function(*args, **kwargs):
"""Get ScoreModule model."""

backend_function = settings.FLOW_CONTROL_SCORE_MODULE_BACKEND
backend = import_module(backend_function)

return backend.get_score_module(*args, **kwargs)


score_module = get_score_module_function
Loading

0 comments on commit df12bae

Please sign in to comment.