Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the number of Repository for Organization on dashboard page #16799

Closed
wants to merge 1 commit into from

Conversation

a1012112796
Copy link
Member

fix #16648

@codecov-commenter
Copy link

Codecov Report

Merging #16799 (b461a05) into main (1cd4a3b) will increase coverage by 0.00%.
The diff coverage is 80.76%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #16799   +/-   ##
=======================================
  Coverage   45.50%   45.50%           
=======================================
  Files         762      762           
  Lines       85940    85962   +22     
=======================================
+ Hits        39108    39120   +12     
- Misses      40521    40528    +7     
- Partials     6311     6314    +3     
Impacted Files Coverage Δ
routers/web/repo/setting.go 14.41% <0.00%> (-0.02%) ⬇️
models/org.go 73.54% <78.94%> (+0.04%) ⬆️
models/repo_list.go 78.07% <100.00%> (-0.36%) ⬇️
routers/web/user/home.go 58.67% <100.00%> (ø)
modules/util/timer.go 42.85% <0.00%> (-42.86%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d22cb60...b461a05. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 24, 2021
Comment on lines +449 to +461
for _, org := range orgs {
cond := SearchRepositoryCondition(&SearchRepoOptions{
Actor: doer,
Private: true,
OwnerID: org.ID,
AllPublic: false, // Include also all public repositories of users and public organisations
AllLimited: false, // Include also all public repositories of limited organisations
})
org.NumRepos, err = countRepositoryByCondition(x, cond)
if err != nil {
return nil, err
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately this is wildly inefficient - imagine you're the kind of person that has 500 organizations.

We should just do this in one query with a couple of joins - likely including the in at 442.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

@a1012112796 a1012112796 Aug 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if too many organizations exist, maybe should paging...
Because of my poor sql knowledge, I don't know how to jon the count result with Organization. feel free to do it if you like. I have to stop this pull request now. Thanks.

@a1012112796 a1012112796 deleted the a1012/fix_org_rpo_num branch August 24, 2021 11:38
zeripath added a commit to zeripath/gitea that referenced this pull request Aug 24, 2021
Calculate and return the number of Repositories on the dashboard
Organization list.

This PR restores some of the logic that was removed in go-gitea#14032 to
calculate the number of repos on the dashboard orgs list.

Fix go-gitea#16648
Replaces go-gitea#16799

Signed-off-by: Andrew Thornton <[email protected]>
techknowlogick added a commit that referenced this pull request Sep 1, 2021
Calculate and return the number of Repositories on the dashboard
Organization list.

This PR restores some of the logic that was removed in #14032 to
calculate the number of repos on the dashboard orgs list.

Fix #16648
Replaces #16799

Signed-off-by: Andrew Thornton <[email protected]>

Co-authored-by: 6543 <[email protected]>
Co-authored-by: techknowlogick <[email protected]>
zeripath added a commit to zeripath/gitea that referenced this pull request Sep 1, 2021
…ea#16807)

Backport go-gitea#16807

Calculate and return the number of Repositories on the dashboard
Organization list.

This PR restores some of the logic that was removed in go-gitea#14032 to
calculate the number of repos on the dashboard orgs list.

Fix go-gitea#16648
Replaces go-gitea#16799

Signed-off-by: Andrew Thornton <[email protected]>
6543 pushed a commit that referenced this pull request Sep 1, 2021
#16911)

Backport #16807

Calculate and return the number of Repositories on the dashboard
Organization list.

This PR restores some of the logic that was removed in #14032 to
calculate the number of repos on the dashboard orgs list.

Fix #16648
Replaces #16799

Signed-off-by: Andrew Thornton <[email protected]>
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The number of Repository for Organization is incorrectly displayed on dashboard page
4 participants