# Is it possible to get a report on post approvals?

**URL:** <https://meta.discourse.org/t/is-it-possible-to-get-a-report-on-post-approvals/108101>\
**Category:** Feature\
**Created:** [2월 1, 2019, 8:28오전 UTC](https://meta.discourse.org/t/is-it-possible-to-get-a-report-on-post-approvals/108101 "2019-02-01T08:28:49Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![dfabulich](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dfabulich/32/108716_2.png) [@dfabulich](https://meta.discourse.org/u/dfabulich)\
**Post date:** [4월 9, 2019, 7:32오후 UTC](https://meta.discourse.org/t/is-it-possible-to-get-a-report-on-post-approvals/108101/12 "2019-04-09T19:32:06Z")

</div>

Approvals and rejections by moderator in the last 30 days:

```plaintext
SELECT username, r.status, count(r.id)
FROM reviewables r
JOIN (
  SELECT max(h.id) as history_id, reviewable_id
  FROM reviewable_histories h
  GROUP BY reviewable_id
) latest
  ON r.id = latest.reviewable_id
JOIN reviewable_histories h
  ON h.id = latest.history_id
JOIN users u
  ON h.created_by_id = u.id
WHERE r.type = 'ReviewableQueuedPost'
AND r.created_at > now() - interval '30 days'
GROUP BY username, r.status
ORDER BY username, r.status

```

Average time to approval/rejection:

```plaintext
SELECT sum(h.created_at - r.created_at)/count(r.id), r.status
FROM reviewables r
JOIN (
  SELECT max(h.id) as history_id, reviewable_id
  FROM reviewable_histories h
  GROUP BY reviewable_id
) latest
  ON r.id = latest.reviewable_id
JOIN reviewable_histories h
  ON h.id = latest.history_id
WHERE r.type = 'ReviewableQueuedPost'
AND r.created_at > now() - interval '30 days'
GROUP BY r.status
ORDER BY r.status

```

---

_[View the full topic](https://meta.discourse.org/t/is-it-possible-to-get-a-report-on-post-approvals/108101)._
