diff options
| author | rubenwardy <rw@rubenwardy.com> | 2018-07-04 00:14:37 +0100 |
|---|---|---|
| committer | rubenwardy <rw@rubenwardy.com> | 2018-07-04 00:38:51 +0100 |
| commit | 19e1ed8b32179e3317c807b3ab0581e3b5fb00a2 (patch) | |
| tree | 3e3409482aa7a0f8c8da8721df26350f64a00f6a /app/views | |
| parent | eb6b1d6375841cd7b87b4f6a08b34ed5239a6354 (diff) | |
| download | cheatdb-19e1ed8b32179e3317c807b3ab0581e3b5fb00a2.tar.xz | |
Implement forum parser to increase accuracy
Diffstat (limited to 'app/views')
| -rw-r--r-- | app/views/admin.py | 9 | ||||
| -rw-r--r-- | app/views/packages/__init__.py | 8 | ||||
| -rw-r--r-- | app/views/packages/todo.py | 12 | ||||
| -rw-r--r-- | app/views/users.py | 6 |
4 files changed, 16 insertions, 19 deletions
diff --git a/app/views/admin.py b/app/views/admin.py index 65d5264..92ee437 100644 --- a/app/views/admin.py +++ b/app/views/admin.py @@ -21,7 +21,7 @@ from flask.ext import menu from app import app from app.models import * from app.tasks.importtasks import importRepoScreenshot, importAllDependencies -from app.tasks.forumtasks import importUsersFromModList, importKrocksModList +from app.tasks.forumtasks import importTopicList from flask_wtf import FlaskForm from wtforms import * from app.utils import loginUser, rank_required @@ -31,11 +31,8 @@ from app.utils import loginUser, rank_required def admin_page(): if request.method == "POST": action = request.form["action"] - if action == "importusers": - task = importUsersFromModList.delay() - return redirect(url_for("check_task", id=task.id, r=url_for("user_list_page"))) - elif action == "importmodlist": - task = importKrocksModList.delay() + if action == "importmodlist": + task = importTopicList.delay() return redirect(url_for("check_task", id=task.id, r=url_for("todo_topics_page"))) elif action == "importscreenshots": packages = Package.query \ diff --git a/app/views/packages/__init__.py b/app/views/packages/__init__.py index 6ef76ec..4d357a6 100644 --- a/app/views/packages/__init__.py +++ b/app/views/packages/__init__.py @@ -100,11 +100,11 @@ def package_page(package): package.checkPerm(current_user, Permission.APPROVE_NEW) similar_topics = None if not show_similar_topics else \ - KrockForumTopic.query \ + ForumTopic.query \ .filter_by(name=package.name) \ - .filter(KrockForumTopic.topic_id != package.forums) \ - .filter(~ db.exists().where(Package.forums==KrockForumTopic.topic_id)) \ - .order_by(db.asc(KrockForumTopic.name), db.asc(KrockForumTopic.title)) \ + .filter(ForumTopic.topic_id != package.forums) \ + .filter(~ db.exists().where(Package.forums==ForumTopic.topic_id)) \ + .order_by(db.asc(ForumTopic.name), db.asc(ForumTopic.title)) \ .all() releases = getReleases(package) diff --git a/app/views/packages/todo.py b/app/views/packages/todo.py index 81735eb..84cfef4 100644 --- a/app/views/packages/todo.py +++ b/app/views/packages/todo.py @@ -41,8 +41,8 @@ def todo_page(): screenshots = PackageScreenshot.query.filter_by(approved=False).all() - topics_to_add = KrockForumTopic.query \ - .filter(~ db.exists().where(Package.forums==KrockForumTopic.topic_id)) \ + topics_to_add = ForumTopic.query \ + .filter(~ db.exists().where(Package.forums==ForumTopic.topic_id)) \ .count() return render_template("todo/list.html", title="Reports and Work Queue", @@ -54,11 +54,11 @@ def todo_page(): @app.route("/todo/topics/") @login_required def todo_topics_page(): - total = KrockForumTopic.query.count() + total = ForumTopic.query.count() - topics = KrockForumTopic.query \ - .filter(~ db.exists().where(Package.forums==KrockForumTopic.topic_id)) \ - .order_by(db.asc(KrockForumTopic.name), db.asc(KrockForumTopic.title)) \ + topics = ForumTopic.query \ + .filter(~ db.exists().where(Package.forums==ForumTopic.topic_id)) \ + .order_by(db.asc(ForumTopic.name), db.asc(ForumTopic.title)) \ .all() return render_template("todo/topics.html", topics=topics, total=total) diff --git a/app/views/users.py b/app/views/users.py index 256f7d1..a96fce2 100644 --- a/app/views/users.py +++ b/app/views/users.py @@ -98,10 +98,10 @@ def user_profile_page(username): topics_to_add = None if current_user == user or user.checkPerm(current_user, Permission.CHANGE_AUTHOR): - topics_to_add = KrockForumTopic.query \ + topics_to_add = ForumTopic.query \ .filter_by(author_id=user.id) \ - .filter(~ db.exists().where(Package.forums==KrockForumTopic.topic_id)) \ - .order_by(db.asc(KrockForumTopic.name), db.asc(KrockForumTopic.title)) \ + .filter(~ db.exists().where(Package.forums==ForumTopic.topic_id)) \ + .order_by(db.asc(ForumTopic.name), db.asc(ForumTopic.title)) \ .all() # Process GET or invalid POST |
