From 5462a1e56abf70486dc59593dde6ecb95a072026 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Wed, 20 Mar 2024 11:00:31 -0400 Subject: Added some admin dashboard stats --- app/models/global.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 app/models/global.rb (limited to 'app/models') diff --git a/app/models/global.rb b/app/models/global.rb new file mode 100644 index 0000000..7c7d6d4 --- /dev/null +++ b/app/models/global.rb @@ -0,0 +1,20 @@ +class Global < ApplicationRecord + def self.get_filtered_comments + row = find_by_key("filtered_comments") + if row + row[:int_value] + else + 0 + end + end + + def self.increment_filtered_comments + row = find_by_key("filtered_comments") + if row + row.int_value += 1 + row.save + else + create(key: "filtered_comments", int_value: 1) + end + end +end -- cgit 1.4.1