Index: openacs-4/contrib/packages/simulation/sql/postgresql/simulation-packages-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/sql/postgresql/Attic/simulation-packages-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/simulation/sql/postgresql/simulation-packages-create.sql 19 Dec 2003 10:23:11 -0000 1.2 +++ openacs-4/contrib/packages/simulation/sql/postgresql/simulation-packages-create.sql 19 Dec 2003 11:25:19 -0000 1.3 @@ -4,7 +4,7 @@ select define_function_args('sim_case__new','sim_case_id,label,package_id,object_type;sim_case,creation_user,creation_ip,context_id'); -create function sim_case__new (integer,varchar,integer,varchar,integer,varchar,integer) +create or replace function sim_case__new (integer,varchar,integer,varchar,integer,varchar,integer) returns integer as ' declare p_sim_case_id alias for $1; @@ -37,18 +37,18 @@ select define_function_args('sim_case__name','sim_case_id'); -create function sim_case__name(integer) +create or replace function sim_case__name(integer) returns varchar as ' declare - p_sim_case_id_id alias for $1; + p_sim_case_id alias for $1; begin return label from sim_cases where sim_case_id = p_sim_case_id; end; ' language 'plpgsql'; select define_function_args('sim_case__delete','sim_case_id'); -create function sim_case__delete(integer) +create or replace function sim_case__delete(integer) returns integer as ' declare p_sim_case_id alias for $1; Index: openacs-4/contrib/packages/simulation/tcl/sim-case-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/tcl/Attic/sim-case-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/simulation/tcl/sim-case-procs.tcl 19 Dec 2003 09:42:24 -0000 1.1 +++ openacs-4/contrib/packages/simulation/tcl/sim-case-procs.tcl 19 Dec 2003 11:25:20 -0000 1.2 @@ -21,6 +21,8 @@ @return sim_case_id } { + set package_id [ad_conn package_id] + set extra_vars [ns_set create] oacs_util::vars_to_ns_set \ -ns_set $extra_vars \ Index: openacs-4/contrib/packages/simulation/tcl/template-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/tcl/Attic/template-procs.tcl,v diff -u -r1.28 -r1.29 --- openacs-4/contrib/packages/simulation/tcl/template-procs.tcl 19 Dec 2003 09:42:33 -0000 1.28 +++ openacs-4/contrib/packages/simulation/tcl/template-procs.tcl 19 Dec 2003 11:25:20 -0000 1.29 @@ -554,7 +554,7 @@ } set workflow_short_name [workflow::get_element -workflow_id $workflow_id -element short_name] - + # Create the cases and for each case assign users to roles while { $total_users > 0 } { @@ -563,6 +563,8 @@ set case_id [workflow::case::get_id \ -object_id $sim_case_id \ -workflow_short_name $workflow_short_name] + + ns_log Notice "pm debug sim_case_id=$sim_case_id case_id=$case_id" # Assign users from the specified group for each role array unset row @@ -572,6 +574,7 @@ array set one_role $roles($role_id) set assignees [list] + ns_log Notice "pm debug case_id=$case_id before users_per_case loop with role_id=$role_id [array get one_role]" for { set i 0 } { $i < $one_role(users_per_case) } { incr i } { # Get user from random group mapped to role set group_id [lindex [util::randomize_list $one_role(parties)] 0] @@ -583,17 +586,20 @@ set group_members($group_id) [lreplace $group_members($group_id) 0 0] # Reduce the total_users count incr total_users -1 + ns_log Notice "pm debug case_id=$case_id group_id=$group_id - group has more users. appending [lindex $group_members($group_id) 0] to assignees. assignees=$assignees . Subtracting one from total users to $total_users" } else { # Current group exhausted, use current user lappend assignees [ad_conn user_id] # Don't add the admin more than once + ns_log Notice "pm debug case_id=$case_id group_id=$group_id - group has no more users, appending professor [ad_conn user_id]" break } } set row($role_short_name($role_id)) $assignees } + ns_log Notice "pm debug case_id=$case_id role::assign [array get row]" workflow::case::role::assign \ -case_id $case_id \ -array row \ Index: openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-3.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/simulation-casting-3.adp,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-3.adp 18 Dec 2003 15:22:56 -0000 1.3 +++ openacs-4/contrib/packages/simulation/www/siminst/simulation-casting-3.adp 19 Dec 2003 11:25:20 -0000 1.4 @@ -8,7 +8,6 @@ TODO: Display the actor list and group size in parallel columns instead of in pairs of rows

-

TODO: make giver a list of checkboxes instead of a single-select -list

+

