Gitea: Stop depending on magic numbers in database

Created on 15 Jun 2017  路  8Comments  路  Source: go-gitea/gitea

Sparking from https://github.com/go-gitea/gitea/issues/1937

The reason we have repository.num_issues isn't to know how many issues there are, but to know what issue-number to assign next. It should _not_ be used in the UI to list number of issues 馃檮

kinproposal

Most helpful comment

Here's the code used to assign the issue number (index) nowadays:

https://github.com/go-gitea/gitea/blob/cc2916dc5acea2c32372082986f8c2e2c43e55fe/models/issue.go#L901-L905

Not to say it can't be improved. 馃槃

All 8 comments

Is this still an issue?

For count we should probably could use cache like I changed it in commit count

In kind of a related note, is there a method to 'reset' the issue counts? ie: num_issues

@uncled1023 As far as I know, no. The only way is to open up the database and run a query. Do note that count(...) will break things, as num_issues is used to select the number for the next opened issue or pull-request 馃槖 (That also needs to be fixed 馃槈 )

I don't think this is still the case but I will have to re-check

I don't think this is still the case but I will have to re-check

@sapk I can confirm it's not the case.

Here's the code used to assign the issue number (index) nowadays:

https://github.com/go-gitea/gitea/blob/cc2916dc5acea2c32372082986f8c2e2c43e55fe/models/issue.go#L901-L905

Not to say it can't be improved. 馃槃

Thanks to confirm that. I will close this issue so.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lunny picture lunny  路  3Comments

flozz picture flozz  路  3Comments

adpande picture adpande  路  3Comments

Fastidious picture Fastidious  路  3Comments

thehowl picture thehowl  路  3Comments