Forum OpenACS Development: subsite members counter

Collapse
Posted by Iuri Sampaio on
I believe there is an error in the procedure [template::list::page_get_rowcount]

The pagination somehow alters the total number of members every time a new pagination is selected.

I debugged the API and i ended up with the following queries:

#1. Using paginaton with 50 records per page:
select r.rel_id,
u.first_names || ' ' || u.last_name as name
from acs_rels r,
membership_rels mr,
cc_users u
where r.object_id_one = :group_id
and r.rel_type = 'membership_rel'
and mr.rel_id = r.rel_id
and u.user_id = r.object_id_two

and
mr.member_state = :member_state

order by lower(u.first_names || ' ' || u.last_name) asc

offset 0
limit 550

#2.Using paginaton with 100 records per page:
select r.rel_id,
u.first_names || ' ' || u.last_name as name
from acs_rels r,
membership_rels mr,
cc_users u
where r.object_id_one = :group_id
and r.rel_type = 'membership_rel'
and mr.rel_id = r.rel_id
and u.user_id = r.object_id_two

and
mr.member_state = :member_state

order by lower(u.first_names || ' ' || u.last_name) asc

offset 0
limit 1100

#3. select r.rel_id,
u.first_names || ' ' || u.last_name as name
from acs_rels r,
membership_rels mr,
cc_users u
where r.object_id_one = :group_id
and r.rel_type = 'membership_rel'
and mr.rel_id = r.rel_id
and u.user_id = r.object_id_two

and
mr.member_state = :member_state

order by lower(u.first_names || ' ' || u.last_name) asc

offset 0
limit 5500

Paying attetion to the "limit" values: 550, 1100, and 5500 they are exactly the amount of members that show up unproperly. Although the subiste has around of 87 thousand members.

Is it possible the error be in the "limit" of the query?

What is the relation between "limit" and the counter of members (total of members)?

I couldn't easily track dqon the query because it is built dinamically depending the arguments passed.

https://openacs.org/api-doc/proc-view?proc=template::list::page_get_rowcount&source_p=1&version_id=

Furthemore, how users and subsites are related (what tables are used)? acs_rels and user?
cheers,

Collapse
Posted by Dave Bauer on
Yes you can't use that query to get the full count.

It is just getting 10 pages worth of ids/count to see how many pages are available.

Collapse
Posted by Iuri Sampaio on
how users and subsites (gruoups) are related?
what tables are used? acs_rels and user?

acs_rels.object_id_one and acs_rels.object_id_two does not hold the object_id from the acs_objects table to subsites.

Neither the API to get the gruop_id work as expected

subsite::get -array subsite_info
set group_id [group::get_id -group_name $subsite_info(name)]

Collapse
Posted by Dave Bauer on
Check the application_group api which associates groups with package instances and is used to map a group to a subsite.