mirror of
https://github.com/YGGverse/rssto.git
synced 2026-03-31 17:15:29 +00:00
fix pagination offset
This commit is contained in:
parent
2463446fcd
commit
cc89dd6b9c
2 changed files with 11 additions and 2 deletions
|
|
@ -77,6 +77,7 @@ fn index(
|
||||||
global.provider_id,
|
global.provider_id,
|
||||||
search,
|
search,
|
||||||
Sort::Desc,
|
Sort::Desc,
|
||||||
|
page.map(|p| p - 1 * global.list_limit),
|
||||||
Some(global.list_limit)
|
Some(global.list_limit)
|
||||||
).map_err(|e| {
|
).map_err(|e| {
|
||||||
error!("Could not get contents: `{e}`");
|
error!("Could not get contents: `{e}`");
|
||||||
|
|
@ -175,7 +176,13 @@ fn rss(
|
||||||
Status::InternalServerError
|
Status::InternalServerError
|
||||||
})?;
|
})?;
|
||||||
for content in conn
|
for content in conn
|
||||||
.contents_by_provider_id(global.provider_id, search, Sort::Desc, Some(20)) // @TODO
|
.contents_by_provider_id(
|
||||||
|
global.provider_id,
|
||||||
|
search,
|
||||||
|
Sort::Desc,
|
||||||
|
None,
|
||||||
|
Some(global.list_limit),
|
||||||
|
)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
error!("Could not load channel item contents: `{e}`");
|
error!("Could not load channel item contents: `{e}`");
|
||||||
Status::InternalServerError
|
Status::InternalServerError
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ impl Connection {
|
||||||
provider_id: Option<u64>,
|
provider_id: Option<u64>,
|
||||||
keyword: Option<&str>,
|
keyword: Option<&str>,
|
||||||
sort: Sort,
|
sort: Sort,
|
||||||
|
start: Option<usize>,
|
||||||
limit: Option<usize>,
|
limit: Option<usize>,
|
||||||
) -> Result<Vec<Content>, Error> {
|
) -> Result<Vec<Content>, Error> {
|
||||||
self.conn.exec(format!(
|
self.conn.exec(format!(
|
||||||
|
|
@ -61,7 +62,8 @@ impl Connection {
|
||||||
`channel_item_id`,
|
`channel_item_id`,
|
||||||
`provider_id`,
|
`provider_id`,
|
||||||
`title`,
|
`title`,
|
||||||
`description` FROM `content` WHERE `provider_id` <=> ? AND `title` LIKE ? ORDER BY `content_id` {sort} LIMIT {}",
|
`description` FROM `content` WHERE `provider_id` <=> ? AND `title` LIKE ? ORDER BY `content_id` {sort} LIMIT {},{}",
|
||||||
|
start.unwrap_or(0),
|
||||||
limit.unwrap_or(DEFAULT_LIMIT)
|
limit.unwrap_or(DEFAULT_LIMIT)
|
||||||
),
|
),
|
||||||
(provider_id, like(keyword), ))
|
(provider_id, like(keyword), ))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue