oct-election::valid_voters (public)

 oct-election::valid_voters [ -status status ] -election_id election_id

Defined in packages/oct-election/tcl/oct-election-procs.tcl

Return a list of valid voters

Switches:
-status (optional, defaults to "not_voted")
Could be "voted" or "non_voted", reflecting the voters who have voted for the elections already and the ones who did not vote yet.
-election_id (required)

Partial Call Graph (max 5 caller/called nodes):
%3 ad_script_abort ad_script_abort (public) db_foreach db_foreach (public) db_list db_list (public) oct-election::valid_voter_p oct-election::valid_voter_p (private) oct-election::valid_voters oct-election::valid_voters oct-election::valid_voters->ad_script_abort oct-election::valid_voters->db_foreach oct-election::valid_voters->db_list oct-election::valid_voters->oct-election::valid_voter_p

Testcases:
No testcase defined.
Source code:


    if {$status eq "voted"} {
    return [db_list voters "select u. user_id from cc_users u, (select count(user_id) as ballot,user_id from oct_ballot o where election_id = 5 group by user_id) ballots where ballots.user_id = u.user_id and ballot > 0 and u.member_state = 'approved'"]
    ad_script_abort
    } else {
    set voter_ids [list]
    db_foreach possible_voter "select u. user_id from cc_users u where u.member_state = 'approved'" {
        
        # Check if the user is actually allowed to vote
        set valid_voter [oct-election::valid_voter_p -election_id $election_id -user_id $user_id]
        set valid_voter_p [lindex $valid_voter 0]
        if {$valid_voter_p} {
        lappend voter_ids $user_id
        }
    }
    }

    return $voter_ids
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: