mirror of
https://github.com/hay-kot/homebox.git
synced 2025-07-05 10:08:35 +00:00
fix: profile bugs and add full path (#792)
* fix template rendering * tidy * fix missing currencies and profile errors * endpoint for fullpath of an item * endpoint test * fix assertions
This commit is contained in:
parent
3ed50f5a1b
commit
c708b1759e
19 changed files with 416 additions and 105 deletions
|
@ -74,18 +74,23 @@ func (cs *CurrencyRegistry) Slice() []Currency {
|
|||
cs.mu.RLock()
|
||||
defer cs.mu.RUnlock()
|
||||
|
||||
keys := make([]string, 0, len(cs.registry))
|
||||
for key := range cs.registry {
|
||||
keys = append(keys, key)
|
||||
}
|
||||
|
||||
slices.Sort(keys)
|
||||
|
||||
out := make([]Currency, 0, len(cs.registry))
|
||||
for i := range keys {
|
||||
out = append(out, cs.registry[keys[i]])
|
||||
for key := range cs.registry {
|
||||
out = append(out, cs.registry[key])
|
||||
}
|
||||
|
||||
slices.SortFunc(out, func(a, b Currency) int {
|
||||
if a.Name < b.Name {
|
||||
return -1
|
||||
}
|
||||
|
||||
if a.Name > b.Name {
|
||||
return 1
|
||||
}
|
||||
|
||||
return 0
|
||||
})
|
||||
|
||||
return out
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,10 @@
|
|||
[
|
||||
{
|
||||
"code": "USD",
|
||||
"local": "United States",
|
||||
"symbol": "$",
|
||||
"name": "United States Dollar"
|
||||
},
|
||||
{
|
||||
"code": "AED",
|
||||
"local": "United Arab Emirates",
|
||||
|
|
|
@ -84,7 +84,7 @@ func (csf LocationString) String() string {
|
|||
return strings.Join(csf, " / ")
|
||||
}
|
||||
|
||||
func fromPathSlice(s []repo.LocationPath) LocationString {
|
||||
func fromPathSlice(s []repo.ItemPath) LocationString {
|
||||
v := make(LocationString, len(s))
|
||||
|
||||
for i := range s {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue