Signed-off-by: dusk y.bera003.06@protonmail.com
ERROR
appview/issues/issues.go
ERROR
appview/issues/issues.go
Failed to calculate interdiff for this file.
REBASED
appview/issues/router.go
REBASED
appview/issues/router.go
This patch was likely rebased, as context lines do not match.
ERROR
appview/middleware/middleware.go
ERROR
appview/middleware/middleware.go
Failed to calculate interdiff for this file.
ERROR
appview/pagination/page.go
ERROR
appview/pagination/page.go
Failed to calculate interdiff for this file.
NEW
appview/db/issues.go
NEW
appview/db/issues.go
···
216
216
// get next issue_id
217
217
var newIssueId int
218
218
err := tx.QueryRow(`
219
-
update repo_issue_seqs
220
-
set next_issue_id = next_issue_id + 1
221
-
where repo_at = ?
219
+
update repo_issue_seqs
220
+
set next_issue_id = next_issue_id + 1
221
+
where repo_at = ?
222
222
returning next_issue_id - 1
223
223
`, issue.RepoAt).Scan(&newIssueId)
224
224
if err != nil {
···
261
261
whereClause = " where " + strings.Join(conditions, " and ")
262
262
}
263
263
264
-
pLower := FilterGte("row_num", page.Offset+1)
265
-
pUpper := FilterLte("row_num", page.Offset+page.Limit)
264
+
pLower := FilterGte("row_num", page.Count*page.No+1)
265
+
pUpper := FilterLte("row_num", page.Count*(page.No+1))
266
266
267
267
args = append(args, pLower.Arg()...)
268
268
args = append(args, pUpper.Arg()...)
···
396
396
}
397
397
398
398
func GetIssues(e Execer, filters ...filter) ([]Issue, error) {
399
-
return GetIssuesPaginated(e, pagination.FirstPage(), filters...)
399
+
return GetIssuesPaginated(e, pagination.Page{No: 0, Count: 10}, filters...)
400
400
}
401
401
402
402
func GetIssue(e Execer, repoAt syntax.ATURI, issueId int) (*Issue, error) {
NEW
appview/pages/pages.go
NEW
appview/pages/pages.go
NEW
appview/pages/templates/repo/issues/issues.html
NEW
appview/pages/templates/repo/issues/issues.html
···
87
87
{{ end }}
88
88
89
89
{{ define "pagination" }}
90
+
{{ $currentPage := .Pagination.CurrentPage }}
90
91
<div class="flex justify-end mt-4 gap-2">
91
92
{{ $currentState := "closed" }}
92
93
{{ if .FilteringByOpen }}
93
94
{{ $currentState = "open" }}
94
95
{{ end }}
95
96
96
-
{{ if gt .Page.Offset 0 }}
97
-
{{ $prev := .Page.Previous }}
97
+
{{ if gt $currentPage.No 0 }}
98
+
{{ $prev := .Pagination.PreviousPage }}
98
99
<a
99
100
class="btn flex items-center gap-2 no-underline hover:no-underline dark:text-white dark:hover:bg-gray-700"
100
101
hx-boost="true"
101
-
href = "/{{ $.RepoInfo.FullName }}/issues?state={{ $currentState }}&offset={{ $prev.Offset }}&limit={{ $prev.Limit }}"
102
+
href = "/{{ $.RepoInfo.FullName }}/issues?state={{ $currentState }}&page={{ add $prev.No 1 }}&count={{ $prev.Count }}"
102
103
>
103
104
{{ i "chevron-left" "w-4 h-4" }}
104
105
previous
···
107
108
<div></div>
108
109
{{ end }}
109
110
110
-
{{ if eq (len .Issues) .Page.Limit }}
111
-
{{ $next := .Page.Next }}
111
+
{{ if lt (add $currentPage.No 1) .Pagination.TotalPageCount }}
112
+
{{ $next := .Pagination.NextPage }}
112
113
<a
113
114
class="btn flex items-center gap-2 no-underline hover:no-underline dark:text-white dark:hover:bg-gray-700"
114
115
hx-boost="true"
115
-
href = "/{{ $.RepoInfo.FullName }}/issues?state={{ $currentState }}&offset={{ $next.Offset }}&limit={{ $next.Limit }}"
116
+
href = "/{{ $.RepoInfo.FullName }}/issues?state={{ $currentState }}&page={{ add $next.No 1 }}&count={{ $next.Count }}"
116
117
>
117
118
next
118
119
{{ i "chevron-right" "w-4 h-4" }}