Move in profile struct
This commit is contained in:
parent
27be2088f5
commit
2822ab459a
2
go.mod
2
go.mod
@ -4,7 +4,7 @@ go 1.23.4
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
git.defalsify.org/vise.git v0.2.3-0.20250103172917-3e190a44568d
|
git.defalsify.org/vise.git v0.2.3-0.20250103172917-3e190a44568d
|
||||||
git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250111204110-3e32ada4c0e2
|
git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250111211303-3ea726a0302c
|
||||||
git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250111163106-c93a07832daa
|
git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250111163106-c93a07832daa
|
||||||
git.grassecon.net/grassrootseconomics/visedriver-africastalking v0.0.0-20250111203946-a65fe6559956
|
git.grassecon.net/grassrootseconomics/visedriver-africastalking v0.0.0-20250111203946-a65fe6559956
|
||||||
github.com/alecthomas/assert/v2 v2.2.2
|
github.com/alecthomas/assert/v2 v2.2.2
|
||||||
|
4
go.sum
4
go.sum
@ -1,7 +1,7 @@
|
|||||||
git.defalsify.org/vise.git v0.2.3-0.20250103172917-3e190a44568d h1:bPAOVZOX4frSGhfOdcj7kc555f8dc9DmMd2YAyC2AMw=
|
git.defalsify.org/vise.git v0.2.3-0.20250103172917-3e190a44568d h1:bPAOVZOX4frSGhfOdcj7kc555f8dc9DmMd2YAyC2AMw=
|
||||||
git.defalsify.org/vise.git v0.2.3-0.20250103172917-3e190a44568d/go.mod h1:jyBMe1qTYUz3mmuoC9JQ/TvFeW0vTanCUcPu3H8p4Ck=
|
git.defalsify.org/vise.git v0.2.3-0.20250103172917-3e190a44568d/go.mod h1:jyBMe1qTYUz3mmuoC9JQ/TvFeW0vTanCUcPu3H8p4Ck=
|
||||||
git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250111204110-3e32ada4c0e2 h1:Zy7SHgZ+f9hrQKxEC9Q22MwUH8XDjEH+35voXNRyVsU=
|
git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250111211303-3ea726a0302c h1:5h1nsczPXBhOfe5Wbyccp3ontooztKUVAtDw8aoT8BI=
|
||||||
git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250111204110-3e32ada4c0e2/go.mod h1:CXdVutRsCkdWWCJ9hELi/72z3FDKkhLksxCXBSnjuKI=
|
git.grassecon.net/grassrootseconomics/sarafu-api v0.0.0-20250111211303-3ea726a0302c/go.mod h1:CXdVutRsCkdWWCJ9hELi/72z3FDKkhLksxCXBSnjuKI=
|
||||||
git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250111163106-c93a07832daa h1:owrXxiDOp7uuyvGxi4DU8gu8PyA7YxVnX8bo7i28Anw=
|
git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250111163106-c93a07832daa h1:owrXxiDOp7uuyvGxi4DU8gu8PyA7YxVnX8bo7i28Anw=
|
||||||
git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250111163106-c93a07832daa/go.mod h1:E6W7ZOa7ZvVr0Bc5ot0LNSwpSPYq4hXlAIvEPy3AJ7U=
|
git.grassecon.net/grassrootseconomics/visedriver v0.8.0-beta.10.0.20250111163106-c93a07832daa/go.mod h1:E6W7ZOa7ZvVr0Bc5ot0LNSwpSPYq4hXlAIvEPy3AJ7U=
|
||||||
git.grassecon.net/grassrootseconomics/visedriver-africastalking v0.0.0-20250111203946-a65fe6559956 h1:wTfH1CP0bh1JDcrJoqbBlnpmelpPSOslknCeCXPUpLs=
|
git.grassecon.net/grassrootseconomics/visedriver-africastalking v0.0.0-20250111203946-a65fe6559956 h1:wTfH1CP0bh1JDcrJoqbBlnpmelpPSOslknCeCXPUpLs=
|
||||||
|
@ -21,7 +21,7 @@ import (
|
|||||||
"git.grassecon.net/grassrootseconomics/visedriver/common"
|
"git.grassecon.net/grassrootseconomics/visedriver/common"
|
||||||
"git.grassecon.net/grassrootseconomics/visedriver/utils"
|
"git.grassecon.net/grassrootseconomics/visedriver/utils"
|
||||||
|
|
||||||
"git.grassecon.net/grassrootseconomics/sarafu-api/models"
|
"git.grassecon.net/grassrootseconomics/sarafu-vise/profile"
|
||||||
"git.grassecon.net/grassrootseconomics/sarafu-api/remote"
|
"git.grassecon.net/grassrootseconomics/sarafu-api/remote"
|
||||||
|
|
||||||
dbstorage "git.grassecon.net/grassrootseconomics/visedriver/storage/db"
|
dbstorage "git.grassecon.net/grassrootseconomics/visedriver/storage/db"
|
||||||
@ -66,7 +66,7 @@ type MenuHandlers struct {
|
|||||||
flagManager *asm.FlagParser
|
flagManager *asm.FlagParser
|
||||||
accountService remote.AccountService
|
accountService remote.AccountService
|
||||||
prefixDb dbstorage.PrefixDb
|
prefixDb dbstorage.PrefixDb
|
||||||
profile *models.Profile
|
profile *profile.Profile
|
||||||
ReplaceSeparatorFunc func(string) string
|
ReplaceSeparatorFunc func(string) string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ func NewMenuHandlers(appFlags *asm.FlagParser, userdataStore db.Db, adminstore *
|
|||||||
adminstore: adminstore,
|
adminstore: adminstore,
|
||||||
accountService: accountService,
|
accountService: accountService,
|
||||||
prefixDb: prefixDb,
|
prefixDb: prefixDb,
|
||||||
profile: &models.Profile{Max: 6},
|
profile: &profile.Profile{Max: 6},
|
||||||
ReplaceSeparatorFunc: replaceSeparatorFunc,
|
ReplaceSeparatorFunc: replaceSeparatorFunc,
|
||||||
}
|
}
|
||||||
return h, nil
|
return h, nil
|
||||||
|
18
profile/profile.go
Normal file
18
profile/profile.go
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package profile
|
||||||
|
|
||||||
|
type Profile struct {
|
||||||
|
ProfileItems []string
|
||||||
|
Max int
|
||||||
|
}
|
||||||
|
|
||||||
|
func (p *Profile) InsertOrShift(index int, value string) {
|
||||||
|
if index < len(p.ProfileItems) {
|
||||||
|
p.ProfileItems = append(p.ProfileItems[:index], value)
|
||||||
|
} else {
|
||||||
|
for len(p.ProfileItems) < index {
|
||||||
|
p.ProfileItems = append(p.ProfileItems, "0")
|
||||||
|
}
|
||||||
|
p.ProfileItems = append(p.ProfileItems, "0")
|
||||||
|
p.ProfileItems[index] = value
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user