Skip to content

Commit

Permalink
Merge pull request #99 from learningequality/casing_matters
Browse files Browse the repository at this point in the history
Use uppercase for constant variable names.
  • Loading branch information
rtibbles authored Dec 16, 2021
2 parents bdba056 + 31d2bd6 commit fefdb53
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 30 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/finalized_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,24 @@ on: [push, pull_request]

jobs:
change_check:
name: Path match check
name: Check if file changed
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
not_modified: ${{ steps.skip_check.outputs.should_skip }}
modified: ${{ steps.changes.outputs.modified }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
- name: Checkout repository
uses: actions/checkout@v2
with:
github_token: ${{ github.token }}
paths: '["spec/labels-v1.json"]'
fetch-depth: 0
- id: changes
# Set outputs using the command.
run: |
echo "::set-output name=modified::$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep spec/labels-v1.json$ | xargs)"
unit_test:
name: Error if finalized spec modified
needs: change_check
if: ${{ needs.change_check.outputs.not_modified != 'true' }}
if: ${{ needs.change_check.outputs.modified }}
runs-on: ubuntu-18.04
steps:
- name: Fail if specs modified
Expand Down
10 changes: 5 additions & 5 deletions js/CompletionCriteria.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
// CompletionCriteria

export default {
approx_time: "approx_time",
mastery: "mastery",
pages: "pages",
reference: "reference",
time: "time",
APPROX_TIME: "approx_time",
MASTERY: "mastery",
PAGES: "pages",
REFERENCE: "reference",
TIME: "time",
};
2 changes: 1 addition & 1 deletion js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "0.1.35"
"version": "0.1.36"
}
30 changes: 15 additions & 15 deletions le_utils/constants/completion_criteria.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@

# CompletionCriteria

approx_time = "approx_time"
mastery = "mastery"
pages = "pages"
reference = "reference"
time = "time"
APPROX_TIME = "approx_time"
MASTERY = "mastery"
PAGES = "pages"
REFERENCE = "reference"
TIME = "time"

choices = (
(approx_time, "Approx Time"),
(mastery, "Mastery"),
(pages, "Pages"),
(reference, "Reference"),
(time, "Time"),
(APPROX_TIME, "Approx Time"),
(MASTERY, "Mastery"),
(PAGES, "Pages"),
(REFERENCE, "Reference"),
(TIME, "Time"),
)

COMPLETIONCRITERIALIST = [
approx_time,
mastery,
pages,
reference,
time,
APPROX_TIME,
MASTERY,
PAGES,
REFERENCE,
TIME,
]
2 changes: 1 addition & 1 deletion scripts/generate_from_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def read_constants_specs():
constants_spec = json.load(json_constants_spec_file)
key = snake_to_pascal(constants_spec_file.split("-")[-1].split(".")[0])
constants_outputs[key] = OrderedDict(
[(a, a) for a in sorted(constants_spec)]
[(a.upper(), a) for a in sorted(constants_spec)]
)
return constants_outputs

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
setup(
name="le-utils",
packages=find_packages(),
version="0.1.35",
version="0.1.36",
description="LE-Utils contains shared constants used in Kolibri, Ricecooker, and Kolibri Studio.",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit fefdb53

Please sign in to comment.