comparison sat_pubsub/mam.py @ 449:91da42d44ea2

mam: fix `page_max` calculation, thus `complete` attribute
author Goffi <goffi@goffi.org>
date Thu, 22 Apr 2021 18:26:12 +0200
parents 5e8b8ef5c862
children bcbd2399bfee
comparison
equal deleted inserted replaced
448:c57b9ede1381 449:91da42d44ea2
114 if rsm_elt.first: 114 if rsm_elt.first:
115 # XXX: we check if it is the last page using initial request data 115 # XXX: we check if it is the last page using initial request data
116 # and RSM element data. In this case, we must have the 116 # and RSM element data. In this case, we must have the
117 # "complete" 117 # "complete"
118 # attribute set to "true". 118 # attribute set to "true".
119 page_max = (int(rsm_elt.first['index']) + 1) * mam_request.rsm.max 119 page_max = int(rsm_elt.first['index']) + mam_request.rsm.max
120 count = int(str(rsm_elt.count)) 120 count = int(str(rsm_elt.count))
121 if page_max >= count: 121 if page_max >= count:
122 # the maximum items which can be displayed is equal to or 122 # the maximum items which can be displayed is equal to or
123 # above the total number of items, which means we are complete 123 # above the total number of items, which means we are complete
124 attributes['complete'] = "true" 124 attributes['complete'] = "true"