Skip to content

Commit

Permalink
Fix some important typos
Browse files Browse the repository at this point in the history
  • Loading branch information
spurll committed Nov 1, 2018
1 parent 218964a commit 97a2bb1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions goodplays/authenticate.py
Expand Up @@ -2,8 +2,8 @@
from json import loads
import requests

from template import app
from template.models import User
from goodplays import app
from goodplays.models import User


def authenticate(username, password):
Expand Down
15 changes: 7 additions & 8 deletions goodplays/models.py
Expand Up @@ -4,6 +4,7 @@


class User(db.Model):
__tablename__ = 'User'
id = db.Column(db.String, primary_key=True)
name = db.Column(db.String, index=True, unique=True)
email = db.Column(db.String, index=True)
Expand Down Expand Up @@ -55,6 +56,7 @@ def __repr__(self):


class Platform(db.Model):
__tablename__ = 'Platform'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String, unique=True)
games = db.relationship(
Expand All @@ -70,6 +72,7 @@ def __repr__(self):


class Game(db.Model):
__tablename__ = 'Game'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String)
year = db.Column(db.Integer)
Expand All @@ -96,12 +99,8 @@ def __repr__(self):
)


# TODO: Seems like there's circular table dependency issue or something.
# Try to resolve it. If you can't, get rid of the secondaries and create some
# intermediate link table classes manually.


class Tag(db.Model):
__tablename__ = 'Tag'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String, unique=True)
plays = db.relationship(
Expand All @@ -117,6 +116,7 @@ def __repr__(self):


class Play(db.Model):
__tablename__ = 'Play'
id = db.Column(db.Integer, primary_key=True)
started = db.Column(db.Date)
finished = db.Column(db.Date)
Expand All @@ -129,9 +129,8 @@ class Play(db.Model):
lazy='dynamic',
cascade='all, delete-orphan'
)
game_id = db.Column(db.Integer, db.ForeignKey('game.id'))
user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
game_id = db.Column(db.Integer, db.ForeignKey('Game.id'))
user_id = db.Column(db.Integer, db.ForeignKey('User.id'))

def __repr__(self):
return '<Play {}>'.format(self.name)

7 changes: 3 additions & 4 deletions goodplays/views.py
@@ -1,6 +1,5 @@
from flask import render_template, flash, redirect, session, url_for, request
from flask_login import login_user, logout_user, current_user, login_required
import ldap3

from goodplays import app, db, lm
from goodplays.forms import LoginForm
Expand All @@ -21,11 +20,11 @@ def latest():
Maybe set up a daily task to update this DB? It'll get big...)
"""
user = current_user
games = Game.query. # TODO 10 latest!
games = [] #Game.query. # TODO 10 latest!

# TODO Show most recent 10 games added to the DB.

if not objects:
if not games:
flash("Games don't exist. Good riddance. Thanks, Tauriq!")

return render_template(
Expand Down Expand Up @@ -56,7 +55,7 @@ def plays():
@app.route('/login', methods=['GET', 'POST'])
def login():
"""
Logs the user in using LDAP authentication.
Logs the user in
"""
if current_user is not None and current_user.is_authenticated:
return redirect(url_for('index'))
Expand Down

0 comments on commit 97a2bb1

Please sign in to comment.