FEATURE: adds last day to about page stats (#12663)

FEATURE: adds last day to about page stats (#12663)

  • FEATURE: adds last day to about page stats

  • make it clear it’s last 24 hours

  • applies same copy fix to days

diff --git a/app/assets/javascripts/discourse/app/templates/about.hbs b/app/assets/javascripts/discourse/app/templates/about.hbs
index 2659b0e..a9466b2 100644
--- a/app/assets/javascripts/discourse/app/templates/about.hbs
+++ b/app/assets/javascripts/discourse/app/templates/about.hbs
@@ -72,36 +72,42 @@
             <tbody>
               <tr>
                 <th>&nbsp;</th>
+                <th>{{i18n "about.stat.last_day"}}</th>
                 <th>{{i18n "about.stat.last_7_days"}}</th>
                 <th>{{i18n "about.stat.last_30_days"}}</th>
                 <th>{{i18n "about.stat.all_time"}}</th>
               </tr>
               <tr>
                 <td class="title">{{i18n "about.topic_count"}}</td>
+                <td>{{number model.stats.topics_last_day}}</td>
                 <td>{{number model.stats.topics_7_days}}</td>
                 <td>{{number model.stats.topics_30_days}}</td>
                 <td>{{number model.stats.topic_count}}</td>
               </tr>
               <tr>
                 <td>{{i18n "about.post_count"}}</td>
+                <td>{{number model.stats.posts_last_day}}</td>
                 <td>{{number model.stats.posts_7_days}}</td>
                 <td>{{number model.stats.posts_30_days}}</td>
                 <td>{{number model.stats.post_count}}</td>
               </tr>
               <tr>
                 <td>{{i18n "about.user_count"}}</td>
+                <td>{{number model.stats.users_last_day}}</td>
                 <td>{{number model.stats.users_7_days}}</td>
                 <td>{{number model.stats.users_30_days}}</td>
                 <td>{{number model.stats.user_count}}</td>
               </tr>
               <tr>
                 <td>{{i18n "about.active_user_count"}}</td>
+                <td>{{number model.stats.active_users_last_day}}</td>
                 <td>{{number model.stats.active_users_7_days}}</td>
                 <td>{{number model.stats.active_users_30_days}}</td>
                 <td>&mdash;</td>
               </tr>
               <tr>
                 <td>{{i18n "about.like_count"}}</td>
+                <td>{{number model.stats.likes_last_day}}</td>
                 <td>{{number model.stats.likes_7_days}}</td>
                 <td>{{number model.stats.likes_30_days}}</td>
                 <td>{{number model.stats.like_count}}</td>
diff --git a/app/models/about.rb b/app/models/about.rb
index bf0ec3d..3f8118f 100644
--- a/app/models/about.rb
+++ b/app/models/about.rb
@@ -63,20 +63,25 @@ class About
 
   def stats
     @stats ||= {
-       topic_count: Topic.listable_topics.count,
-       post_count: Post.count,
-       user_count: User.real.count,
-       topics_7_days: Topic.listable_topics.where('created_at > ?', 7.days.ago).count,
-       topics_30_days: Topic.listable_topics.where('created_at > ?', 30.days.ago).count,
-       posts_7_days: Post.where('created_at > ?', 7.days.ago).count,
-       posts_30_days: Post.where('created_at > ?', 30.days.ago).count,
-       users_7_days: User.where('created_at > ?', 7.days.ago).count,
-       users_30_days: User.where('created_at > ?', 30.days.ago).count,
-       active_users_7_days: User.where('last_seen_at > ?', 7.days.ago).count,
-       active_users_30_days: User.where('last_seen_at > ?', 30.days.ago).count,
-       like_count: UserAction.where(action_type: UserAction::LIKE).count,
-       likes_7_days: UserAction.where(action_type: UserAction::LIKE).where("created_at > ?", 7.days.ago).count,
-       likes_30_days: UserAction.where(action_type: UserAction::LIKE).where("created_at > ?", 30.days.ago).count
+      topic_count: Topic.listable_topics.count,
+      topics_last_day: Topic.listable_topics.where('created_at > ?', 1.days.ago).count,
+      topics_7_days: Topic.listable_topics.where('created_at > ?', 7.days.ago).count,
+      topics_30_days: Topic.listable_topics.where('created_at > ?', 30.days.ago).count,
+      post_count: Post.count,
+      posts_last_day: Post.where('created_at > ?', 1.days.ago).count,
+      posts_7_days: Post.where('created_at > ?', 7.days.ago).count,
+      posts_30_days: Post.where('created_at > ?', 30.days.ago).count,
+      user_count: User.real.count,
+      users_last_day: User.real.where('created_at > ?', 1.days.ago).count,
+      users_7_days: User.real.where('created_at > ?', 7.days.ago).count,
+      users_30_days: User.real.where('created_at > ?', 30.days.ago).count,
+      active_users_last_day: User.where('last_seen_at > ?', 1.days.ago).count,
+      active_users_7_days: User.where('last_seen_at > ?', 7.days.ago).count,
+      active_users_30_days: User.where('last_seen_at > ?', 30.days.ago).count,
+      like_count: UserAction.where(action_type: UserAction::LIKE).count,
+      likes_last_day: UserAction.where(action_type: UserAction::LIKE).where("created_at > ?", 1.days.ago).count,
+      likes_7_days: UserAction.where(action_type: UserAction::LIKE).where("created_at > ?", 7.days.ago).count,
+      likes_30_days: UserAction.where(action_type: UserAction::LIKE).where("created_at > ?", 30.days.ago).count
     }
   end
 
diff --git a/app/views/about/index.html.erb b/app/views/about/index.html.erb
index 22a81ee..2caba68 100644
--- a/app/views/about/index.html.erb
+++ b/app/views/about/index.html.erb
@@ -61,36 +61,42 @@
       <tr>
         <th>&nbsp;</th>
         <th><%=t 'js.about.stat.all_time' %></th>
+        <th><%=t 'js.about.stat.last_day' %></th>
         <th><%=t 'js.about.stat.last_7_days' %></th>
         <th><%=t 'js.about.stat.last_30_days' %></th>
       </tr>
       <tr>
         <td class='title'><%=t 'js.about.topic_count' %></td>
         <td><%= stats["topic_count"] %></td>
+        <td><%= stats["topics_last_day"] %></td>
         <td><%= stats["topics_7_days"] %></td>
         <td><%= stats["topics_30_days"] %></td>
       </tr>
       <tr>
         <td><%=t 'js.about.post_count' %></td>
         <td><%= stats["post_count"] %></td>
+        <td><%= stats["posts_last_day"] %></td>
         <td><%= stats["posts_7_days"] %></td>
         <td><%= stats["posts_30_days"] %></td>
       </tr>
       <tr>
         <td><%=t 'js.about.user_count' %></td>
         <td><%= stats["user_count"] %></td>
+        <td><%= stats["users_last_day"] %></td>
         <td><%= stats["users_7_days"] %></td>
         <td><%= stats["users_30_days"] %></td>
       </tr>
       <tr>
         <td><%=t 'js.about.active_user_count' %></td>
         <td>&mdash;</td>
+        <td><%= stats["active_users_last_day"] %></td>
         <td><%= stats["active_users_7_days"] %></td>
         <td><%= stats["active_users_30_days"] %></td>
       </tr>
       <tr>
         <td><%=t 'js.about.like_count' %></td>
         <td><%= stats["like_count"] %></td>
+        <td><%= stats["likes_last_day"] %></td>
         <td><%= stats["likes_7_days"] %></td>
         <td><%= stats["likes_30_days"] %></td>
       </tr>
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index c9daee0..6db0d43 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -282,8 +282,9 @@ en:
       moderators: "Moderators"
       stat:
         all_time: "All Time"
-        last_7_days: "Last 7"
-        last_30_days: "Last 30"
+        last_day: "Last 24 hours"
+        last_7_days: "Last 7 days"
+        last_30_days: "Last 30 days"
       like_count: "Likes"
       topic_count: "Topics"
       post_count: "Posts"

GitHub sha: b6337b72

This commit appears in #12663 which was approved by pmusaraj. It was merged by SamSaffron.