Fix empties
This commit is contained in:
parent
f4487c0040
commit
e3593d4321
@ -49,7 +49,17 @@ func Queue(c *fiber.Ctx) error {
|
|||||||
return finalReturn[i].Source.Name < finalReturn[j].Source.Name
|
return finalReturn[i].Source.Name < finalReturn[j].Source.Name
|
||||||
})
|
})
|
||||||
|
|
||||||
result := finalReturn[adjustedPageNum*pageSize : (adjustedPageNum+1)*pageSize]
|
var result []domain.BuildQueueItem
|
||||||
|
startIndex := adjustedPageNum * pageSize
|
||||||
|
endIndex := (adjustedPageNum + 1) * pageSize
|
||||||
|
if startIndex >= len(finalReturn) {
|
||||||
|
result = []domain.BuildQueueItem{}
|
||||||
|
} else {
|
||||||
|
if endIndex > len(finalReturn) {
|
||||||
|
endIndex = len(finalReturn)
|
||||||
|
}
|
||||||
|
result = finalReturn[startIndex:endIndex]
|
||||||
|
}
|
||||||
|
|
||||||
response := QueueResponse{
|
response := QueueResponse{
|
||||||
Total: len(finalReturn),
|
Total: len(finalReturn),
|
||||||
|
@ -52,7 +52,17 @@ func Packages(c *fiber.Ctx) error {
|
|||||||
return finalReturn[i].Name < finalReturn[j].Name
|
return finalReturn[i].Name < finalReturn[j].Name
|
||||||
})
|
})
|
||||||
|
|
||||||
result := finalReturn[adjustedPageNum*pageSize : (adjustedPageNum+1)*pageSize]
|
var result []domain.SourcePackage
|
||||||
|
startIndex := adjustedPageNum * pageSize
|
||||||
|
endIndex := (adjustedPageNum + 1) * pageSize
|
||||||
|
if startIndex >= len(finalReturn) {
|
||||||
|
result = []domain.SourcePackage{}
|
||||||
|
} else {
|
||||||
|
if endIndex > len(finalReturn) {
|
||||||
|
endIndex = len(finalReturn)
|
||||||
|
}
|
||||||
|
result = finalReturn[startIndex:endIndex]
|
||||||
|
}
|
||||||
|
|
||||||
response := PackagesResponse{
|
response := PackagesResponse{
|
||||||
Total: len(finalReturn),
|
Total: len(finalReturn),
|
||||||
|
Loading…
Reference in New Issue
Block a user