cjlee112 / socraticqs2

courselets.org web service implementation
Apache License 2.0
6 stars 10 forks source link

Socraticqs2

.. image:: https://coveralls.io/repos/github/cjlee112/socraticqs2/badge.svg?branch=master :target: https://coveralls.io/github/cjlee112/socraticqs2?branch=master

.. image:: https://codecov.io/gh/cjlee112/socraticqs2/branch/master/graph/badge.svg :target: https://codecov.io/gh/cjlee112/socraticqs2

.. image:: https://circleci.com/gh/raccoongang/socraticqs2/tree/development.svg?style=svg :target: https://circleci.com/gh/raccoongang/socraticqs2/tree/development

Socraticqs2 is the web engine for courselets.org.

Local development environment

To run project locally ::

make run

To develop/debug project locally ::

make debug

To build project locally ::

make build

To run tests: ::

make test

To stop containers: ::

make stop

To clean/rm containers: ::

make rm

To run production/staging environment locally: ::

make run env=stage

To build production/staging environment locally: ::

make build env=stage

Build node packages locally: ::

make local_node

CI/CD

CI/CD configuration is described by .gitlab-ci.yml_ file.

.. _.gitlab-ci.yml: ./.gitlab-ci.yml

Current deployment scheme is the following:

There is a helper that creates a tag for you: ::

make version VERSION=vX.X.X

Developer documentation is available at http://cjlee112.github.io/socraticqs2

For a developer / test version to access social-auth, you will need to add the following social-auth keys to settings/local_conf.py in your development install: ::

# coding: utf-8

SOCIAL_AUTH_TWITTER_KEY = 'key'
SOCIAL_AUTH_TWITTER_SECRET = 'secret'

SOCIAL_AUTH_FACEBOOK_KEY = 'key'
SOCIAL_AUTH_FACEBOOK_SECRET = 'secret'

SOCIAL_AUTH_LINKEDIN_OAUTH2_KEY = 'key'
SOCIAL_AUTH_LINKEDIN_OAUTH2_SECRET = 'secret'

SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = 'key'
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = 'secret'

SOCIAL_AUTH_KHANACADEMY_OAUTH1_KEY = 'key'
SOCIAL_AUTH_KHANACADEMY_OAUTH1_SECRET = 'secret'

# When we will use email auth we need to define SMTP settings
EMAIL_USE_TLS = True
EMAIL_HOST = ''
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_PORT = 587
EMAIL_FROM = ''

#We can re-define auth backend(s)
AUTHENTICATION_BACKENDS = (
   # 'social.backends.twitter.TwitterOAuth',
   # 'social.backends.facebook.FacebookOAuth2',
   # 'social.backends.google.GoogleOAuth2',
   # 'social.backends.linkedin.LinkedinOAuth2',
   # 'social.backends.khanacademy.KhanAcademyOAuth1',
   # 'psa.custom_backends.EmailAuth',
   'django.contrib.auth.backends.ModelBackend',
)

To install requirements: ::

pip install -r requirements/dev.txt

Download GeoIp database (run commands in the root of the project): ::

wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gunzip GeoLiteCity.dat.gz

To run project in Docker:

Go to the root of the project and run this command: ::

docker-compose up courselets

Here we have 2 docker config files:

There are a couple of files related to docker. They are:

New Interactions Features:

Multiple Choices Feature:

How to test this functionality:

To create unit with multiple choices:

::

[choices] () a (*) b () c () d

Where: not correct answer is empty parenthes () and correct answer is (*)

Equation Feature:

To create a thread with numbers answer (and grading):

Numbers Feature:

To create a thread with numbers answer (and grading):

Canvas Feature:

To create a thread with canvas answer:

Quality check

We can check code quality using ./check-quality.sh {pep8|pylint} {lti|psa|fsm|ct|mysite|all} script. We encourage you to run this script before each commit.

Feature Switches

We can switch on and switch off different features. By default all features are switched off. Here's a list of switches:

GitLab configuration

Need to set following secret variables:

Instructor Agreement

When user tries to go to CTMS page, but has no Instructor instance attached, user will not see page but will see the error message. Error 404, because user's who are not instructor has no access to this part of site.

That's why we created new page named Instructor Agreement, which should be added through admin CMS with custom content.

SES configuration

fill the following settings in order to have ability to send emails AWS_ACCESS_KEY_ID = '' AWS_SECRET_ACCESS_KEY = '' AWS_SES_REGION_NAME = '' AWS_SES_REGION_ENDPOINT = ''

Best Practices

Practice exam sample calculation config ::

{
  "bp_student_number": {
    "max": 500,
    "min": 0,
    "step": 1,
    "type": "number",
    "label": "How many student do you have in class?",
    "default": "200",
    "order": 0
  },
  "average_score": {
    "max": 100,
    "min": 0,
    "step": 1,
    "type": "number",
    "label": "What is the mean is percent score on a typical exam?",
    "default": "72",
    "subtype": "percent",
    "order": 1
  },
  "question_parts": {
    "max": 200,
    "min": 0,
    "step": 1,
    "type": "number",
    "label": "How many question-parts do you have in a typical exam?",
    "default": "24",
    "label_explanation": "e.g. 8 questions with 3 parts each = 24",
    "order": 2
  },
  "misconception_a_day": {
    "max": 500,
    "min": 0,
    "step": 1,
    "type": "number",
    "label": "How many individual student misconception do you fix in a typical exam?",
    "default": "5",
    "order": 3
  }
}

Field attributes ::

type: Field type (number, string, date)
order: order in the field list
min: min number value
max: max number value
step: step to increase/decrease number value
label: input value
label_explanation: additional text for label_explanation
default: default value