Giter Site home page Giter Site logo

ucfopen / due-date-changer Goto Github PK

View Code? Open in Web Editor NEW
9.0 8.0 3.0 148 KB

An LTI that allows a user to easily change due dates for multiple assignments simultaneously.

License: MIT License

Python 66.91% Ruby 0.14% Shell 0.31% CSS 2.86% Jinja 29.78%
canvas-lms canvas lti instructure a11y accessibility education edtech

due-date-changer's Introduction

Build Status Coverage Status Join UCF Open Slack Discussions Code style: black

Due Date Changer

Deploy

An LTI that allows a user to easily change due dates for multiple assignments simultaneously.

Table of Contents

Installation

Clone the repository

# clone via SSH
git clone [email protected]:ucfopen/due-date-changer.git
# clone via HTTPS
git clone https://github.com/ucfopen/due-date-changer.git

Switch into the new directory

cd due-date-changer

Create the config file from the template

cp config.py.template config.py

Fill in the config file

# -*- coding: utf-8 -*-

from __future__ import unicode_literals

DEBUG = False
SECRET_KEY = 'JbwLnLgsfxDInozQudc6IFPe0eYecW8f'

ALLOWED_CANVAS_DOMAINS = ['example.com', 'example.edu']

CANVAS_URL = 'https://example.instructure.com'
API_KEY = 'p@$$w0rd'

PYLTI_CONFIG = {
    'consumers': {
        'consumer_key': {
            'secret': b'shared_secret'
        }
    },
    'roles': {
        'staff': [
            'urn:lti:instrole:ims/lis/Administrator',
            'Instructor',
            'ContentDeveloper',
            'urn:lti:role:ims/lis/TeachingAssistant'
        ]
    }
}

TIME_ZONE = 'US/Eastern'
LOCAL_TIME_FORMAT = '%m/%d/%Y %I:%M %p'

LOG_FILE = 'due_date_changer.log'
LOG_FORMAT = '%(asctime)s [%(levelname)s] {%(filename)s:%(lineno)d} %(message)s'
LOG_LEVEL = 'DEBUG'
LOG_MAX_BYTES = 1024 * 1024 * 5  # 5 MB
LOG_BACKUP_COUNT = 1

Create a virtual environment

virtualenv -p python2.7 env

Source the environment

source env/bin/activate

Alternatively, use the setup script

source setup.sh

Install required packages

  • If you want to be able to run tests:

    pip install -r test_requirements.txt
  • Otherwise,

    pip install -r requirements.txt

Development Server

If you haven't already, activate the virtual environment and set up Flask environment variables.

source env/bin/activate
export FLASK_APP=lti.py
export FLASK_DEBUG=1

Alternatively, use the setup script

source setup.sh

Run the Flask development server.

flask run --with-threads

