Show
Ignore:
Timestamp:
08/26/10 21:50:23 (21 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@…>

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • http/threads.cc

    r43f5212 r654bb60  
    110110 
    111111                        size_t cur = 0; 
    112                         bool more = false; 
     112                        size_t total = 0; 
    113113                        for (std::list<db::thread_node::ptr>::const_iterator 
    114114                                     it = thrs.begin(); 
    115115                             it != thrs.end(); it++) 
    116116                        { 
     117                                total++; 
     118                                if (cur >= start + length) continue; 
    117119                                cur++; 
    118                                 if (cur >= start + length) 
    119                                 { 
    120                                         more = true; 
    121                                         break; 
    122                                 } 
    123120                                if (cur > start) 
    124121                                        tl->push_back 
     
    128125 
    129126                        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); 
    132129                        pg->insert("size", cur - start); 
    133130                        pg->insert("max_size", length); 
    134  
    135                         if (more) 
     131                        pg->insert("total", total); 
     132                        if (cur < total) 
    136133                        { 
    137134                                ::uri u = req->get_uri();