fixes
This commit is contained in:
parent
e2de5edd43
commit
b61c22898e
@ -341,7 +341,7 @@ type Database interface {
|
||||
FindHeaders(group, headername string, lo, hi int64) (ArticleHeaders, error)
|
||||
|
||||
// count ukko pages
|
||||
GetUkkoPageCount() (int64, error)
|
||||
GetUkkoPageCount(perpage int) (int64, error)
|
||||
}
|
||||
|
||||
func NewDatabase(db_type, schema, host, port, user, password string) Database {
|
||||
|
@ -137,10 +137,12 @@ func (self *nullHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
if page == 0 {
|
||||
template.genUkko(self.prefix, self.name, w, self.database, isjson, i18n, self.invertPagination)
|
||||
} else {
|
||||
template.genUkkoPaginated(self.prefix, self.name, w, self.database, page, isjson, i18n, self.invertPagination)
|
||||
if self.invertPagination {
|
||||
pages, _ := self.database.GetUkkoPageCount(10)
|
||||
page = int(pages)
|
||||
}
|
||||
}
|
||||
template.genUkkoPaginated(self.prefix, self.name, w, self.database, page, isjson, i18n, self.invertPagination)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -2001,8 +2001,9 @@ func (self *PostgresDatabase) FindCitesInText(text string) (msgids []string, err
|
||||
return
|
||||
}
|
||||
|
||||
func (self *PostgresDatabase) GetUkkoPageCount() (count int64, err error) {
|
||||
func (self *PostgresDatabase) GetUkkoPageCount(perpage int) (count int64, err error) {
|
||||
err = self.conn.QueryRow(self.stmt[CountUkko]).Scan(&count)
|
||||
count /= int64(perpage)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -263,8 +263,7 @@ func (self *templateEngine) genUkko(prefix, frontend string, wr io.Writer, datab
|
||||
var page int64
|
||||
var err error
|
||||
if invertPagination {
|
||||
page, err = database.GetUkkoPageCount()
|
||||
page /= 10
|
||||
page, err = database.GetUkkoPageCount(10)
|
||||
}
|
||||
if err == nil {
|
||||
self.genUkkoPaginated(prefix, frontend, wr, database, int(page), json, i18n, invertPagination)
|
||||
|
Reference in New Issue
Block a user