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)
|
FindHeaders(group, headername string, lo, hi int64) (ArticleHeaders, error)
|
||||||
|
|
||||||
// count ukko pages
|
// count ukko pages
|
||||||
GetUkkoPageCount() (int64, error)
|
GetUkkoPageCount(perpage int) (int64, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDatabase(db_type, schema, host, port, user, password string) Database {
|
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 {
|
if page == 0 {
|
||||||
template.genUkko(self.prefix, self.name, w, self.database, isjson, i18n, self.invertPagination)
|
if self.invertPagination {
|
||||||
} else {
|
pages, _ := self.database.GetUkkoPageCount(10)
|
||||||
template.genUkkoPaginated(self.prefix, self.name, w, self.database, page, isjson, i18n, self.invertPagination)
|
page = int(pages)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
template.genUkkoPaginated(self.prefix, self.name, w, self.database, page, isjson, i18n, self.invertPagination)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2001,8 +2001,9 @@ func (self *PostgresDatabase) FindCitesInText(text string) (msgids []string, err
|
|||||||
return
|
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)
|
err = self.conn.QueryRow(self.stmt[CountUkko]).Scan(&count)
|
||||||
|
count /= int64(perpage)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,8 +263,7 @@ func (self *templateEngine) genUkko(prefix, frontend string, wr io.Writer, datab
|
|||||||
var page int64
|
var page int64
|
||||||
var err error
|
var err error
|
||||||
if invertPagination {
|
if invertPagination {
|
||||||
page, err = database.GetUkkoPageCount()
|
page, err = database.GetUkkoPageCount(10)
|
||||||
page /= 10
|
|
||||||
}
|
}
|
||||||
if err == nil {
|
if err == nil {
|
||||||
self.genUkkoPaginated(prefix, frontend, wr, database, int(page), json, i18n, invertPagination)
|
self.genUkkoPaginated(prefix, frontend, wr, database, int(page), json, i18n, invertPagination)
|
||||||
|
Reference in New Issue
Block a user