Issue totals are wrong when filtering by team #8924

Closed
opened 2025-11-02 08:23:16 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @jpraet on GitHub (May 6, 2022).

Description

The issue totals for "Assigned to you", "Created by you" and "Mentioning you" are incorrect in the statistics when filtering on team, when the current filter is "In your repositories".

image

When selecting another filter, they are correct:

image

I recently upgraded from 1.16.4 to 1.16.7, and I believe it may be a regression in #18916.

Gitea Version

1.16.7

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

docker

Database

No response

Originally created by @jpraet on GitHub (May 6, 2022). ### Description The issue totals for "Assigned to you", "Created by you" and "Mentioning you" are incorrect in the statistics when filtering on team, when the current filter is "In your repositories". ![image](https://user-images.githubusercontent.com/2212615/167148065-e565505e-460d-4729-8c8b-c37069bc08d9.png) When selecting another filter, they are correct: ![image](https://user-images.githubusercontent.com/2212615/167148163-a8b280db-7099-4c82-84ee-b16d86ab7c15.png) I recently upgraded from 1.16.4 to 1.16.7, and I believe it may be a regression in #18916. ### Gitea Version 1.16.7 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? docker ### Database _No response_
GiteaMirror added the issue/regressiontype/bug labels 2025-11-02 08:23:16 -06:00
Author
Owner

@Gusted commented on GitHub (May 6, 2022):

Yup seems to be a regression from https://github.com/go-gitea/gitea/pull/18916. Not really able to debug this, but if anyone wants to give a try models.SearchRepositoryCondition(repoOpts) seems to be the faulty here, it's returning the incorrect repoID's.

@Gusted commented on GitHub (May 6, 2022): Yup seems to be a regression from https://github.com/go-gitea/gitea/pull/18916. Not really able to debug this, but if anyone wants to give a try ` models.SearchRepositoryCondition(repoOpts)` seems to be the faulty here, it's returning the incorrect repoID's.
Author
Owner

@wxiaoguang commented on GitHub (May 6, 2022):

Maybe it's caused by that the RepoCond is applied too early.

		if filterMode == models.FilterModeYourRepositories {
			statsOpts.RepoCond = models.SearchRepositoryCondition(repoOpts)
		}
		// GetUserIssueStats needs to count all kinds of issues like YourRepositoriesCount / AssignCount / CreateCount
		// however, the statsOpts.RepoCond has been limited by FilterModeYourRepositories
		issueStats, err = models.GetUserIssueStats(statsOpts)
@wxiaoguang commented on GitHub (May 6, 2022): Maybe it's caused by that the RepoCond is applied too early. ```go if filterMode == models.FilterModeYourRepositories { statsOpts.RepoCond = models.SearchRepositoryCondition(repoOpts) } // GetUserIssueStats needs to count all kinds of issues like YourRepositoriesCount / AssignCount / CreateCount // however, the statsOpts.RepoCond has been limited by FilterModeYourRepositories issueStats, err = models.GetUserIssueStats(statsOpts) ```
Author
Owner

@jpraet commented on GitHub (May 7, 2022):

0eac09e066/routers/web/user/home.go (L601-L604)

By setting the UserID to 0 the stats for assigned / created / mention cannot work.

@jpraet commented on GitHub (May 7, 2022): https://github.com/go-gitea/gitea/blob/0eac09e0662ae70b8b6e3e5e8c33547c79ff7124/routers/web/user/home.go#L601-L604 By setting the UserID to 0 the stats for assigned / created / mention cannot work.
Author
Owner

@Gusted commented on GitHub (May 8, 2022):

Maybe it's caused by that the RepoCond is applied too early.

		if filterMode == models.FilterModeYourRepositories {
			statsOpts.RepoCond = models.SearchRepositoryCondition(repoOpts)
		}
		// GetUserIssueStats needs to count all kinds of issues like YourRepositoriesCount / AssignCount / CreateCount
		// however, the statsOpts.RepoCond has been limited by FilterModeYourRepositories
		issueStats, err = models.GetUserIssueStats(statsOpts)

Yes good catch. The overall issueStats should be independent of the filterMode 😅.

By setting the UserID to 0 the stats for assigned / created / mention cannot work.

Why not? It only makes sense for 'created', as you cannot create a issue as team. But you can mention/assign a team to a issue/PR. It actually seems like providing a 'created' item here is not correct.

@Gusted commented on GitHub (May 8, 2022): > Maybe it's caused by that the RepoCond is applied too early. > > ```go > if filterMode == models.FilterModeYourRepositories { > statsOpts.RepoCond = models.SearchRepositoryCondition(repoOpts) > } > // GetUserIssueStats needs to count all kinds of issues like YourRepositoriesCount / AssignCount / CreateCount > // however, the statsOpts.RepoCond has been limited by FilterModeYourRepositories > issueStats, err = models.GetUserIssueStats(statsOpts) > ``` Yes good catch. The overall issueStats should be independent of the filterMode 😅. > By setting the UserID to 0 the stats for assigned / created / mention cannot work. Why not? It only makes sense for 'created', as you cannot create a issue as team. But you can mention/assign a team to a issue/PR. It actually seems like providing a 'created' item here is not correct.
Author
Owner

@Gusted commented on GitHub (May 8, 2022):

#19652 refactors the code a bit and fixes the issue.

@Gusted commented on GitHub (May 8, 2022): #19652 refactors the code a bit and fixes the issue.
Author
Owner

@jpraet commented on GitHub (May 8, 2022):

By setting the UserID to 0 the stats for assigned / created / mention cannot work.

Why not? It only makes sense for 'created', as you cannot create a issue as team. But you can mention/assign a team to a issue/PR. It actually seems like providing a 'created' item here is not correct.

Ah, but this is not how this used to work before. With the dropdown box you can select to filter by team repositories:

image

  • "Assigned to you" shows the issues/pulls assigned to you in those team repo's
  • "Created by you" shows the issues/pulls you created in those team repo's
  • "Mentioning you" shows the issues/pulls mentioning you in those team repo's
  • "Review requested" shows the pulls in those team repo's that request your review
@jpraet commented on GitHub (May 8, 2022): > > By setting the UserID to 0 the stats for assigned / created / mention cannot work. > > Why not? It only makes sense for 'created', as you cannot create a issue as team. But you can mention/assign a team to a issue/PR. It actually seems like providing a 'created' item here is not correct. Ah, but this is not how this used to work before. With the dropdown box you can select to **filter** by team repositories: ![image](https://user-images.githubusercontent.com/2212615/167287859-0f935938-224b-4587-bbcc-6e91bcbeae53.png) * "Assigned to you" shows the issues/pulls assigned to you in those team repo's * "Created by you" shows the issues/pulls you created in those team repo's * "Mentioning you" shows the issues/pulls mentioning you in those team repo's * "Review requested" shows the pulls in those team repo's that request your review
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#8924