Exemple #1
0
import pickle
from datetime import datetime

from minance import create_app, db
from minance.user.models import User, Item

app = create_app()


def updatePortfolioGraphs():
    """Function used for updating the balance portfolio graph on the user dashboard page."""
    with app.app_context():
        users = User.query.all()

        for user in users:
            portfolio = pickle.loads(user.portfolio)
            portfolio.append([datetime.utcnow().timestamp(), user.balance])
            user.portfolio = pickle.dumps(portfolio)

        db.session.commit()
Exemple #2
0
def test_client():
  _app = create_app("flask_test.cfg")

  with _app.test_client() as test_client:
    with _app.app_context():
      yield test_client
Exemple #3
0
def recreateDB():
    app = create_app()
    with app.app_context():
        db.create_all()