Skip to content

Commit

Permalink
Merge pull request #4683 from learningequality/0.15.x
Browse files Browse the repository at this point in the history
0.15.x to central-develop
  • Loading branch information
aronasorman committed Nov 24, 2015
2 parents d7cdc84 + dca97a9 commit dc56afc
Show file tree
Hide file tree
Showing 31 changed files with 294 additions and 183 deletions.
11 changes: 8 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ dist-packages-temp/
dist-packages-downloads/
dist-packages/

# Generated by kalite manage setup
secretkey.txt

# User cache data generated at runtime
cache/

Expand All @@ -48,13 +45,21 @@ static-updates
# Python compiling
*.pyc
*.pyo

# Backup files
*~

# Sublime editor
*.sublime-*

# Ignore all .zip files!? No comment?? Needs fixing, I guess it's to avoid
# committing local assessment items.
*.zip

# Documentation
docs/_build
docs/images/*
docs/kalite.1.gz

# oh-my-zsh convention for automatically
# switching on a venv
Expand Down
3 changes: 3 additions & 0 deletions MANIFEST.in.dist
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ recursive-include data *
# Necessary because it's a data directory so they
# do not get automatically excluded
recursive-exclude python-packages *pyc

# Docs
recursive-include docs/_build/html *
97 changes: 97 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
.PHONY: clean-pyc clean-build docs clean

help:
@echo "clean - remove all build, test, coverage and Python artifacts"
@echo "clean-build - remove build artifacts"
@echo "clean-pyc - remove Python file artifacts"
@echo "clean-test - remove test and coverage artifacts"
@echo "lint - check style with pep8"
@echo "test - run tests the default Python"
@echo "test-bdd - run BDD tests only"
@echo "test-nobdd - run non-BDD tests only"
@echo "assets - build all JS/CSS assets"
@echo "coverage - check code coverage quickly with the default Python"
@echo "docs - generate Sphinx HTML documentation, including API docs"
@echo "release - package and upload a release"
@echo "dist - package locally"
@echo "install - install the package to the active Python's site-packages"

clean: clean-build clean-pyc clean-test

clean-build:
rm -fr build/
rm -fr dist/
rm -fr .eggs/
rm -fr dist-packages/
rm -fr dist-packages-temp/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +

clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +

clean-test:
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/

lint:
pep8 kalite
jshint kalite/*/static/js/*/

test:
bin/kalite manage test --bdd-only

test-bdd:
bin/kalite manage test --bdd-only

test-nobdd:
bin/kalite manage test --no-bdd

test-all:
@echo "Not supported yet"
# tox

coverage:
coverage run --source kalite kalitectl.py test
coverage report -m

coverage-bdd:
coverage run --source kalite kalitectl.py test --bdd-only
coverage report -m

coverage-nobdd:
coverage run --source kalite kalitectl.py test --no-bdd
coverage report -m

docs:
# rm -f docs/ka-lite.rst
# rm -f docs/modules.rst
# sphinx-apidoc -o docs/ ka-lite-gtk
$(MAKE) -C docs clean
$(MAKE) -C docs html
cli2man bin/kalite -o docs/kalite.1.gz
# open docs/_build/html/index.html

assets:
# Necessary because NPM may have wrong versions in the cache
npm cache clean
npm install --production
node build.js
bin/kalite manage compileymltojson

release: clean docs assets
python setup.py sdist --formats=gztar,zip upload --sign
python setup.py sdist --formats=gztar,zip upload --sign --static
ls -l dist

dist: clean docs assets
python setup.py sdist
python setup.py sdist --static
ls -l dist

install: clean
python setup.py install
11 changes: 7 additions & 4 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,25 @@ dependencies:
override:
- pip install -r requirements_test.txt
- pip install -e .
- npm install
- npm install -g jshint
# This cannot be done because pip on Circle doesn't understand our sdist
# - make sdist
# - pip install dist/ka-lite-"$(python setup.py --version)".tar.gz
post:
- if [[ ! -e sc-latest-linux/bin/sc ]]; then wget https://saucelabs.com/downloads/sc-latest-linux.tar.gz && tar -xzf sc-latest-linux.tar.gz && mv sc-*-linux sc-latest-linux; fi

test:
override:
- node build.js
- make assets
- kalite start --settings=kalite.project.settings.disk_based_cache --traceback -v2
- kalite status
- kalite stop --traceback -v2
- cd sc-*-linux && ./bin/sc -u $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY --tunnel-identifier $CIRCLE_BUILD_NUM-$CIRCLE_NODE_INDEX --readyfile ~/sauce_is_ready > sc_output.txt 2>&1:
background: true
- while [ ! -e ~/sauce_is_ready ]; do sleep 1; done
- case $CIRCLE_NODE_INDEX in 0) kalite manage test --bdd-only ;; 1) kalite manage test --no-bdd;; esac:
- case $CIRCLE_NODE_INDEX in 0) make test-bdd ;; 1) make test-nobdd;; esac:
parallel: true
# TODO: replace below with "make link" when we're pep8
- npm install -g jshint
- jshint kalite/*/static/js/*/
post:
- killall --wait sc # wait for Sauce Connect to close the tunnel
1 change: 0 additions & 1 deletion data/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
students:
coaches: []
admins: []

bugs_fixed:
all:
Properly compare language pack versions (#4587).
Expand Down
49 changes: 31 additions & 18 deletions docs/installguide/install_all.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,50 @@ Windows
Upgrading KA Lite over an existing installation is easy -- just run the installer and follow the prompts!
You don't need to uninstall your old KA Lite installation first.

Mac/OSX
=======
Mac OS X
========

.. warning:: The latest OS X version (EL Capitan) is not yet supported.

**Note:** The latest OSX version (EL Capitan) is not yet supported.
Installation
____________

#. Download the KA Lite `OSX installer <https://learningequality.org/r/osx-installer-0-15>`_.
#. After the download is complete, double click the .dmg file.
#. Click the ``Agree`` button to accept the LICENSE agreement.
#. On the .dmg window, drag the ``KA-Lite Monitor`` app into the ``Applications`` folder.

.. note::
To upgrade an existing KA Lite installation, download the new installer and then drag it over to the "Applications"
folder to replace the existing "KA-Lite-Monitor" application.
Give confirmation to overwrite the existing app. Then proceed from this step as usual.
#. Launch ``KA-Lite Monitor`` from your ``Applications`` folder.
#. On first load, it will check your current environment and show the Preferences dialog.
#. Input your preferred admin username and password, then click the Apply button in ``KA-Lite Preferences`` dialog.
#. Input your preferred administrator username and password, then click the ``Apply`` button in ``KA-Lite Preferences`` dialog.
#. You will be prompted that initial setup will take a few minutes, click the ``OK`` button and wait for the notification that KA-Lite has been setup and can now be started.
#. Click on the KA-Lite logo icon on the Status Menu Bar and select the ``Start KA-Lite`` menu option.
#. Click on the KA-Lite logo icon on the menu bar and select the ``Start KA-Lite`` menu option.
#. Wait for the notification that you can now click on ``Open in Browser`` menu option.
#. Click on the KA-Lite logo icon on the Status Menu Bar and select ``Open in Browser`` menu option - this should launch KA-Lite in your preferred web browser.
#. Click on the KA-Lite logo icon on the menu bar and select ``Open in Browser`` menu option - this should launch KA-Lite in your preferred web browser.
#. Login using the administrator account you have specified during setup.

If the sidebar shows entries that are greyed-out, the child items of the entry may be videos that were not yet downloaded. If there are assessment items inside, then you need to extract the `assessment.zip` manually:
Upgrade
_______

To upgrade an existing KA Lite installation.

#. Download the KA Lite `OSX installer <https://learningequality.org/r/osx-installer-0-15>`_.
#. After the download is complete, double click the .dmg file.
#. Click the ``Agree`` button to accept the LICENSE agreement.
#. On the .dmg window, drag the ``KA-Lite Monitor`` app into the ``Applications`` folder.
#. Give confirmation to overwrite the existing app.
#. Launch ``KA-Lite Monitor`` from your ``Applications`` folder.
#. Click on the app icon at the menu bar.
#. Click on ``Preferences`` in the menu option.
#. Go to Advanced tab, click on the ``Extract Assessment`` button, then confirm the action.
#. Restart the server, login to the web app, then check the sidebar contents.

This will enable the greyed-out assessment items on the sidebar.
.. tip::
If the sidebar shows entries that are greyed-out, the child items of the entry may be videos that were not yet downloaded. If there are assessment items inside, then you need to extract the `assessment.zip` manually:

#. Launch ``KA-Lite Monitor`` from your ``Applications`` folder.
#. Click on the app icon at the menu bar.
#. Click on ``Preferences`` in the menu option.
#. Go to ``Advanced`` tab, click on the ``Extract Assessment`` button, then confirm the action.
#. Restart the server, login to the web app, then check the sidebar contents.

This will enable the greyed-out assessment items on the sidebar.


Linux
=====
Expand Down Expand Up @@ -93,7 +106,7 @@ It can be installed by downloading the latest .deb on the Pi and installing it::
# Install dependencies
sudo apt-get install python-m2crypto python-pkg-resources nginx python-psutil
# Fetch the latest .deb
sudo wget https://learningequality.org/r/deb-pi-installer-0-14 --no-check-certificate
sudo wget https://learningequality.org/r/deb-pi-installer-0-15 --no-check-certificate
# Install the .deb
sudo dpkg -i ka-lite-raspberry-pi*.deb

Expand Down
1 change: 1 addition & 0 deletions docs/installguide/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ General
Python 2.6 is no longer supported. It *may* still work, but we are no longer actively supporting it.
Other known issues:

* The latest OSX version (EL Capitan) is not yet supported.
* On OSX, you must restart the server after downloading videos in order for them to be marked as available.
* On all platforms, you must restart the server after downloading a language pack in order to use it.
* You can no longer configure your server using ``local_settings.py``. Instead, custom settings must appear in
Expand Down
3 changes: 3 additions & 0 deletions docs/installguide/system_requirements.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
System requirements
===================

.. note::
The latest OSX version (EL Capitan) is not yet supported.

Supported Browsers
------------------
KA Lite is currently *not* supported on Internet Explorer version 8 or lower. You must use IE9 or later.
Expand Down
10 changes: 5 additions & 5 deletions kalite/coachreports/api_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class CoachReportBaseResource(Resource):
"""
A base resource that houses shared code between the resources we actually use
A base resource that houses shared code between the resources we actually use
in the API
"""

Expand Down Expand Up @@ -54,7 +54,7 @@ class Meta:

def get_object_list(self, request):
user_id = request.GET.get('user_id')
result = PlaylistProgress.user_progress(user_id=user_id)
result = PlaylistProgress.user_progress(user_id=user_id, language=request.language)
return result

class PlaylistProgressDetailResource(CoachReportBaseResource):
Expand All @@ -72,8 +72,8 @@ class Meta:
def get_object_list(self, request):
user_id = request.GET.get("user_id")
playlist_id = request.GET.get("playlist_id")
result = PlaylistProgressDetail.user_progress_detail(user_id=user_id, playlist_id=playlist_id)
language = request.language
result = PlaylistProgressDetail.user_progress_detail(user_id=user_id, playlist_id=playlist_id, language=language)
if not result:
raise NotFound("User playlist progress details with user ID '%s' and playlist ID '%s' were not found." % (user_id, playlist_id))
raise NotFound("User playlist progress details with user ID '%s' and playlist ID '%s' were not found." % (user_id, playlist_id))
return result

8 changes: 5 additions & 3 deletions kalite/coachreports/api_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def return_log_type_details(log_type, topic_ids=None):
@require_admin
def learner_logs(request):

lang = request.language
page = request.GET.get("page", 1)

limit = request.GET.get("limit", 50)
Expand Down Expand Up @@ -100,7 +101,7 @@ def learner_logs(request):
topic_objects = log_objects.filter(latest_activity_timestamp__gte=start_date, latest_activity_timestamp__lte=end_date)
if topic_objects.count() == 0:
topic_objects = log_objects
objects = dict([(obj[id_field], get_content_cache().get(obj[id_field], get_exercise_cache().get(obj[id_field]))) for obj in topic_objects]).values()
objects = dict([(obj[id_field], get_content_cache(language=lang).get(obj[id_field], get_exercise_cache(language=lang).get(obj[id_field]))) for obj in topic_objects]).values()
output_objects.extend(objects)
output_logs.extend(log_objects)

Expand All @@ -122,6 +123,7 @@ def learner_logs(request):
@require_admin
def aggregate_learner_logs(request):

lang = request.language
learners = get_learners_from_GET(request)

event_limit = request.GET.get("event_limit", 10)
Expand All @@ -144,7 +146,7 @@ def aggregate_learner_logs(request):
"exercise_attempts": 0,
"exercise_mastery": None,
}

end_date = datetime.datetime.strptime(end_date,'%Y/%m/%d') if end_date else datetime.datetime.now()

start_date = datetime.datetime.strptime(start_date,'%Y/%m/%d') if start_date else end_date - datetime.timedelta(time_window)
Expand Down Expand Up @@ -179,7 +181,7 @@ def aggregate_learner_logs(request):
"complete": log.complete,
"struggling": getattr(log, "struggling", None),
"progress": getattr(log, "streak_progress", getattr(log, "progress", None)),
"content": get_exercise_cache().get(getattr(log, "exercise_id", ""), get_content_cache().get(getattr(log, "video_id", getattr(log, "content_id", "")), {})),
"content": get_exercise_cache(language=lang).get(getattr(log, "exercise_id", "")) or get_content_cache(language=lang).get(getattr(log, "video_id", None) or getattr(log, "content_id", "")) or {}
} for log in output_logs[:event_limit]]
output_dict["total_time_logged"] = round((UserLogSummary.objects\
.filter(user__in=learners, start_datetime__gte=start_date, start_datetime__lte=end_date)\
Expand Down
Loading

0 comments on commit dc56afc

Please sign in to comment.