Skip to content

Commit

Permalink
Fix type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lulunac27a committed Nov 1, 2024
1 parent 2b92cd1 commit 1d651e5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

import math
from typing import Union
from flask import Flask, render_template, redirect, url_for, request
from flask_sqlalchemy import SQLAlchemy
from werkzeug.wrappers import Response
Expand Down Expand Up @@ -120,7 +121,7 @@ def index() -> str: # get index page template
"""
Return the index page containing a user.
"""
user: User | None = User.query.first() # get first user
user: Union[User, None] = User.query.first() # get first user
# redirect to index page template
return render_template("index.html", user=user)

Expand All @@ -130,7 +131,7 @@ def add_xp() -> Response: # add XP
"""
Add XP (experience points) based on entered amount.
"""
user: User | None = User.query.first() # get first user
user: Union[User, None] = User.query.first() # get first user
user.add_xp(float(request.form["amount"])) # parse amount as float
db.session.commit() # commit database changes
return redirect(url_for("index")) # redirect to index page template
Expand Down

0 comments on commit 1d651e5

Please sign in to comment.