我一直在编写用于生成上述报表的数据探索器 SQL 查询。虽然我不是 SQL 专家,但这些查询目前都能正常运行。下面的查询语句可以提供这一层级的信息。
翻译状态报告
| 区域 | 符合条件 | 已翻译 | 待翻译 |
|---|---|---|---|
| 话题 | 540 | 450 | 90 |
| 帖子 | 3,700 | 800 | 2900 |
话题:
-- 设置:
-- 更新 SQL 中的翻译设置
-- 回填天数 - Interval 'xxx'
-- 忽略的类别 - Category_id NOT IN ()
-- 话题类型 - Regular 或 private_message
--
-- 翻译状态:
-- 待翻译的总话题数:注释掉两个 'and topics.locale' 的 where 语句
-- 未翻译的话题:仅取消注释 - topics.locale is null
-- 已翻译的话题:仅取消注释 - topics.local = 'en'
SELECT count(distinct topics.id)
FROM topics
JOIN posts ON topics.id = posts.topic_id
WHERE posts.created_at >= NOW() - INTERVAL '100 days'
AND posts.user_id > 0
AND topics.category_id NOT IN (22,3)
AND topics.archetype = 'regular'
-- AND topics.locale = 'en'
-- AND topics.locale is null
帖子:
-- 设置:
-- 更新 SQL 中的翻译设置
-- 回填天数 - Interval 'xxx'
-- 忽略的类别 - Category_id NOT IN ()
-- 话题类型 - Regular 或 private_message
--
-- 翻译状态:
-- 待翻译的总帖子数:注释掉两个 'and posts.locale' 的 where 语句
-- 未翻译的帖子:仅取消注释 - posts.locale is null
-- 已翻译的帖子:仅取消注释 - posts.locale = 'en'
SELECT count(*)
FROM posts
JOIN topics ON topics.id = posts.topic_id
WHERE posts.created_at >= NOW() - INTERVAL '100 days'
AND posts.user_id > 0
AND topics.category_id NOT IN (22,3)
AND topics.archetype = 'regular'
-- AND posts.locale = 'en'
-- AND posts.locale is null