class PrivateParlorXT::SQLiteStatistics

Overview

An implementation of Statistics using the Database for storing message data

Defined in:

private-parlor-xt/statistics/sqlite_statistics.cr

Constructors

Instance Method Summary

Instance methods inherited from class PrivateParlorXT::Statistics

config_screen(services : Services) : String config_screen, configuration_details(services : Services) : Hash(BotInfo, String) configuration_details, full_users_screen(services : Services) : String full_users_screen, increment_downvotes : Nil increment_downvotes, increment_messages(type : Messages) : Nil increment_messages, increment_unoriginal_media : Nil increment_unoriginal_media, increment_unoriginal_text : Nil increment_unoriginal_text, increment_upvotes : Nil increment_upvotes, karma_counts : Hash(Karma, Int32) karma_counts, karma_level_count(start_value : Int32, end_value : Int32) : Int32 karma_level_count, karma_levels_screen(services : Services) : String karma_levels_screen, karma_screen(services : Services) : String karma_screen, keyboard_markup(next_screen : StatScreens, services : Services) : Tourmaline::InlineKeyboardMarkup keyboard_markup, message_counts : Hash(Messages, Int32) message_counts, messages_screen(services : Services) : String messages_screen, percent_change(initial : Int32, final : Int32) : Float64 percent_change, robot9000_counts : Hash(Robot9000, Int32) robot9000_counts, robot9000_screen(services : Services) : String robot9000_screen, start_date : String start_date, start_time : Time start_time, statistic_screen(next_screen : StatScreens, services : Services) : String statistic_screen, uptime : Time::Span uptime, user_counts : Hash(Users, Int32) user_counts, users_screen(services : Services) : String users_screen

Constructor Detail

def self.new(connection : DB::Database) #

Generally this should use the same connection that was used for the database


[View source]

Instance Method Detail

def ensure_schema : Nil #

Ensures that there is a 'message_stats' table in the database


[View source]
def ensure_start_date : Nil #

Ensures that there is a date value for the 'start_date' key in the 'system_config' table


[View source]
def increment_downvotes : Nil #

Increment the number of downvotes given


[View source]
def increment_messages(type : Messages) : Nil #

Increment the message count according to the given type and increment the total number of messages in general


[View source]
def increment_unoriginal_media : Nil #

Increment the number of unoriginal media messages encountered


[View source]
def increment_unoriginal_text : Nil #

Increment the number of unoriginal text messages encountered


[View source]
def increment_upvotes : Nil #

Increment the number of upvotes given


[View source]
def karma_counts : Hash(Karma, Int32) #

Returns a hash of Karma to `Int32 , containing the total number of karma given or lost, and daily, weekly, and monthly totals


[View source]
def karma_level_count(start_value : Int32, end_value : Int32) : Int32 #

Returns an Int32 total of users whose karma lie between start_value and end_value


[View source]
def message_counts : Hash(Messages, Int32) #

Returns a hash of Messages to Int32, containing the total number of message for each type and daily, weekly, and monthly totals


[View source]
def robot9000_counts : Hash(Robot9000, Int32) #

Returns a hash of Robot9000 to Int32, containing the total number of unique and unoriginal messages for texts and media types


[View source]
def start_date : String #

Returns a String containing the date at which the statistics module was initialized


[View source]
def user_counts : Hash(Users, Int32) #

Returns a hash of Users to Int32, containing the total number of each kind of user and daily, weekly, and monthly totals


[View source]