Files
PrivateCaptcha/pkg/common/timecount.go
Copilot 9f101a13ff Split settings usage stats by organization (#256)
* Initial plan

* Split account stats by organization

Co-authored-by: ribtoks <505555+ribtoks@users.noreply.github.com>

* Fix usage chart layout and stats handler

Co-authored-by: ribtoks <505555+ribtoks@users.noreply.github.com>

* Address code review feedback

Co-authored-by: ribtoks <505555+ribtoks@users.noreply.github.com>

* Clarify account stats warning log

Co-authored-by: ribtoks <505555+ribtoks@users.noreply.github.com>

* Adjust stats logging and legend layout

Co-authored-by: ribtoks <505555+ribtoks@users.noreply.github.com>

* Move legend sizing constants

Co-authored-by: ribtoks <505555+ribtoks@users.noreply.github.com>

* Document legend sizing constants

Co-authored-by: ribtoks <505555+ribtoks@users.noreply.github.com>

* Refine legend text measurement

Co-authored-by: ribtoks <505555+ribtoks@users.noreply.github.com>

* Improve legend truncation and logging

Co-authored-by: ribtoks <505555+ribtoks@users.noreply.github.com>

* Cosmetic improvements

* Refactor legend layout logic

Co-authored-by: ribtoks <505555+ribtoks@users.noreply.github.com>

* Tweak legend row spacing

Co-authored-by: ribtoks <505555+ribtoks@users.noreply.github.com>

* Clarify legend layout fields

Co-authored-by: ribtoks <505555+ribtoks@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ribtoks <505555+ribtoks@users.noreply.github.com>
Co-authored-by: Taras Kushnir <tk.dev@mailbox.org>
2026-01-17 09:56:46 +02:00

45 lines
692 B
Go

package common
import "time"
type TimePeriod int
const (
TimePeriodToday TimePeriod = iota
TimePeriodWeek TimePeriod = iota
TimePeriodMonth TimePeriod = iota
TimePeriodYear TimePeriod = iota
)
func (tp TimePeriod) String() string {
switch tp {
case TimePeriodToday:
return "today"
case TimePeriodWeek:
return "week"
case TimePeriodMonth:
return "month"
case TimePeriodYear:
return "year"
default:
return "unknown"
}
}
type TimePeriodStat struct {
Timestamp time.Time
RequestsCount int
VerifiesCount int
}
type TimeCount struct {
Timestamp time.Time
Count uint32
}
type OrgTimeCount struct {
OrgID int32
Timestamp time.Time
Count uint32
}