MCPcopy Create free account
hub / github.com/apache/answer / getActivityUserVoteStat

Method getActivityUserVoteStat

internal/service/content/user_service.go:898–918  ·  view source on GitHub ↗
(ctx context.Context, startTime, endTime time.Time, limit int,
	userIDExist map[string]bool)

Source from the content-addressed store, hash-verified

896}
897
898func (us *UserService) getActivityUserVoteStat(ctx context.Context, startTime, endTime time.Time, limit int,
899 userIDExist map[string]bool) (voteStat []*entity.ActivityUserVoteStat, userIDs []string, err error) {
900 if plugin.RankAgentEnabled() {
901 return make([]*entity.ActivityUserVoteStat, 0), make([]string, 0), nil
902 }
903 voteStat, err = us.activityRepo.GetUsersWhoHasVoteMost(ctx, startTime, endTime, limit)
904 if err != nil {
905 return nil, nil, err
906 }
907 for _, stat := range voteStat {
908 if stat.VoteCount <= 0 {
909 continue
910 }
911 if userIDExist[stat.UserID] {
912 continue
913 }
914 userIDs = append(userIDs, stat.UserID)
915 userIDExist[stat.UserID] = true
916 }
917 return voteStat, userIDs, nil
918}
919
920func (us *UserService) getStaff(ctx context.Context, userIDExist map[string]bool) (
921 userRoleRels []*entity.UserRoleRel, userIDs []string, err error) {

Callers 1

UserRankingMethod · 0.95

Calls 2

RankAgentEnabledFunction · 0.92

Tested by

no test coverage detected