mirror of
https://github.com/neocities/neocities.git
synced 2025-07-24 19:38:25 +02:00
show bandwidth on dashboard, fix extra stats one_to_many, clarify stats retainent and fix typo
This commit is contained in:
parent
2dd1f55119
commit
a81a708be5
5 changed files with 29 additions and 11 deletions
|
@ -205,8 +205,6 @@ class Site < Sequel::Model
|
|||
one_to_many :reports
|
||||
one_to_many :reportings, key: :reporting_site_id, class: :Report
|
||||
|
||||
one_to_many :stats
|
||||
|
||||
one_to_many :events
|
||||
|
||||
one_to_many :site_changes
|
||||
|
@ -1903,6 +1901,16 @@ class Site < Sequel::Model
|
|||
true
|
||||
end
|
||||
|
||||
def maximum_monthly_bandwidth
|
||||
PLAN_FEATURES[(parent? ? self : parent).plan_type.to_sym][:bandwidth].to_i
|
||||
end
|
||||
|
||||
def monthly_bandwidth_used
|
||||
stat = stats_dataset.order(:created_at.desc).select(:bandwidth).first
|
||||
return 0 if stat.nil?
|
||||
stat[:bandwidth]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def store_file(path, uploaded, opts={})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue