mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-18 08:00:01 +02:00
Backport #24900 Fix #24896 If users set different languages by `linguist-language`, the `stats` map could be: `java: 100, Java: 200`. Language stats are stored as case-insensitive in database and there is a unique key. So, the different language names should be merged to one unique name: `Java: 300` (cherry picked from commit a83d597989bbfa6d7c10a1737bc40faa83224342)
This commit is contained in:
parent
5fdac0d46a
commit
6d3b3af57d
4 changed files with 58 additions and 5 deletions
|
@ -30,3 +30,17 @@ func TestRepository_GetLanguageStats(t *testing.T) {
|
|||
"Java": 112,
|
||||
}, stats)
|
||||
}
|
||||
|
||||
func TestMergeLanguageStats(t *testing.T) {
|
||||
assert.EqualValues(t, map[string]int64{
|
||||
"PHP": 1,
|
||||
"python": 10,
|
||||
"JAVA": 700,
|
||||
}, mergeLanguageStats(map[string]int64{
|
||||
"PHP": 1,
|
||||
"python": 10,
|
||||
"Java": 100,
|
||||
"java": 200,
|
||||
"JAVA": 400,
|
||||
}))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue