Skip to content

Commit

Permalink
Merge pull request #32 from stvstnfrd/hawthorn/wip
Browse files Browse the repository at this point in the history
Merge hawthorn
  • Loading branch information
kluo authored Sep 19, 2019
2 parents a753ff5 + 702a2d6 commit 02dbd93
Show file tree
Hide file tree
Showing 692 changed files with 20,184 additions and 219,038 deletions.
5 changes: 1 addition & 4 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,4 @@ branch = True
[report]
include = openassessment/*
omit =
**/__init__.py
**/tests/*
**/test/*
**/migrations/*
*/migrations/*
3 changes: 2 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
"XBlock",

// ORA-specific globals
"OpenAssessment"
"OpenAssessment",
"rewriteStaticLinks"
]
}
44 changes: 16 additions & 28 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,31 @@
addons:
apt:
packages:
- aspell
- aspell-en
- g++
- gcc
- git
- gfortran
- libblas3gf
- libblas-dev
- liblapack3gf
- liblapack-dev
- libatlas-base-dev
- libfontconfig1
- libmysqlclient-dev
- libxml2-dev
- libxslt1-dev
- nodejs
- python2.7
- python2.7-dev
- python-pip
- python-software-properties
language: python
sudo: false
python:
- "2.7"
env:
- TOXENV=django111
matrix:
include:
- python: 2.7
env: TOXENV=quality
- python: 2.7
env: TOXENV=js
before_install:
- "pip install -U pip"
- export BOTO_CONFIG=/dev/null
cache:
directories:
- $HOME/.cache/pip
install:
- "pip install coveralls"
- "make install"
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- "pip install tox"
script:
- "make verify-generated-files"
- "make test"
- "python manage.py makemessages -l eo"
- tox
branches:
only:
- master
- ora-staff-grading
after_success:
coveralls
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
include LICENSE
include AUTHORS
include README.rst
include setup.cfg
include openassessment/xblock/static/css/*.css
include openassessment/xblock/static/css/lib/backgrid/*.css
include openassessment/xblock/static/js/openassessment*.min.js
include openassessment/xblock/static/js/lib/backgrid/*.js
include requirements/*.txt
recursive-include openassessment/xblock/static/js/src *.js
recursive-include openassessment/templates *.html *.underscore
recursive-include openassessment/locale *.po
recursive-include openassessment/locale *.mo
global-exclude */test*
global-exclude */test?/*
96 changes: 55 additions & 41 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,64 +1,82 @@
all: install test

.PHONY: install test

# not used by travis
install-system:
sudo apt-get update -qq
sudo xargs -a apt-packages.txt apt-get install -qq --fix-missing

# not used by travis
install-node:
sudo apt-get install -qq nodejs

install-wheels:
./scripts/install-wheels.sh


##################
# Install commands
##################
install-python:
./scripts/install-python.sh
pip install -r requirements/django.txt
pip install -r requirements/base.txt --only-binary=lxml,libsass

install-js:
npm install

install-nltk-data:
./scripts/download-nltk-data.sh
install-test:
pip install -r requirements/test.txt

install: install-python install-js install-test javascript sass

##############################
# Generate js/css output files
##############################
STATIC_JS = openassessment/xblock/static/js
STATIC_CSS = openassessment/xblock/static/css

update-npm-requirements:
npm update --silent
cp ./node_modules/backgrid/lib/backgrid*.js $(STATIC_JS)/lib/backgrid/
cp ./node_modules/backgrid/lib/backgrid*.css $(STATIC_CSS)/lib/backgrid/

javascript: update-npm-requirements
node_modules/.bin/uglifyjs $(STATIC_JS)/src/oa_shared.js $(STATIC_JS)/src/*.js $(STATIC_JS)/src/lms/*.js $(STATIC_JS)/lib/backgrid/backgrid.min.js -c warnings=false > "$(STATIC_JS)/openassessment-lms.min.js"
node_modules/.bin/uglifyjs $(STATIC_JS)/src/oa_shared.js $(STATIC_JS)/src/*.js $(STATIC_JS)/src/studio/*.js $(STATIC_JS)/lib/backgrid/backgrid.min.js -c warnings=false > "$(STATIC_JS)/openassessment-studio.min.js"
node_modules/.bin/uglifyjs $(STATIC_JS)/src/oa_shared.js $(STATIC_JS)/src/*.js $(STATIC_JS)/src/lms/*.js $(STATIC_JS)/lib/backgrid/backgrid.min.js > "$(STATIC_JS)/openassessment-lms.min.js"
node_modules/.bin/uglifyjs $(STATIC_JS)/src/oa_shared.js $(STATIC_JS)/src/*.js $(STATIC_JS)/src/studio/*.js $(STATIC_JS)/lib/backgrid/backgrid.min.js > "$(STATIC_JS)/openassessment-studio.min.js"

sass:
python scripts/compile_sass.py

verify-generated-files:
@git diff --quiet || (echo 'Modifications exist locally! Run `make javascript` or `make sass` to update bundled files.'; exit 1)
################
#Translations Handling
################
# creates the django-partial.po & django-partial.mo files
extract_translations:
python manage.py makemessages -l en -v1 --ignore=".tox/*" --ignore="build/*" --ignore="docs/*" --ignore="edx-ora2/*" --ignore="logs/*" --ignore="node_modules/*" --ignore="performance/*" --ignore="requirements/*" --ignore="scripts/*" --ignore="settings/*" --ignore="storage/*" -d django
python manage.py makemessages -l en -v1 --ignore=".tox/*" --ignore="build/*" --ignore="docs/*" --ignore="edx-ora2/*" --ignore="logs/*" --ignore="node_modules/*" --ignore="performance/*" --ignore="requirements/*" --ignore="scripts/*" --ignore="settings/*" --ignore="storage/*" -d djangojs

install-test:
pip install -q -r requirements/test.txt
# compiles the *.po & *.mo files
compile_translations:
cd ./openassessment/ && i18n_tool generate -v && cd ..

install-sys-requirements: install-system install-node
npm config set loglevel warn
# generate dummy translations
generate_dummy_translations:
i18n_tool dummy

install-dev:
pip install -q -r requirements/dev.txt
# Test translation files
validate_translations:
cd ./openassessment/ && i18n_tool validate -v

install: install-wheels install-python install-js install-nltk-data install-test install-dev javascript sass
# check if translation files are up-to-date
detect_changed_source_translations:
i18n_tool changed

# pull translations from Transifex
pull_translations:
cd ./openassessment/ && tx pull -af --mode reviewed --minimum-perc=1

# push source translation files (.po) to Transifex
push_translations:
tx push -s

# extract, compile, and check if translation files are up-to-date
check_translations_up_to_date: extract_translations compile_translations generate_dummy_translations detect_changed_source_translations

################
#Tests and checks
################
quality:
./node_modules/.bin/jshint $(STATIC_JS)/src -c .jshintrc --verbose
./node_modules/jscs/bin/jscs $(STATIC_JS)/src --verbose
./scripts/run-pep8.sh
./scripts/run-pylint.sh

test: quality test-python test-js

test-python:
./scripts/test-python.sh
coverage run manage.py test openassessment

render-templates:
./scripts/render-templates.sh
Expand All @@ -69,17 +87,13 @@ test-js: render-templates
test-js-debug: render-templates
./scripts/js-debugger.sh

test-sandbox: test-acceptance test-a11y
test: quality test-python test-js

# acceptance and a11y tests require a functioning sandbox, and do not run on travis
test-acceptance:
./scripts/test-acceptance.sh tests

test-a11y:
./scripts/test-acceptance.sh accessibility

update-npm-requirements:
npm update --silent
cp ./node_modules/backgrid/lib/backgrid*.js $(STATIC_JS)/lib/backgrid/
cp ./node_modules/backgrid/lib/backgrid*.css $(STATIC_CSS)/lib/backgrid/
sed -i 's/\["underscore"/"backgrid", &/' $(STATIC_JS)/lib/backgrid/backgrid.js
sed -i 's/\["underscore"/"backgrid",&/' $(STATIC_JS)/lib/backgrid/backgrid.min.js
test-sandbox: test-acceptance test-a11y
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Open Response Assessment |build-status| |coverage-status|
Installation, Tests, and other Developer Tasks
==============================================

EdX engineers follow the `guides on our wiki <https://openedx.atlassian.net/wiki/display/EDUCATOR/ORA+FAQ>`_.
EdX engineers follow the `guides on our wiki <https://openedx.atlassian.net/wiki/spaces/EDUCATOR/pages/9765004/ORA+Developer+Guide>`_.

License
=======
Expand Down
20 changes: 0 additions & 20 deletions apt-packages.txt

This file was deleted.

7 changes: 0 additions & 7 deletions logs/README.txt

This file was deleted.

2 changes: 1 addition & 1 deletion manage.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
import sys
import os
import sys

if __name__ == "__main__":

Expand Down
48 changes: 4 additions & 44 deletions openassessment/assessment/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@
import json

from django.contrib import admin
from django.core.urlresolvers import reverse
from django.core.urlresolvers import reverse_lazy
from django.utils import html

from openassessment.assessment.models import (
Assessment, AssessmentFeedback, PeerWorkflow, PeerWorkflowItem, Rubric,
AIGradingWorkflow, AITrainingWorkflow, AIClassifierSet, AIClassifier
)
from openassessment.assessment.models import Assessment, AssessmentFeedback, PeerWorkflow, PeerWorkflowItem, Rubric
from openassessment.assessment.serializers import RubricSerializer


Expand Down Expand Up @@ -92,7 +89,7 @@ def rubric_link(self, assessment_obj):
"""
Returns the rubric link for this assessment.
"""
url = reverse(
url = reverse_lazy(
'admin:assessment_rubric_change',
args=[assessment_obj.rubric.id]
)
Expand Down Expand Up @@ -141,7 +138,7 @@ def assessments_by(self, assessment_feedback):
"""
links = [
u'<a href="{}">{}</a>'.format(
reverse('admin:assessment_assessment_change', args=[asmt.id]),
reverse_lazy('admin:assessment_assessment_change', args=[asmt.id]),
html.escape(asmt.scorer_id)
)
for asmt in assessment_feedback.assessments.all()
Expand All @@ -150,44 +147,7 @@ def assessments_by(self, assessment_feedback):
assessments_by.allow_tags = True


class AIGradingWorkflowAdmin(admin.ModelAdmin):
"""
Django admin model for AIGradingWorkflows.
"""
list_display = ('uuid', 'submission_uuid')
search_fields = ('uuid', 'submission_uuid', 'student_id', 'item_id', 'course_id')
readonly_fields = ('uuid', 'submission_uuid', 'student_id', 'item_id', 'course_id')


class AITrainingWorkflowAdmin(admin.ModelAdmin):
"""
Django admin model for AITrainingWorkflows.
"""
list_display = ('uuid',)
search_fields = ('uuid', 'course_id', 'item_id',)
readonly_fields = ('uuid', 'course_id', 'item_id',)


class AIClassifierInline(admin.TabularInline):
"""
Django admin model for AIClassifiers.
"""
model = AIClassifier


class AIClassifierSetAdmin(admin.ModelAdmin):
"""
Django admin model for AICLassifierSets.
"""
list_display = ('id',)
search_fields = ('id',)
inlines = [AIClassifierInline]


admin.site.register(Rubric, RubricAdmin)
admin.site.register(PeerWorkflow, PeerWorkflowAdmin)
admin.site.register(Assessment, AssessmentAdmin)
admin.site.register(AssessmentFeedback, AssessmentFeedbackAdmin)
admin.site.register(AIGradingWorkflow, AIGradingWorkflowAdmin)
admin.site.register(AITrainingWorkflow, AITrainingWorkflowAdmin)
admin.site.register(AIClassifierSet, AIClassifierSetAdmin)
Loading

0 comments on commit 02dbd93

Please sign in to comment.