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

Repo Activity: count new issues that were closed #31776

Merged
merged 5 commits into from
Sep 21, 2024

Conversation

tmnvanderberg
Copy link
Contributor

@tmnvanderberg tmnvanderberg commented Aug 4, 2024

I'm new to go and contributing to gitea, your guidance is much appreciated.

This is meant to solve #13309

Previously, closed issues would not be shown under new issues in the
activity tab, even if they were newly created.

changes:

  • Split out newlyCreatedIssues from issuesForActivityStatement to count
    both currently open and closed issues.
  • Use a seperate function to count active issues to prevent
    double-counting issues after the above change.

Result is that new issues that have been closed are shown both under "new" and "closed".

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 4, 2024
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 4, 2024
@tmnvanderberg tmnvanderberg changed the title Repo: count new issues that were closed Repo Activity: count new issues that were closed Aug 4, 2024
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Aug 4, 2024
Previously, closed issues would not be shown under new issues in the
activity tab, even if they were newly created.

changes:
* Split out newlyCreatedIssues from issuesForActivityStatement to count
  both currently open and closed issues.
* Use a seperate function to count active issues to prevent
double-counting issues.

Signed-off-by: Timon van der Berg <[email protected]>
@lunny lunny added this to the 1.23.0 milestone Aug 5, 2024
@lunny lunny added the type/enhancement An improvement of existing functionality label Aug 5, 2024
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Aug 5, 2024
@lunny
Copy link
Member

lunny commented Sep 20, 2024

last call for merge @go-gitea/technical-oversight-committee


func activeIssues(ctx context.Context, repoID int64, fromTime time.Time) *xorm.Session {
sess := db.GetEngine(ctx).Where("issue.repo_id = ?", repoID).
And("issue.is_pull = ?", false).
Copy link
Member

Choose a reason for hiding this comment

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

I am a bit confused, in the issue it explicitly states:

For PRs, it is basically the same issue.

but they are excluded right now?
So do they have the same problem or not?

Apart from that, LGTM.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, pull requests suffer from the same problem. So this fix is only for part of the problem affecting the issue counts.

However, that is unrelated to this code snippet which is counting issues, and hence should filter out pull requets.

If this PR is approved I will be happy to submit a similar fix for pull requests.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Sep 21, 2024
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Sep 21, 2024
@lunny lunny enabled auto-merge (squash) September 21, 2024 18:20
@lunny lunny merged commit ebfde84 into go-gitea:main Sep 21, 2024
26 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Sep 21, 2024
zjjhot added a commit to zjjhot/gitea that referenced this pull request Sep 23, 2024
* giteaofficial/main:
  [skip ci] Updated licenses and gitignores
  Fix rename branch permission bug (go-gitea#32066)
  Fix artifact v4 upload above 8MB (go-gitea#31664)
  [skip ci] Updated translations via Crowdin
  Add bin to Composer Metadata (go-gitea#32099)
  Fix wrong last modify time (go-gitea#32102)
  Fix upload maven pacakge parallelly (go-gitea#31851)
  Repo Activity: count new issues that were closed (go-gitea#31776)
  Count typescript files as frontend for labeling (go-gitea#32088)
  Use camo.Always instead of camo.Allways (go-gitea#32097)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code size/M Denotes a PR that changes 30-99 lines, ignoring generated files. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants