mirror of
https://github.com/m1k1o/neko.git
synced 2025-04-29 18:36:22 +02:00
fix duplicate screen sizes.
This commit is contained in:
parent
e719109116
commit
6fbdea979f
1 changed files with 10 additions and 5 deletions
|
@ -39,10 +39,13 @@ func profileToMember(id string, profile types.MemberProfile) (*oldTypes.Member,
|
||||||
}
|
}
|
||||||
|
|
||||||
func screenConfigurations(screenSizes []types.ScreenSize) map[int]oldTypes.ScreenConfiguration {
|
func screenConfigurations(screenSizes []types.ScreenSize) map[int]oldTypes.ScreenConfiguration {
|
||||||
rates := map[string][]int16{}
|
rates := map[string]map[int16]struct{}{}
|
||||||
for _, size := range screenSizes {
|
for _, size := range screenSizes {
|
||||||
key := fmt.Sprintf("%dx%d", size.Width, size.Height)
|
key := fmt.Sprintf("%dx%d", size.Width, size.Height)
|
||||||
rates[key] = append(rates[key], size.Rate)
|
if _, ok := rates[key]; !ok {
|
||||||
|
rates[key] = map[int16]struct{}{}
|
||||||
|
}
|
||||||
|
rates[key][size.Rate] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
usedScreenSizes := map[string]struct{}{}
|
usedScreenSizes := map[string]struct{}{}
|
||||||
|
@ -52,10 +55,12 @@ func screenConfigurations(screenSizes []types.ScreenSize) map[int]oldTypes.Scree
|
||||||
if _, ok := usedScreenSizes[key]; ok {
|
if _, ok := usedScreenSizes[key]; ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
usedScreenSizes[key] = struct{}{}
|
||||||
|
|
||||||
ratesMap := map[int]int16{}
|
c, ratesMap := 0, map[int]int16{}
|
||||||
for i, rate := range rates[key] {
|
for rate := range rates[key] {
|
||||||
ratesMap[i] = rate
|
ratesMap[c] = rate
|
||||||
|
c++
|
||||||
}
|
}
|
||||||
|
|
||||||
screenSizesList[i] = oldTypes.ScreenConfiguration{
|
screenSizesList[i] = oldTypes.ScreenConfiguration{
|
||||||
|
|
Loading…
Add table
Reference in a new issue