Commit df52bf5e authored by Steven's avatar Steven

fix: tag count

parent 35df62a9
...@@ -125,9 +125,15 @@ func (s *APIV1Service) GetUserStats(ctx context.Context, request *v1pb.GetUserSt ...@@ -125,9 +125,15 @@ 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 tagCount[tag] == 0 {
tagCount[tag] = 1
}
tagCount[tag]++
}
if memo.Payload.Property != nil {
if memo.Payload.Property.HasLink { if memo.Payload.Property.HasLink {
linkCount++ linkCount++
} }
...@@ -141,7 +147,7 @@ func (s *APIV1Service) GetUserStats(ctx context.Context, request *v1pb.GetUserSt ...@@ -141,7 +147,7 @@ func (s *APIV1Service) GetUserStats(ctx context.Context, request *v1pb.GetUserSt
undoCount++ 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))
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment