This commit is contained in:
root 2020-11-07 18:10:34 +00:00
commit 840e780d56
2 changed files with 25 additions and 1 deletions

View file

@ -127,6 +127,9 @@ class App(db.Model):
opened_issues = db.Column(db.Integer, default=-1)
opened_prs = db.Column(db.Integer, default=-1)
long_term_good_quality = db.Column(db.Boolean, nullable=False)
long_term_broken = db.Column(db.Boolean, nullable=False)
def __repr__(self):
return '<App %r>' % self.name

View file

@ -1,8 +1,17 @@
import json
import os
import sys
import inspect
from datetime import datetime
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
appdir = os.path.abspath(currentdir + "../../../../")
sys.path.insert(0, appdir)
from app import db
from app.models.applists import App
def _time_points_until_today():
@ -113,6 +122,18 @@ def make_count_summary():
os.system("mkdir -p per_app/")
for app in relevant_apps_to_track:
json.dump(history_per_app[app], open('per_app/history_%s.json' % app, 'w'))
update_catalog_stats(app, history)
db.session.commit()
def update_catalog_stats(app, history):
app_in_db = App.query.filter_by(name=app).first_or_404()
app_in_db.long_term_good_quality = len([d for d in history[-50:] if d["level"] > 5]) > 25
app_in_db.long_term_broken = len([d for d in history[-50:] if d["level"] <= 0]) > 25
db.session.add(app_in_db)
get_lists_history()