remove unused imports, variables
This commit is contained in:
parent
5e7810eb9f
commit
7da002eb00
|
@ -4,7 +4,6 @@ from flask import Flask
|
||||||
from apscheduler.schedulers.background import BackgroundScheduler
|
from apscheduler.schedulers.background import BackgroundScheduler
|
||||||
from tlapbot.db import get_db
|
from tlapbot.db import get_db
|
||||||
from tlapbot.owncast_requests import is_stream_live, give_points_to_chat
|
from tlapbot.owncast_requests import is_stream_live, give_points_to_chat
|
||||||
from tlapbot.redeems import remove_inactive_redeems
|
|
||||||
|
|
||||||
def create_app(test_config=None):
|
def create_app(test_config=None):
|
||||||
app = Flask(__name__, instance_relative_config=True)
|
app = Flask(__name__, instance_relative_config=True)
|
||||||
|
|
|
@ -97,7 +97,7 @@ def add_user_to_database(db, user_id, display_name):
|
||||||
|
|
||||||
def change_display_name(db, user_id, new_name):
|
def change_display_name(db, user_id, new_name):
|
||||||
try:
|
try:
|
||||||
cursor = db.execute(
|
db.execute(
|
||||||
"UPDATE points SET name = ? WHERE id = ?",
|
"UPDATE points SET name = ? WHERE id = ?",
|
||||||
(new_name, user_id)
|
(new_name, user_id)
|
||||||
)
|
)
|
||||||
|
@ -109,7 +109,7 @@ def change_display_name(db, user_id, new_name):
|
||||||
|
|
||||||
def remove_duplicate_usernames(db, user_id, username):
|
def remove_duplicate_usernames(db, user_id, username):
|
||||||
try:
|
try:
|
||||||
cursor = db.execute(
|
db.execute(
|
||||||
"""UPDATE points
|
"""UPDATE points
|
||||||
SET name = NULL
|
SET name = NULL
|
||||||
WHERE name = ? AND NOT id = ?""",
|
WHERE name = ? AND NOT id = ?""",
|
||||||
|
|
|
@ -23,7 +23,7 @@ def counter_exists(db, counter_name):
|
||||||
def add_to_counter(db, counter_name):
|
def add_to_counter(db, counter_name):
|
||||||
if counter_exists(db, counter_name):
|
if counter_exists(db, counter_name):
|
||||||
try:
|
try:
|
||||||
cursor = db.execute(
|
db.execute(
|
||||||
"UPDATE counters SET count = count + 1 WHERE name = ?",
|
"UPDATE counters SET count = count + 1 WHERE name = ?",
|
||||||
(counter_name,)
|
(counter_name,)
|
||||||
)
|
)
|
||||||
|
@ -37,7 +37,7 @@ def add_to_counter(db, counter_name):
|
||||||
|
|
||||||
def add_to_redeem_queue(db, user_id, redeem_name, note=None):
|
def add_to_redeem_queue(db, user_id, redeem_name, note=None):
|
||||||
try:
|
try:
|
||||||
cursor = db.execute(
|
db.execute(
|
||||||
"INSERT INTO redeem_queue(redeem, redeemer_id, note) VALUES(?, ?, ?)",
|
"INSERT INTO redeem_queue(redeem, redeemer_id, note) VALUES(?, ?, ?)",
|
||||||
(redeem_name, user_id, note)
|
(redeem_name, user_id, note)
|
||||||
)
|
)
|
||||||
|
@ -159,7 +159,7 @@ def all_active_milestones(db):
|
||||||
return all_active_milestones
|
return all_active_milestones
|
||||||
|
|
||||||
|
|
||||||
def all_active_redeems(db):
|
def all_active_redeems():
|
||||||
redeems = current_app.config['REDEEMS']
|
redeems = current_app.config['REDEEMS']
|
||||||
all_active_redeems = {}
|
all_active_redeems = {}
|
||||||
for redeem_name, redeem_dict in redeems.items():
|
for redeem_name, redeem_dict in redeems.items():
|
||||||
|
|
|
@ -2,7 +2,7 @@ from flask import render_template, Blueprint, request, current_app
|
||||||
from tlapbot.db import get_db
|
from tlapbot.db import get_db
|
||||||
from tlapbot.redeems import all_active_counters, all_active_milestones, all_active_redeems, pretty_redeem_queue
|
from tlapbot.redeems import all_active_counters, all_active_milestones, all_active_redeems, pretty_redeem_queue
|
||||||
from tlapbot.owncast_helpers import read_all_users_with_username
|
from tlapbot.owncast_helpers import read_all_users_with_username
|
||||||
from datetime import datetime, timezone
|
from datetime import timezone
|
||||||
|
|
||||||
bp = Blueprint('redeem_dashboard', __name__)
|
bp = Blueprint('redeem_dashboard', __name__)
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ def dashboard():
|
||||||
queue=pretty_redeem_queue(db),
|
queue=pretty_redeem_queue(db),
|
||||||
counters=all_active_counters(db),
|
counters=all_active_counters(db),
|
||||||
milestones=all_active_milestones(db),
|
milestones=all_active_milestones(db),
|
||||||
redeems=all_active_redeems(db),
|
redeems=all_active_redeems(),
|
||||||
prefix=current_app.config['PREFIX'],
|
prefix=current_app.config['PREFIX'],
|
||||||
passive=current_app.config['PASSIVE'],
|
passive=current_app.config['PASSIVE'],
|
||||||
username=username,
|
username=username,
|
||||||
|
|
Loading…
Reference in New Issue