Check the status page at /status (http://127.0.0.1:5000/status by default) to see if everything is working properly.

Note: for the status page to work, the app must be run with threading enabled.

Production Server

Due Date Changer is tested to run NGINX and uWSGI, but can also work on Apache and mod_wsgi.

NGINX

nginx.conf

In your nginx.conf file, place these lines under the server{} section with the appropriate changes

location /due_date_changer/static {
    alias /path/to/due_date_changer/static/;
}


location /due_date_changer {
    root html;
    include uwsgi_params;

    uwsgi_param                  UWSGI_SCHEME https; # Set to https is behind load balancer, else http
    uwsgi_param                  SCRIPT_NAME /due_date_changer;
    uwsgi_modifier1              30;
    uwsgi_pass                   127.0.0.1:9000;  #set to any number above 9000 that isn't in use.
    uwsgi_read_timeout           300;
    uwsgi_connect_timeout        300;
    uwsgi_send_timeout           300;
    proxy_redirect               off;
    proxy_set_header             Host $host;
    proxy_set_header             X-Real-IP $remote_addr;
    proxy_set_header             X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header             X-Forwarded-Host example.com; #Add your domain here.
}

UWSGI

/etc/uwsgi/sites-enabled/due_date_changer.ini

[uwsgi]
# uwsgi process runs as user:group
uid = nginx
gid = nginx

# Number of worker processes
processes = 6

chdir = /path/to/due_date_changer/
venv = /path/to/due_date_changer/env


socket = 127.0.0.1:9000 #Same Socket number as above

# Respawn slow processes
harakiri=60
harakiri-verbose=True

master=True

# name of wsgi file in the chdir dir above without the .py extension
wsgi-file = wsgi.py

# Background the process (and allow it to log!)
daemonize = /var/log/uwsgi/app.log

# Reload the uwsgi process if the wsgi file is touched
touch-reload = /path/to/due_date_changer/wsgi.py

#testing saveSnapshot fix
buffer-size=16384
#post-buffering=1

#stats
stats = /tmp/wsgi.py.socket

Contact Us

Need help? Have an idea? Just want to say hi? Come join us on the UCF Open Slack Channel and join the #due-date-changer channel!

due-date-changer's People

Contributors

ssilverm avatar thetwam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

due-date-changer's Issues

Setup Continuous Integration

We should set up a CI pipeline (probably Travis) to run linters and tests. This will help catch easily-avoidable regressions like #24.

Also look into coverage reporting via a tool like Coveralls

Changes Not Applying

Describe the bug

We've received reports from an instructor that when they go to update the dates for quizzes, the due dates don't change.

I am awaiting a response from the instructor with more details

Known Issue: Safari losing session on different domain

Safari won't save session cookies between pages on an iframe LTI that is hosted on a domain that is different from the parent window.

ie: duedatechanger.heroku.com loaded from canvas.myuniversity.edu won't work, BUT,

duedatechanger.myuniversity.edu loaded from canvas.myuniversity.edu WILL.

Ungraded Surveys and Practice Quizzes

DDC does not currently work with Ungraded Surveys and Practice Quizzes.

This presumably is because the tool is only looking at gradable assignments.

Add support for Ungraded Surveys and Practice Quizzes

Python 3

Update the tool to use the latest version of Python 3

Error after updating to latest version. 'Request' object has no attribute 'is_xhr'

Hello After updating to the latest version to get the chrome 80 cookies fix, we started noticing a 500 error when updating assignments. Here's the trace:

Traceback (most recent call last):
File "/ddchanger/env/local/lib/python2.7/site-packages/flask/app.py", line 2446, in wsgi_app
  response = self.full_dispatch_request()
File "/ddchanger/env/local/lib/python2.7/site-packages/flask/app.py", line 1951, in full_dispatch_request
  rv = self.handle_user_exception(e)
File "/ddchanger/env/local/lib/python2.7/site-packages/flask/app.py", line 1820, in handle_user_exception
  reraise(exc_type, exc_value, tb)
File "/ddchanger/env/local/lib/python2.7/site-packages/flask/app.py", line 1949, in full_dispatch_request
  rv = self.dispatch_request()
File "/ddchanger/env/local/lib/python2.7/site-packages/flask/app.py", line 1935, in dispatch_request
  return self.view_functions[rule.endpoint](**req.view_args)
File "/ddchanger/env/src/pylti/pylti/flask.py", line 385, in wrapper
  return function(*args, **kwargs)
File "/ddchanger/lti.py", line 189, in update_assignments
  if not request.is_xhr:
File "/ddchanger/env/local/lib/python2.7/site-packages/werkzeug/local.py", line 347, in __getattr__
  return getattr(self._get_current_object(), name)
AttributeError: 'Request' object has no attribute 'is_xhr'

To make it work I had to comment this line in lti.py that checks if the request is an ajax request.

While troubleshooting, I found that this was removed from the werkzeug package in v1.0.0.

Unclear error message for an issue with a due date

When updating the due dates for a lot of quizzes/assignments and a due date is after a availability date an error message comes up. However, the error message referrers to an ID # which does not show by the quizzes/assignments so there is no clear way to determine which one has the issue. See attached for the error message.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.