From 72ae91d2204ff76e3e0ece6d45c9686008a79c95 Mon Sep 17 00:00:00 2001 From: bsimpson63 Date: Sat, 31 Mar 2012 01:16:44 -0700 Subject: [PATCH] Start dual-writing reported_links and reported_comments. --- r2/r2/lib/db/queries.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/r2/r2/lib/db/queries.py b/r2/r2/lib/db/queries.py index 59b989e5f..669498012 100644 --- a/r2/r2/lib/db/queries.py +++ b/r2/r2/lib/db/queries.py @@ -363,19 +363,19 @@ def get_spam_filtered(sr): return [get_spam_filtered_links(sr), get_spam_filtered_comments(sr)] -def get_reported_links(sr): - q_l = Link._query(Link.c.reported != 0, - Link.c.sr_id == sr._id, - Link.c._spam == False, - sort = db_sort('new')) - return make_results(q_l) +@migrating_cached_query(SubredditQueryCache) +def get_reported_links(sr_id): + return Link._query(Link.c.reported != 0, + Link.c.sr_id == sr_id, + Link.c._spam == False, + sort = db_sort('new')) -def get_reported_comments(sr): - q_c = Comment._query(Comment.c.reported != 0, - Comment.c.sr_id == sr._id, - Comment.c._spam == False, - sort = db_sort('new')) - return make_results(q_c) +@migrating_cached_query(SubredditQueryCache) +def get_reported_comments(sr_id): + return Comment._query(Comment.c.reported != 0, + Comment.c.sr_id == sr_id, + Comment.c._spam == False, + sort = db_sort('new')) def get_reported(sr): if isinstance(sr, ModContribSR):