Changeset 654bb6066f0a41076097ffd2498c04805e4d7276
- Timestamp:
- 08/26/10 21:50:23 (18 months ago)
- Author:
- Antti-Juhani Kaijanaho <antti-juhani@…>
- Children:
- 19a2630635324aeed23f74061133ba433a639cd4
- Parents:
- 62c7c77e091368d89d5f9699dd6185177dd37f4b
- git-committer:
- Antti-Juhani Kaijanaho <antti-juhani@…> (08/26/10 21:50:23)
- Message:
-
[http::article,threads] Fixes for pagination
Signed-off-by: Antti-Juhani Kaijanaho <antti-juhani@…>
- Location:
- http
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r43f5212
|
r654bb60
|
|
| 115 | 115 | tlate::thread_value::ptr tv |
| 116 | 116 | (new tlate::thread_value(tn, u)); |
| | 117 | size_t tvl = tv->size(); |
| 117 | 118 | tv->slice_window(start, length); |
| 118 | 119 | am->insert("thread", tv); |
| 119 | 120 | |
| 120 | 121 | tlate::data_model::ptr pg(new tlate::data_model); |
| 121 | | pg->insert("first", start); |
| | 122 | pg->insert("first", start + 1); |
| 122 | 123 | pg->insert("last", start + tv->size()); |
| 123 | 124 | pg->insert("size", tv->size()); |
| 124 | 125 | pg->insert("max_size", length); |
| | 126 | pg->insert("total", tvl); |
| 125 | 127 | |
| 126 | | if (length > tv->size()) |
| | 128 | if (start + length < tvl) |
| 127 | 129 | { |
| 128 | 130 | ::uri u = req->get_uri(); |
-
|
r43f5212
|
r654bb60
|
|
| 110 | 110 | |
| 111 | 111 | size_t cur = 0; |
| 112 | | bool more = false; |
| | 112 | size_t total = 0; |
| 113 | 113 | for (std::list<db::thread_node::ptr>::const_iterator |
| 114 | 114 | it = thrs.begin(); |
| 115 | 115 | it != thrs.end(); it++) |
| 116 | 116 | { |
| | 117 | total++; |
| | 118 | if (cur >= start + length) continue; |
| 117 | 119 | cur++; |
| 118 | | if (cur >= start + length) |
| 119 | | { |
| 120 | | more = true; |
| 121 | | break; |
| 122 | | } |
| 123 | 120 | if (cur > start) |
| 124 | 121 | tl->push_back |
| … |
… |
|
| 128 | 125 | |
| 129 | 126 | tlate::data_model::ptr pg(new tlate::data_model); |
| 130 | | pg->insert("first", start); |
| 131 | | pg->insert("last", cur - 1); |
| | 127 | pg->insert("first", start + 1); |
| | 128 | pg->insert("last", cur); |
| 132 | 129 | pg->insert("size", cur - start); |
| 133 | 130 | pg->insert("max_size", length); |
| 134 | | |
| 135 | | if (more) |
| | 131 | pg->insert("total", total); |
| | 132 | if (cur < total) |
| 136 | 133 | { |
| 137 | 134 | ::uri u = req->get_uri(); |