We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit 3ea856c6 authored by Evan Prodromou's avatar Evan Prodromou

off-by-one error in notice stream

darcs-hash:20080518185940-84dde-fb7a3af877c67b5d7e9c59d32092c1392a0ecd58.gz
parent 74cab76c
...@@ -38,7 +38,7 @@ class AllAction extends ShowstreamAction { ...@@ -38,7 +38,7 @@ class AllAction extends ShowstreamAction {
$page = $this->arg('page') || 1; $page = $this->arg('page') || 1;
$notice->limit((($page-1)*NOTICES_PER_PAGE) + 1, NOTICES_PER_PAGE); $notice->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE);
$notice->find(); $notice->find();
...@@ -48,6 +48,7 @@ class AllAction extends ShowstreamAction { ...@@ -48,6 +48,7 @@ class AllAction extends ShowstreamAction {
$this->show_notice($notice); $this->show_notice($notice);
} }
# XXX: show a link for the next page
common_element_end('div'); common_element_end('div');
} }
} }
...@@ -44,7 +44,7 @@ class PublicAction extends StreamAction { ...@@ -44,7 +44,7 @@ class PublicAction extends StreamAction {
# XXX: filter out private notifications # XXX: filter out private notifications
$notice->orderBy('created DESC'); $notice->orderBy('created DESC');
$notice->limit((($page-1)*NOTICES_PER_PAGE) + 1, NOTICES_PER_PAGE); $notice->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE);
$notice->find(); $notice->find();
......
...@@ -190,15 +190,15 @@ class ShowstreamAction extends StreamAction { ...@@ -190,15 +190,15 @@ class ShowstreamAction extends StreamAction {
// XXX: WORM cache this // XXX: WORM cache this
$subs = DB_DataObject::factory('subscription'); $subs = DB_DataObject::factory('subscription');
$subs->subscriber = $profile->id; $subs->subscriber = $profile->id;
$subs_count = $subs->count(); $subs_count = $subs->count() || 0;
$subbed = DB_DataObject::factory('subscription'); $subbed = DB_DataObject::factory('subscription');
$subbed->subscribed = $profile->id; $subbed->subscribed = $profile->id;
$subbed_count = $subbed->count(); $subbed_count = $subbed->count() || 0;
$notices = DB_DataObject::factory('notice'); $notices = DB_DataObject::factory('notice');
$notices->profile_id = $profile->id; $notices->profile_id = $profile->id;
$notice_count = $notices->count(); $notice_count = $notices->count() || 0;
# Other stats...? # Other stats...?
common_element_start('dl', 'statistics'); common_element_start('dl', 'statistics');
...@@ -220,7 +220,7 @@ class ShowstreamAction extends StreamAction { ...@@ -220,7 +220,7 @@ class ShowstreamAction extends StreamAction {
$page = $this->arg('page') || 1; $page = $this->arg('page') || 1;
$notice->limit((($page-1)*NOTICES_PER_PAGE) + 1, NOTICES_PER_PAGE); $notice->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE);
$notice->find(); $notice->find();
...@@ -229,7 +229,7 @@ class ShowstreamAction extends StreamAction { ...@@ -229,7 +229,7 @@ class ShowstreamAction extends StreamAction {
while ($notice->fetch()) { while ($notice->fetch()) {
$this->show_notice($notice); $this->show_notice($notice);
} }
# XXX: show a link for the next page
common_element_end('div'); common_element_end('div');
} }
...@@ -237,7 +237,7 @@ class ShowstreamAction extends StreamAction { ...@@ -237,7 +237,7 @@ class ShowstreamAction extends StreamAction {
$notice = DB_DataObject::factory('notice'); $notice = DB_DataObject::factory('notice');
$notice->profile_id = $profile->id; $notice->profile_id = $profile->id;
$notice->orderBy('created DESC'); $notice->orderBy('created DESC');
$notice->limit(1, 1); $notice->limit(0, 1);
$notice->find(); $notice->find();
while ($notice->fetch()) { while ($notice->fetch()) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment