diff --git a/ikuzo/service/x/nde/dataset.go b/ikuzo/service/x/nde/dataset.go index 5a9e548c..89b0562f 100644 --- a/ikuzo/service/x/nde/dataset.go +++ b/ikuzo/service/x/nde/dataset.go @@ -117,7 +117,7 @@ func (hv *HydraView) setPager() { hv.First = map[string]string{"@id": hv.hydraPage(1)} next := hv.currentPage + 1 - totalPages := int(hv.TotalItems / hydraObjectPerPage) + totalPages := int(hv.TotalItems/hydraObjectPerPage) + 1 if next <= totalPages { hv.Next = map[string]string{"@id": hv.hydraPage(next)} } diff --git a/ikuzo/service/x/nde/dataset_test.go b/ikuzo/service/x/nde/dataset_test.go index 536d5e61..56bf3ea2 100644 --- a/ikuzo/service/x/nde/dataset_test.go +++ b/ikuzo/service/x/nde/dataset_test.go @@ -52,7 +52,7 @@ func TestHydraView_setPager(t *testing.T) { Type: hydraType, First: firstPage, Next: map[string]string{"@id": "/catalog?page=2"}, - Last: map[string]string{"@id": "/catalog?page=14"}, + Last: map[string]string{"@id": "/catalog?page=15"}, baseID: baseID, TotalItems: 7012, currentPage: 1, @@ -71,7 +71,7 @@ func TestHydraView_setPager(t *testing.T) { Type: hydraType, First: map[string]string{"@id": "/catalog?page=1"}, Next: map[string]string{"@id": "/catalog?page=5"}, - Last: map[string]string{"@id": "/catalog?page=14"}, + Last: map[string]string{"@id": "/catalog?page=15"}, baseID: baseID, TotalItems: 7012, currentPage: 4, @@ -83,17 +83,17 @@ func TestHydraView_setPager(t *testing.T) { Type: hydraType, baseID: baseID, total: 7012, - currentPage: 13, + currentPage: 14, }, &HydraView{ - ID: "/catalog?page=13", + ID: "/catalog?page=14", Type: hydraType, First: map[string]string{"@id": "/catalog?page=1"}, - Next: map[string]string{"@id": "/catalog?page=14"}, - Last: map[string]string{"@id": "/catalog?page=14"}, + Next: map[string]string{"@id": "/catalog?page=15"}, + Last: map[string]string{"@id": "/catalog?page=15"}, baseID: baseID, TotalItems: 7012, - currentPage: 13, + currentPage: 14, }, }, }