-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Conversation
012063a
to
8c77904
Compare
fix go-gitea#16648 Signed-off-by: a1012112796 <1012112796@qq.com>
8c77904
to
b461a05
Compare
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
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 | ||
} | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See the code removed in https://github.com/go-gitea/gitea/pull/14032/files
There was a problem hiding this comment.
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.
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 <art27@cantab.net>
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 <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
…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 <art27@cantab.net>
#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 <art27@cantab.net>
fix #16648