mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-05-01 01:05:00 +00:00
- Added type annotations and class definitions in the dashboard layout, stats, and data table modules for improved type safety and documentation. - Introduced new classes for UI components, props, and configuration in the form builder, navigation menu, notification center, and UI dialogs packages. - Implemented detailed type definitions for actions, fields, and pagination components to streamline usage and enhance clarity. - Updated initialization functions in multiple packages to include versioning and installation context. - Improved structure and readability of the codebase by organizing and documenting component properties and methods.
37 lines
738 B
Lua
37 lines
738 B
Lua
---@class AudiencePulse
|
|
local M = {}
|
|
|
|
---@class Metrics
|
|
---@field messagesPerMinute? number
|
|
---@field reactionsPerMinute? number
|
|
---@field viewers? number
|
|
|
|
---@class PulseResult
|
|
---@field score number
|
|
---@field tier "surging"|"steady"|"cooling"
|
|
|
|
---@param metrics Metrics
|
|
---@return PulseResult
|
|
function M.score(metrics)
|
|
local messages = metrics.messagesPerMinute or 0
|
|
local reactions = metrics.reactionsPerMinute or 0
|
|
local viewers = metrics.viewers or 1
|
|
|
|
local raw = (messages * 0.6) + (reactions * 0.4)
|
|
local score = (raw / viewers) * 100
|
|
|
|
local tier = "steady"
|
|
if score >= 80 then
|
|
tier = "surging"
|
|
elseif score <= 30 then
|
|
tier = "cooling"
|
|
end
|
|
|
|
return {
|
|
score = score,
|
|
tier = tier
|
|
}
|
|
end
|
|
|
|
return M
|