From f248bc81cbec6f5c8fdbb708beb88a1aad3f7a26 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 30 May 2018 02:52:58 +0200 Subject: [PATCH] Add page for unlisted apps --- app/app.py | 8 ++++++++ app/models/unlistedapps.py | 10 ---------- app/templates/base.html | 1 + app/templates/unlistedapps.html | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 app/templates/unlistedapps.html diff --git a/app/app.py b/app/app.py index e9be9a7..70f4b9a 100644 --- a/app/app.py +++ b/app/app.py @@ -1,6 +1,7 @@ from flask import render_template, make_response, Blueprint from .models.pr import PullRequest from .models.appci import App, AppCI, AppCIBranch +from .models.unlistedapps import UnlistedApp from .settings import SITE_ROOT import json @@ -143,3 +144,10 @@ def appsobservatory_rss(): response.headers['Content-Type'] = 'application/rss+xml' return response +@main.route('/appsobservatory/unlisted') +def appsobservatory_unlisted(): + + apps = sorted(UnlistedApp.query.all(), key=lambda a: a.updated_days_ago) + + return render_template("unlistedapps.html", apps=apps) + diff --git a/app/models/unlistedapps.py b/app/models/unlistedapps.py index eeb2c71..653b755 100644 --- a/app/models/unlistedapps.py +++ b/app/models/unlistedapps.py @@ -63,16 +63,6 @@ class UnlistedApp(db.Model): db.session.commit() - #apps = sorted(apps, key=lambda x: x["updated_days_ago"]) - - #for app in apps: - # if app["updated_days_ago"] > 100: - # continue - # print(app["name"] + " ... " + app["url"] + " ... " + str(app["updated_days_ago"])) - - #with open('apps.json', 'w') as f: - # json.dump(apps, f) - def githubDateToDaysAgo(date): now = datetime.datetime.now() diff --git a/app/templates/base.html b/app/templates/base.html index 10cc7b9..3b9d87e 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -47,6 +47,7 @@ diff --git a/app/templates/unlistedapps.html b/app/templates/unlistedapps.html new file mode 100644 index 0000000..8c3243e --- /dev/null +++ b/app/templates/unlistedapps.html @@ -0,0 +1,33 @@ +{% extends "base.html" %} +{% block content %} + +

Unlisted apps

+
+
+ + + + + + + + + + {% for app in apps %} + + + + + {% endfor %} + +
DescriptionUpdated
+ {{ app.owner}}/{{ app.name }} + {{ app.description + or "" }}{{app.updated_days_ago}} days ago
+
+
+ +{% endblock %}