Closed kvdmolen closed 9 years ago
Here is the unit
table:
liquid_feedback_01=> select * from unit;
id | parent_id | active | name | description | member_count | text_search_data
----+-----------+--------+-------------------+-------------+--------------+-------------------------------
2 | | t | Unit 1 | | 3 | '1':2 'unit':1
1 | 1 | t | Political Party 1 | | 3 | '1':3 'party':2 'political':1
3 | 2 | t | Unit 1.1 | Child unit | 2 | '1.1':2 'child':3 'unit':1,4
(3 rows)
This code builds the tree: https://github.com/Socioneers/LiquidVoting/blob/master/frontend/model/unit.lua#L97
note if not unit.parent_id then
... in the table above parent_id
for Political Party 1 was set to 1 (i.e., id == parent_id
). But as you can see the tree-building code is looking for a null parent id.
So - I set parent_id to null and now it works. Somewhere (probably in the area creation code) parent id is being set to id, rather than null. So we can fix that, or we can change the get_flattened_tree
to read if not unit.parent_id or unit.id == unit.parent_id
. I hope that explanation makes sense.
yeah, hmm, weird that it did work for the other "unit". perhaps another piece of code changes from id to null. perhaps the first option is the better one then? I made a new one, now it does show up in the admin-settings (http://178.62.254.91/lf/admin/index.html) but not in the index page (http://178.62.254.91/lf/index/index.html)
can u check the parent_id setting for this "new issue"?
liquid_feedback_01=> select * from unit
;
id | parent_id | active | name | description | member_count | text_search_data
----+-----------+--------+-------------------+-------------+--------------+-------------------------------
3 | 2 | t | Unit 1.1 | Child unit | 5 | '1.1':2 'child':3 'unit':1,4
1 | | t | Political Party 1 | | 6 | '1':3 'party':2 'political':1
2 | | t | Central District | | 6 | 'central':1 'district':2
4 | | t | District East | | 3 | 'district':1 'east':2
(4 rows)
The reason you're only seeing Political Party 1 and Central District on the index is because they are the only ones your user has "privilege" for. This is defined by the privilege table, which joins unit and member:
liquid_feedback_01=> select member.name, unit.name from privilege, member, unit where unit_id = unit.id and member_id = member.id order by member.name;
name | name
---------------+-------------------
Administrator | Political Party 1
Administrator | Central District
Aik | District East
Aik | Central District
Aik | Unit 1.1
Aik | Political Party 1
imanahumury | Central District
imanahumury | District East
imanahumury | Political Party 1
imanahumury | Unit 1.1
kvdmolen | Political Party 1
kvdmolen | District East
kvdmolen | Central District
kvdmolen | Unit 1.1
nktc | Political Party 1
nktc | Central District
nktc | Unit 1.1
remark | Political Party 1
remark | Central District
remark | Unit 1.1
| Central District
| Political Party 1
(22 rows)
I haven't yet figured out how this privilege is established. Perhaps there is a setting somewhere in the admin?
Ah yes, got it, there is: http://178.62.254.91/lf/admin/member_edit/1.html thanks for the research
There are currently two "Organisational Units"
At the index page I see both (top left corner in the sidebar)
But here I see only the first one (Unit 1) and it's subject-area's
Any Idea why? perhaps no rights/... ?