TODO: at the bottom, show a list of all groups that are auto-enrolled but are not assigned anywhere (and hence won't be in any cases) Index: openacs-4/packages/simulation/sql/postgresql/simulation-packages-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/sql/postgresql/simulation-packages-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/simulation/sql/postgresql/simulation-packages-create.sql 19 Dec 2003 10:23:11 -0000 1.2 +++ openacs-4/packages/simulation/sql/postgresql/simulation-packages-create.sql 19 Dec 2003 11:25:19 -0000 1.3 @@ -4,7 +4,7 @@ select define_function_args('sim_case__new','sim_case_id,label,package_id,object_type;sim_case,creation_user,creation_ip,context_id'); -create function sim_case__new (integer,varchar,integer,varchar,integer,varchar,integer) +create or replace function sim_case__new (integer,varchar,integer,varchar,integer,varchar,integer) returns integer as ' declare p_sim_case_id alias for $1; @@ -37,18 +37,18 @@ select define_function_args('sim_case__name','sim_case_id'); -create function sim_case__name(integer) +create or replace function sim_case__name(integer) returns varchar as ' declare - p_sim_case_id_id alias for $1; + p_sim_case_id alias for $1; begin return label from sim_cases where sim_case_id = p_sim_case_id; end; ' language 'plpgsql'; select define_function_args('sim_case__delete','sim_case_id'); -create function sim_case__delete(integer) +create or replace function sim_case__delete(integer) returns integer as ' declare p_sim_case_id alias for $1; Index: openacs-4/packages/simulation/tcl/sim-case-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/sim-case-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/simulation/tcl/sim-case-procs.tcl 19 Dec 2003 09:42:24 -0000 1.1 +++ openacs-4/packages/simulation/tcl/sim-case-procs.tcl 19 Dec 2003 11:25:20 -0000 1.2 @@ -21,6 +21,8 @@ @return sim_case_id } { + set package_id [ad_conn package_id] + set extra_vars [ns_set create] oacs_util::vars_to_ns_set \ -ns_set $extra_vars \ Index: openacs-4/packages/simulation/tcl/template-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/template-procs.tcl,v diff -u -r1.28 -r1.29 --- openacs-4/packages/simulation/tcl/template-procs.tcl 19 Dec 2003 09:42:33 -0000 1.28 +++ openacs-4/packages/simulation/tcl/template-procs.tcl 19 Dec 2003 11:25:20 -0000 1.29 @@ -554,7 +554,7 @@ } set workflow_short_name [workflow::get_element -workflow_id $workflow_id -element short_name] - + # Create the cases and for each case assign users to roles while { $total_users > 0 } { @@ -563,6 +563,8 @@ set case_id [workflow::case::get_id \ -object_id $sim_case_id \ -workflow_short_name $workflow_short_name] + + ns_log Notice "pm debug sim_case_id=$sim_case_id case_id=$case_id" # Assign users from the specified group for each role array unset row @@ -572,6 +574,7 @@ array set one_role $roles($role_id) set assignees [list] + ns_log Notice "pm debug case_id=$case_id before users_per_case loop with role_id=$role_id [array get one_role]" for { set i 0 } { $i < $one_role(users_per_case) } { incr i } { # Get user from random group mapped to role set group_id [lindex [util::randomize_list $one_role(parties)] 0] @@ -583,17 +586,20 @@ set group_members($group_id) [lreplace $group_members($group_id) 0 0] # Reduce the total_users count incr total_users -1 + ns_log Notice "pm debug case_id=$case_id group_id=$group_id - group has more users. appending [lindex $group_members($group_id) 0] to assignees. assignees=$assignees . Subtracting one from total users to $total_users" } else { # Current group exhausted, use current user lappend assignees [ad_conn user_id] # Don't add the admin more than once + ns_log Notice "pm debug case_id=$case_id group_id=$group_id - group has no more users, appending professor [ad_conn user_id]" break } } set row($role_short_name($role_id)) $assignees } + ns_log Notice "pm debug case_id=$case_id role::assign [array get row]" workflow::case::role::assign \ -case_id $case_id \ -array row \ Index: openacs-4/packages/simulation/www/siminst/simulation-casting-3.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/simulation-casting-3.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/simulation/www/siminst/simulation-casting-3.adp 18 Dec 2003 15:22:56 -0000 1.3 +++ openacs-4/packages/simulation/www/siminst/simulation-casting-3.adp 19 Dec 2003 11:25:20 -0000 1.4 @@ -8,7 +8,6 @@ TODO: Display the actor list and group size in parallel columns instead of in pairs of rows

-

TODO: make giver a list of checkboxes instead of a single-select -list

+

TODO: at the bottom, show a list of all groups that are auto-enrolled but are not assigned anywhere (and hence won't be in any cases)