Index: trunk/extensions/ArticleFeedbackv5/sql/alter.sql |
— | — | @@ -66,6 +66,8 @@ |
67 | 67 | ALTER TABLE aft_article_feedback ADD COLUMN af_unhelpful_count integer unsigned NOT NULL DEFAULT 0; |
68 | 68 | |
69 | 69 | -- added or updated 1/24 (greg) |
| 70 | +ALTER TABLE aft_article_feedback ADD COLUMN af_needs_oversight boolean NOT NULL DEFAULT FALSE; |
| 71 | + |
70 | 72 | DELETE FROM aft_article_filter_count; |
71 | 73 | INSERT INTO aft_article_filter_count(afc_page_id, afc_filter_name, afc_filter_count) SELECT af_page_id, 'helpful', COUNT(*) FROM aft_article_feedback WHERE CONVERT(af_helpful_count, SIGNED) - CONVERT(af_unhelpful_count, SIGNED) > 0 GROUP BY af_page_id; |
72 | 74 | INSERT INTO aft_article_filter_count(afc_page_id, afc_filter_name, afc_filter_count) SELECT af_page_id, 'abusive', COUNT(*) FROM aft_article_feedback WHERE af_abuse_count > 0 GROUP BY af_page_id; |
— | — | @@ -76,4 +78,30 @@ |
77 | 79 | INSERT INTO aft_article_filter_count(afc_page_id, afc_filter_name, afc_filter_count) SELECT af_page_id, 'deleted', COUNT(*) FROM aft_article_feedback WHERE af_delete_count > 0 GROUP BY af_page_id; |
78 | 80 | INSERT INTO aft_article_filter_count(afc_page_id, afc_filter_name, afc_filter_count) SELECT af_page_id, 'unhelpful', COUNT(*) FROM aft_article_feedback WHERE CONVERT(af_helpful_count, SIGNED) - CONVERT(af_unhelpful_count, SIGNED) < 0 GROUP BY af_page_id; |
79 | 81 | INSERT INTO aft_article_filter_count(afc_page_id, afc_filter_name, afc_filter_count) SELECT af_page_id, 'needsoversight', COUNT(*) FROM aft_article_feedback WHERE af_needs_oversight IS TRUE GROUP BY af_page_id; |
80 | | -ALTER TABLE aft_article_feedback ADD COLUMN af_needs_oversight boolean NOT NULL DEFAULT FALSE; |
| 82 | + |
| 83 | +-- added 1/26 (greg) - obviates much of the above from 1/24. |
| 84 | +DELETE FROM aft_article_filter_count; |
| 85 | +INSERT INTO aft_article_filter_count(afc_page_id, afc_filter_name, afc_filter_count) SELECT af_page_id, 'helpful', COUNT(*) FROM aft_article_feedback WHERE af_bucket_id = 1 AND CONVERT(af_helpful_count, SIGNED) - CONVERT(af_unhelpful_count, SIGNED) > 0 GROUP BY af_page_id; |
| 86 | +INSERT INTO aft_article_filter_count(afc_page_id, afc_filter_name, afc_filter_count) SELECT af_page_id, 'abusive', COUNT(*) FROM aft_article_feedback WHERE af_bucket_id = 1 AND af_abuse_count > 0 GROUP BY af_page_id; |
| 87 | +INSERT INTO aft_article_filter_count(afc_page_id, afc_filter_name, afc_filter_count) SELECT af_page_id, 'invisible', COUNT(*) FROM aft_article_feedback WHERE af_bucket_id = 1 AND af_hide_count > 0 GROUP BY af_page_id; |
| 88 | +INSERT INTO aft_article_filter_count(afc_page_id, afc_filter_name, afc_filter_count) SELECT af_page_id, 'visible', COUNT(*) FROM aft_article_feedback WHERE af_bucket_id = 1 AND af_hide_count = 0 GROUP BY af_page_id; |
| 89 | +INSERT INTO aft_article_filter_count(afc_page_id, afc_filter_name, afc_filter_count) SELECT af_page_id, 'all', COUNT(*) FROM aft_article_feedback WHERE af_bucket_id = 1 GROUP BY af_page_id; |
| 90 | +INSERT INTO aft_article_filter_count(afc_page_id, afc_filter_name, afc_filter_count) SELECT af_page_id, 'comment', COUNT(*) FROM aft_article_feedback, aft_article_answer WHERE af_bucket_id = 1 AND af_id = aa_feedback_id AND aa_response_text IS NOT NULL GROUP BY af_page_id; |
| 91 | +INSERT INTO aft_article_filter_count(afc_page_id, afc_filter_name, afc_filter_count) SELECT af_page_id, 'deleted', COUNT(*) FROM aft_article_feedback WHERE af_bucket_id = 1 AND af_delete_count > 0 GROUP BY af_page_id; |
| 92 | +INSERT INTO aft_article_filter_count(afc_page_id, afc_filter_name, afc_filter_count) SELECT af_page_id, 'unhelpful', COUNT(*) FROM aft_article_feedback WHERE af_bucket_id = 1 AND CONVERT(af_helpful_count, SIGNED) - CONVERT(af_unhelpful_count, SIGNED) < 0 GROUP BY af_page_id; |
| 93 | +INSERT INTO aft_article_filter_count(afc_page_id, afc_filter_name, afc_filter_count) SELECT af_page_id, 'needsoversight', COUNT(*) FROM aft_article_feedback WHERE af_bucket_id = 1 AND af_needs_oversight IS TRUE GROUP BY af_page_id; |
| 94 | + |
| 95 | +-- Note that this ignores the select rollups, since bucket 1 doesn't have any |
| 96 | +-- selects in it. Those tables can be truncated, or possibly dropped entirely, |
| 97 | +-- if bucket 1 remains the only bucket. Holding off on that decision for now. |
| 98 | +DELETE FROM aft_article_feedback_ratings_rollup; |
| 99 | +DELETE FROM aft_article_revision_feedback_ratings_rollup; |
| 100 | +INSERT INTO aft_article_revision_feedback_ratings_rollup (afrr_page_id, afrr_revision_id, afrr_field_id, afrr_total, afrr_count) |
| 101 | +SELECT af_page_id, af_revision_id, aa_field_id, SUM(aa_response_boolean), COUNT(aa_response_boolean) |
| 102 | +FROM aft_article_feedback, aft_article_answer |
| 103 | +WHERE af_bucket_id = 1 AND af_id = aa_feedback_id AND aa_response_boolean IS NOT NULL |
| 104 | +GROUP BY af_page_id, af_revision_id; |
| 105 | +INSERT INTO aft_article_feedback_ratings_rollup (arr_page_id, arr_field_id, arr_total, arr_count) |
| 106 | +SELECT afrr_page_id, afrr_field_id, SUM(afrr_total), SUM(afrr_count) |
| 107 | +FROM aft_article_revision_feedback_ratings_rollup |
| 108 | +GROUP BY afrr_page_id; |
Index: trunk/extensions/ArticleFeedbackv5/api/ApiViewFeedbackArticleFeedbackv5.php |
— | — | @@ -302,8 +302,9 @@ |
303 | 303 | ( $now - $timestamp ), 'avoidseconds' |
304 | 304 | ); |
305 | 305 | $date = wfMessage( 'articleFeedbackv5-comment-ago', $time )->escaped(); |
| 306 | + } elseif( $timestamp ) { |
| 307 | + $date = $wgLang->timeanddate($record[0]->af_created ); |
306 | 308 | } else { |
307 | | - $date = $wgLang->timeanddate($record[0]->af_created ); |
308 | 309 | } |
309 | 310 | |
310 | 311 | $details = Html::openElement( 'div', array( |