mirror of
https://github.com/usememos/memos.git
synced 2025-10-24 13:17:33 +08:00
fix: tag count
This commit is contained in:
parent
35df62a96c
commit
df52bf5e63
1 changed files with 20 additions and 14 deletions
|
|
@ -125,23 +125,29 @@ func (s *APIV1Service) GetUserStats(ctx context.Context, request *v1pb.GetUserSt
|
||||||
displayTs = memo.UpdatedTs
|
displayTs = memo.UpdatedTs
|
||||||
}
|
}
|
||||||
displayTimestamps = append(displayTimestamps, timestamppb.New(time.Unix(displayTs, 0)))
|
displayTimestamps = append(displayTimestamps, timestamppb.New(time.Unix(displayTs, 0)))
|
||||||
|
// Count different memo types based on content.
|
||||||
// Count different memo types based on content
|
if memo.Payload != nil {
|
||||||
if memo.Payload != nil && memo.Payload.Property != nil {
|
for _, tag := range memo.Payload.Tags {
|
||||||
if memo.Payload.Property.HasLink {
|
if tagCount[tag] == 0 {
|
||||||
linkCount++
|
tagCount[tag] = 1
|
||||||
|
}
|
||||||
|
tagCount[tag]++
|
||||||
}
|
}
|
||||||
if memo.Payload.Property.HasCode {
|
if memo.Payload.Property != nil {
|
||||||
codeCount++
|
if memo.Payload.Property.HasLink {
|
||||||
}
|
linkCount++
|
||||||
if memo.Payload.Property.HasTaskList {
|
}
|
||||||
todoCount++
|
if memo.Payload.Property.HasCode {
|
||||||
}
|
codeCount++
|
||||||
if memo.Payload.Property.HasIncompleteTasks {
|
}
|
||||||
undoCount++
|
if memo.Payload.Property.HasTaskList {
|
||||||
|
todoCount++
|
||||||
|
}
|
||||||
|
if memo.Payload.Property.HasIncompleteTasks {
|
||||||
|
undoCount++
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if memo.Pinned {
|
if memo.Pinned {
|
||||||
pinnedMemos = append(pinnedMemos, fmt.Sprintf("users/%d/memos/%d", userID, memo.ID))
|
pinnedMemos = append(pinnedMemos, fmt.Sprintf("users/%d/memos/%d", userID, memo.ID))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue