|
|
|
import os
|
|
|
|
from flask_login import current_user
|
|
|
|
from usermodel import User
|
|
|
|
from distribusimodel import Distribusis
|
|
|
|
|
|
|
|
|
|
|
|
def AreFilesUploaded():
|
|
|
|
user = User.query.filter_by(email=current_user.email).first()
|
|
|
|
distribusi = Distribusis.query.filter_by(userid=user.id).first()
|
|
|
|
if distribusi is None:
|
|
|
|
print("distribusi folder is empty")
|
|
|
|
return False
|
|
|
|
userfolder = os.path.join("stash", distribusi.distribusiname)
|
|
|
|
if os.path.exists(userfolder):
|
|
|
|
print("folder found, files are uploaded")
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
def HasDistribusi():
|
|
|
|
user = User.query.filter_by(email=current_user.email).first()
|
|
|
|
distribusi = Distribusis.query.filter_by(userid=user.id).first()
|
|
|
|
if distribusi is None:
|
|
|
|
print("no distribusi found")
|
|
|
|
return False
|
|
|
|
if distribusi.visible is False:
|
|
|
|
print("distribusi not visible")
|
|
|
|
return False
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
def CurrentDistribusi():
|
|
|
|
user = User.query.filter_by(email=current_user.email).first()
|
|
|
|
if user.currentdistribusi is None:
|
|
|
|
return "None"
|
|
|
|
if user.currentdistribusi is "new":
|
|
|
|
return "new"
|
|
|
|
return user.currentdistribusi
|
|
|
|
|
|
|
|
|
|
|
|
def DistribusiSelected():
|
|
|
|
user = User.query.filter_by(email=current_user.email).first()
|
|
|
|
if user.currentdistribusi is None:
|
|
|
|
return False
|
|
|
|
return True
|
|
|
|
|
|
|
|
# def IsThemeSelected
|
|
|
|
# def IsCustomThemePresent
|
|
|
|
# def IsDistribusiLive
|