fmt: GetActionLogs
This commit is contained in:
parent
58593c6f04
commit
581536a60f
|
|
@ -481,16 +481,20 @@ func (api *oliveTinAPI) GetActionLogs(ctx ctx.Context, req *connect.Request[apiv
|
|||
ret.StartOffset = page.start
|
||||
return connect.NewResponse(ret), nil
|
||||
}
|
||||
// Newest-first slicing: compute reversed indices
|
||||
startIdx := page.total - page.end
|
||||
endIdx := page.total - page.start
|
||||
if startIdx < 0 { startIdx = 0 }
|
||||
if endIdx > int64(len(filtered)) { endIdx = int64(len(filtered)) }
|
||||
for _, le := range filtered[startIdx:endIdx] {
|
||||
ret.Logs = append(ret.Logs, api.internalLogEntryToPb(le, user))
|
||||
}
|
||||
// Entries older than the returned newest page
|
||||
ret.CountRemaining = page.start
|
||||
// Newest-first slicing: compute reversed indices
|
||||
startIdx := page.total - page.end
|
||||
endIdx := page.total - page.start
|
||||
if startIdx < 0 {
|
||||
startIdx = 0
|
||||
}
|
||||
if endIdx > int64(len(filtered)) {
|
||||
endIdx = int64(len(filtered))
|
||||
}
|
||||
for _, le := range filtered[startIdx:endIdx] {
|
||||
ret.Logs = append(ret.Logs, api.internalLogEntryToPb(le, user))
|
||||
}
|
||||
// Entries older than the returned newest page
|
||||
ret.CountRemaining = page.start
|
||||
ret.PageSize = page.size
|
||||
ret.TotalCount = page.total
|
||||
ret.StartOffset = page.start
|
||||
|
|
|
|||
Loading…
Reference in New Issue