-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fixed count of filtered issues when api request. #12275
Fixed count of filtered issues when api request. #12275
Conversation
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.
https://github.com/go-gitea/gitea/pull/12275/files#diff-6a82b880ff1ae1c2e9b577046e45a6cbR160-R171 and https://github.com/go-gitea/gitea/pull/12275/files#diff-6a82b880ff1ae1c2e9b577046e45a6cbR179-R191 are same
https://github.com/go-gitea/gitea/pull/12275/files#diff-6a82b880ff1ae1c2e9b577046e45a6cbR336-R342 and https://github.com/go-gitea/gitea/pull/12275/files#diff-6a82b880ff1ae1c2e9b577046e45a6cbR350-R360 are quite similar
can you dedublicate it by store the Options Struct into a variable you can pass to both functions?
Is possible. However, I don't think it makes much sense in terms of processing. The "models.CountIssues" and "model.Issues" arguments are references.
I think it will probably run in parallel, so I didn't think it made much sense in terms of processing. I think I can reuse the structure by splitting the option structure and using two arguments. However, because it reduces memory efficiency, I made redundant entries. |
🤔 |
Will test it tomorow :) |
I missed. Will update it after confirming the test. |
Co-authored-by: 6543 <6543@obermui.de>
routers/api/v1/repo/issue.go
Outdated
filteredCount, err = models.CountIssues(&models.IssuesOptions{ | ||
ListOptions: models.ListOptions{ | ||
Page: ctx.QueryInt("page"), | ||
PageSize: issueCount, |
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.
PageSize: issueCount, | |
PageSize: setting.UI.IssuePagingNum, |
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 you dedub things this is not needed anyway ...
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.
This is for the purpose of getting the maximum value that matches the filter.
Therefore, the current maximum value is set as an option.
I would say dedub/refactor things and I'll check it again - for me it looks like there is something still missing but I'll dig deeper into it after you changed the code :) |
…gitea into fixed_count_of_filteredIssues
@hinoshiba let me know if you are ready for review again :) |
Ok, Just a moment. |
@6543 Finished update. |
just format nits: hinoshiba#1 |
EDIT: thanks |
|
Ok, I'm Update. |
well github code suggestions have there up and downs ;) |
can you resolve the conflict? It looks like nobody had time to look at it :/ |
Ok, I just updated. |
Codecov Report
@@ Coverage Diff @@
## master #12275 +/- ##
==========================================
- Coverage 43.09% 43.08% -0.01%
==========================================
Files 658 658
Lines 72455 72477 +22
==========================================
+ Hits 31226 31230 +4
- Misses 36175 36183 +8
- Partials 5054 5064 +10
Continue to review full report at Codecov.
|
Co-authored-by: zeripath <art27@cantab.net>
The search results for "The issues" will respond with the total number of issues in repository instead of the number of search results.
This result in pages that do not have a value in
rel = last
on the response HTTP header "Link".api/v1/repos/issues/search
api/v1/repos/{repo}/issues/
If you create about 10 "The issues" and close 2 of them, the final link is
page=10
, even if?limit=1&page=1&state=open
. In such cases, the final link should bepage=8
. This has been fixed.And, there was an extra reservation for the slice the related code, so I fixed it.