1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

feat: implement computation of users first heartbeats data time

This commit is contained in:
Ferdinand Mütsch
2022-12-23 13:41:32 +01:00
parent ebcf87ea93
commit 8a94fef06b
10 changed files with 117 additions and 20 deletions

View File

@@ -739,6 +739,13 @@ func (h *SettingsHandler) buildViewModel(r *http.Request) *view.SettingsViewMode
subscriptionPrice = h.config.Subscriptions.StandardPrice
}
// user first data
var firstData time.Time
firstDataKv := h.keyValueSrvc.MustGetString(fmt.Sprintf("%s_%s", conf.KeyFirstHeartbeat, user.ID))
if firstDataKv.Value != "" {
firstData, _ = time.Parse(time.RFC822Z, firstDataKv.Value)
}
return &view.SettingsViewModel{
User: user,
LanguageMappings: mappings,
@@ -746,6 +753,7 @@ func (h *SettingsHandler) buildViewModel(r *http.Request) *view.SettingsViewMode
Labels: combinedLabels,
Projects: projects,
ApiKey: user.ApiKey,
UserFirstData: firstData,
SubscriptionPrice: subscriptionPrice,
SupportContact: h.config.App.SupportContact,
DataRetentionMonths: h.config.App.DataRetentionMonths,