Fix db error.

last_seen throws errors on production server. I'm investigating. commented for now.
This commit is contained in:
PLUJA 2020-09-08 00:02:51 +02:00 committed by GitHub
parent 37e8bf4100
commit 0285135d4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,7 +45,7 @@ ALLOWED_EXTENSIONS = {'json', 'db'}
@app.route('/index') @app.route('/index')
@login_required @login_required
def index(): def index():
current_user.last_seen = datetime.datetime.utcnow() #current_user.last_seen = datetime.datetime.utcnow()
return render_template('home.html') return render_template('home.html')
@app.route('/twitter') @app.route('/twitter')
@ -390,18 +390,18 @@ def logout():
@app.route('/settings') @app.route('/settings')
@login_required @login_required
def settings(): def settings():
active = 1 '''active = 1
for user in User.query.all(): for user in User.query.all():
if not user.last_seen == None: if not user.last_seen == None:
t = datetime.datetime.utcnow() - user.last_seen t = datetime.datetime.utcnow() - user.last_seen
s = t.total_seconds() s = t.total_seconds()
m = s/60 m = s/60
if m < 40: if m < 40:
active = active+1 active = active+1'''
instanceInfo = { instanceInfo = {
"totalUsers":db.session.query(User).count(), "totalUsers":db.session.query(User).count(),
"active":active, "active":"unknown",
"location":config['serverLocation'], "location":config['serverLocation'],
"serverName":config['serverName'] "serverName":config['serverName']
} }
@ -745,4 +745,4 @@ def getYoutubePosts(ids):
video.description = re.sub(r'^https?:\/\/.*[\r\n]*', '', video.description[0:120]+"...", flags=re.MULTILINE) video.description = re.sub(r'^https?:\/\/.*[\r\n]*', '', video.description[0:120]+"...", flags=re.MULTILINE)
videos.append(video) videos.append(video)
return videos return videos