[System] Fixed some minor python warnings
This commit is contained in:
parent
791656147e
commit
ed361a7361
|
@ -55,7 +55,6 @@ coverage.xml
|
||||||
*.pot
|
*.pot
|
||||||
|
|
||||||
# Django stuff:
|
# Django stuff:
|
||||||
*.log
|
|
||||||
local_settings.py
|
local_settings.py
|
||||||
db.sqlite3
|
db.sqlite3
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from flask import url_for
|
from flask import url_for
|
||||||
from typing import Optional, Type
|
from typing import Optional
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime
|
||||||
from sqlalchemy.orm.collections import attribute_mapped_collection
|
from sqlalchemy.orm.collections import attribute_mapped_collection
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# Credit -> to account
|
# Credit -> to account
|
||||||
|
|
||||||
from sqlalchemy import func
|
from sqlalchemy import func
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime
|
||||||
from werkzeug.exceptions import BadRequest, NotFound, Conflict
|
from werkzeug.exceptions import BadRequest, NotFound, Conflict
|
||||||
|
|
||||||
from flaschengeist.database import db
|
from flaschengeist.database import db
|
||||||
|
@ -12,7 +12,6 @@ from flaschengeist.models.user import User
|
||||||
|
|
||||||
from .models import Transaction
|
from .models import Transaction
|
||||||
from . import permissions
|
from . import permissions
|
||||||
from ... import logger
|
|
||||||
|
|
||||||
__attribute_limit = "balance_limit"
|
__attribute_limit = "balance_limit"
|
||||||
|
|
||||||
|
@ -41,7 +40,9 @@ def get_balance(user, start: datetime = None, end: datetime = None):
|
||||||
|
|
||||||
def get_balances(start: datetime = None, end: datetime = None):
|
def get_balances(start: datetime = None, end: datetime = None):
|
||||||
debit = db.session.query(Transaction.sender_id, func.sum(Transaction.amount)).filter(Transaction.sender_ != None)
|
debit = db.session.query(Transaction.sender_id, func.sum(Transaction.amount)).filter(Transaction.sender_ != None)
|
||||||
credit = db.session.query(Transaction.receiver_id, func.sum(Transaction.amount)).filter(Transaction.receiver_ != None)
|
credit = db.session.query(Transaction.receiver_id, func.sum(Transaction.amount)).filter(
|
||||||
|
Transaction.receiver_ != None
|
||||||
|
)
|
||||||
if start:
|
if start:
|
||||||
debit = debit.filter(start <= Transaction.time)
|
debit = debit.filter(start <= Transaction.time)
|
||||||
credit = credit.filter(start <= Transaction.time)
|
credit = credit.filter(start <= Transaction.time)
|
||||||
|
|
|
@ -28,7 +28,7 @@ class MailMessagePlugin(Plugin):
|
||||||
def send_mail(self, msg: Message):
|
def send_mail(self, msg: Message):
|
||||||
if isinstance(msg.receiver, User):
|
if isinstance(msg.receiver, User):
|
||||||
if not msg.receiver.mail:
|
if not msg.receiver.mail:
|
||||||
logger.warn("Could not send Mail, mail missing: {}".format(msg.receiver))
|
logger.warning("Could not send Mail, mail missing: {}".format(msg.receiver))
|
||||||
return
|
return
|
||||||
recipients = [msg.receiver.mail]
|
recipients = [msg.receiver.mail]
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
import inspect
|
import inspect
|
||||||
import argparse
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
from werkzeug.middleware.dispatcher import DispatcherMiddleware
|
|
||||||
|
|
||||||
from flaschengeist.config import config
|
from flaschengeist.config import config
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue