Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix badge date 248 #278

Merged
merged 7 commits into from
Jun 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.DS_Store
*/.python-version
api.log
14 changes: 7 additions & 7 deletions backend/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ verify_ssl = true
name = "pypi"

[packages]
alembic = "==0.9.6"
alembic = "==1.0.10"
Flask-Migrate = "==2.1.1"
Flask-Script = "==2.0.6"
Flask-SQLAlchemy = "==2.3.2"
Flask-SQLAlchemy = "==2.4.0"
gunicorn = "==19.7.1"
"psycopg2-binary" = "==2.7.5"
pyflakes = "==1.6.0"
requests = "==2.18.4"
SQLAlchemy = "==1.1.14"
"urllib3" = "==1.22"
requests = "==2.22.0"
SQLAlchemy = "==1.3.3"
"urllib3" = "==1.25.2"
Flask-Cors = "==3.0.6"
flask-script = "==2.0.6"
sqlalchemy-utils = "==0.33.5"
sqlalchemy-utils = "==0.33.11"
flask = "==1.0.2"
pyjwt = "==1.4.2"
pyjwt = "==1.7.1"
bcrypt = "==3.1.4"
"testing.postgresql" = "==1.3.0"

Expand Down
315 changes: 154 additions & 161 deletions backend/Pipfile.lock

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion backend/api/models/Badge.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from api.models import Quiz
from api.models.Year import Year

# this file and the classes in it do not correspond to a table in the Database

Expand All @@ -20,14 +21,16 @@ def can_receive(self, user, quiz_result):
return user.progress >= self.quantity

def serialize_to_json(self):
if len(Year.query.all()) == 0:
raise ValueError("Year not initialized")
return {
"id": self.id,
"title": self.title,
"progress_text": self.progress_text,
"description": self.description,
"congrats_text": self.congrats_text,
"graphic": self.graphic,
"year": 2018, # if we get a table in to track current year we need to use that
"year": Year.query.get(1).year,
}


Expand Down
4 changes: 3 additions & 1 deletion backend/api/models/User.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ def decode_auth_token(auth_token):
:param auth_token:
:return: integer|string
"""
payload = jwt.decode(auth_token, current_app.config.get("SECRET_KEY"))
payload = jwt.decode(
auth_token, current_app.config.get("SECRET_KEY"), algorithms="HS256"
)
return payload["sub"]
# try:
# payload = jwt.decode(auth_token, current_app.config.get("SECRET_KEY"))
Expand Down
1 change: 0 additions & 1 deletion backend/docker_script.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
#! /bin/bash
python manage.py recreate_db
python manage.py runserver
17 changes: 9 additions & 8 deletions backend/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
-i https://pypi.python.org/simple
appdirs==1.4.3
atomicwrites==1.2.1; python_version >= '2.7'
attrs==18.2.0
atomicwrites==1.3.0
attrs==19.1.0
black==18.6b4
click==7.0; python_version != '3.1.*'
click==7.0
flake8==3.5.0
mccabe==0.6.1
more-itertools==4.3.0
more-itertools==7.0.0
mypy-extensions==0.4.1
mypy==0.630
pluggy==0.8.0; python_version != '3.2.*'
py==1.7.0; python_version != '3.2.*'
pluggy==0.11.0
py==1.8.0
pycodestyle==2.3.1
pyflakes==1.6.0
pytest==3.8.2
six==1.11.0
six==1.12.0
toml==0.10.0
typed-ast==1.1.0
typed-ast==1.1.2

45 changes: 23 additions & 22 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
-i https://pypi.python.org/simple
alembic==0.9.6
alembic==1.0.10
bcrypt==3.1.4
certifi==2018.10.15
cffi==1.11.5; python_version != '3.0.*'
certifi==2019.3.9
cffi==1.12.3
chardet==3.0.4
click==7.0; python_version != '3.1.*'
click==7.0
flask-cors==3.0.6
flask-migrate==2.1.1
flask-script==2.0.6
flask-sqlalchemy==2.3.2
flask-sqlalchemy==2.4.0
flask==1.0.2
gunicorn==19.7.1
idna==2.6
itsdangerous==1.1.0; python_version != '3.1.*'
jinja2==2.10
mako==1.0.7
markupsafe==1.1.0; python_version != '3.1.*'
pg8000==1.12.3
psycopg2==2.7.5
pycparser==2.19; python_version != '3.0.*'
idna==2.8
itsdangerous==1.1.0
jinja2==2.10.1
mako==1.0.10
markupsafe==1.1.1
passlib==1.7.1
pg8000==1.13.1
psycopg2-binary==2.7.5
pycparser==2.19
pyflakes==1.6.0
pyjwt==1.4.2
python-dateutil==2.7.5
python-editor==1.0.3
requests==2.18.4
six==1.11.0
sqlalchemy-utils==0.33.5
sqlalchemy==1.1.14
pyjwt==1.7.1
python-dateutil==2.8.0
python-editor==1.0.4
requests==2.22.0
six==1.12.0
sqlalchemy-utils==0.33.11
sqlalchemy==1.3.3
testing.common.database==2.0.3
testing.postgresql==1.3.0
urllib3==1.22
werkzeug==0.14.1
urllib3==1.25.2
werkzeug==0.15.4
3 changes: 2 additions & 1 deletion docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ services:
- POSTGRES_DB=${POSTGRES_DB}
volumes:
- flask-app-db:/var/lib/postgresql/data
- ./testdb_seed:/docker-entrypoint-initdb.d/testdb_seed.sql
ports:
- 5432:5432
- 5431:5432
client:
build:
dockerfile: Dockerfile.dev
Expand Down
Loading