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 language stat calculation #11692

Merged
merged 3 commits into from
May 30, 2020
Merged

Fix language stat calculation #11692

merged 3 commits into from
May 30, 2020

Conversation

CirnoT
Copy link
Contributor

@CirnoT CirnoT commented May 30, 2020

As discussed on Discord; #11681 broke primary language selection by storing excluded languages in database along with explicit "other".

This PR makes it so that "other" and excluded languages are not stored in database allowing us to replicate languages API the same way GitHub does.


  • Fixes issue where excluded language was stored in database as primary language but not displayed on language bar, causing situation where repo was shown as YAML on explore page but no YAML was present on language bar
  • Removes storing of "other" in database
  • Ignore files with 0 size
  • Use language grouping (SCSS->CSS; Pug->HTML)
  • Removes SQL from list of special languages

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label May 30, 2020
@CirnoT
Copy link
Contributor Author

CirnoT commented May 30, 2020

Okay, after going through some tests and discovering some weird behaviors whereas GitHub does not recalculate old repos I make these changes:

  • Ignore files with 0 size
  • Add language grouping (SCSS->CSS; Pug->HTML)

I've tested it on mirror repo from GH and the stats are 1:1 identical in database with what GH shows via API.

@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 May 30, 2020
Copy link
Member

@guillep2k guillep2k left a comment

Choose a reason for hiding this comment

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

LGTM if the mentioned behavior is intended.

@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 May 30, 2020
@lafriks lafriks merged commit 9d65200 into go-gitea:master May 30, 2020
@CirnoT CirnoT deleted the language-stats branch May 31, 2020 00:41
lafriks pushed a commit to lafriks-fork/gitea that referenced this pull request Jun 1, 2020
* Fix language stat calculation

* Group languages and ignore 0 size files

* remove unneeded code
@lafriks lafriks added the backport/done All backports for this PR have been created label Jun 1, 2020
lafriks added a commit that referenced this pull request Jun 2, 2020
#11690)

* Change language statistics to save size instead of percentage (#11681)

* Change language statistics to save size instead of percentage in database

Co-Authored-By: Cirno the Strongest <[email protected]>

* Do not exclude if only language

* Fix edge cases with special langauges

Co-authored-by: Cirno the Strongest <[email protected]>

* Fix language stat calculation (#11692)

* Fix language stat calculation

* Group languages and ignore 0 size files

* remove unneeded code

Co-authored-by: Cirno the Strongest <[email protected]>
ydelafollye pushed a commit to ydelafollye/gitea that referenced this pull request Jul 31, 2020
* Fix language stat calculation

* Group languages and ignore 0 size files

* remove unneeded code
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants