Index: openacs-4/contrib/packages/simulation/sql/postgresql/simulation-tables-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/sql/postgresql/Attic/simulation-tables-create.sql,v
diff -u -r1.26.2.1 -r1.26.2.2
--- openacs-4/contrib/packages/simulation/sql/postgresql/simulation-tables-create.sql 22 Mar 2004 15:49:02 -0000 1.26.2.1
+++ openacs-4/contrib/packages/simulation/sql/postgresql/simulation-tables-create.sql 23 Mar 2004 17:01:33 -0000 1.26.2.2
@@ -138,7 +138,10 @@
references parties
on delete cascade,
type varchar(20) constraint sim_party_sim_map_type_ck
- check (type in ('enrolled', 'invited', 'auto_enroll')),
+ check (type in ('enrolled', 'invited', 'auto_enroll')),
+ multiple_cases_p boolean constraint sim_party_sim_map_mcp_nn
+ not null
+ default 'f',
constraint sim_party_sim_map_pk
primary key (simulation_id, party_id, type)
);
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/contrib/packages/simulation/sql/postgresql/upgrade/upgrade-1.0.0b3-1.0.0b4.sql'.
Fisheye: No comparison available. Pass `N' to diff?
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.66.2.5 -r1.66.2.6
--- openacs-4/contrib/packages/simulation/tcl/template-procs.tcl 18 Mar 2004 13:46:43 -0000 1.66.2.5
+++ openacs-4/contrib/packages/simulation/tcl/template-procs.tcl 23 Mar 2004 17:01:35 -0000 1.66.2.6
@@ -845,6 +845,16 @@
}
}
}
+ # We need to refill (re-initialize) the groups that should be in multiple (all) cases, so
+ # keep the original group member array around
+ array set full_group_members [array get group_members]
+ set multiple_case_groups [db_list select_multiple_case_groups {
+ select party_id
+ from sim_party_sim_map
+ where simulation_id = :workflow_id
+ and (type = 'invited' or type = 'auto_enroll')
+ and multiple_cases_p = 't'
+ }]
# First do user-role assignments in any existing simulation cases
set current_cases [db_list select_current_cases {
@@ -860,7 +870,13 @@
-role_names_array role_short_name \
-groups_array group_members \
-users_var users_to_cast \
- -users_not_in_groups_var users_to_cast_not_in_groups
+ -users_not_in_groups_var users_to_cast_not_in_groups \
+ -multiple_case_groups $multiple_case_groups
+
+ # Refill all multiple case groups
+ foreach multiple_group_id $multiple_case_groups {
+ set group_members($multiple_group_id) $full_group_members($multiple_group_id)
+ }
}
# If there are users left to cast, create new cases for them and repeat the same
@@ -885,7 +901,12 @@
-role_names_array role_short_name \
-groups_array group_members \
-users_var users_to_cast \
- -users_not_in_groups_var users_to_cast_not_in_groups
+ -users_not_in_groups_var users_to_cast_not_in_groups \
+ -multiple_case_groups $multiple_case_groups
+
+ foreach multiple_group_id $multiple_case_groups {
+ set group_members($multiple_group_id) $full_group_members($multiple_group_id)
+ }
}
}
@@ -897,6 +918,7 @@
{-groups_array:required}
{-users_var:required}
{-users_not_in_groups_var:required}
+ {-multiple_case_groups:required}
} {
Internal helper proc that will do user-role assignments in an existing
simulation case.
@@ -937,14 +959,18 @@
for { set i 0 } { $i < $n_users_to_assign } { incr i } {
# Get user from random non-empty group mapped to role
foreach group_id [util::randomize_list $one_role(parties)] {
- # Remove users from the list that have already been cast
- set not_cast_list [list]
- foreach user_id $group_members($group_id) {
- if { [lsearch -exact $users_to_cast $user_id] != -1 } {
- lappend not_cast_list $user_id
+ if { [lsearch $multiple_case_groups $group_id] == -1 } {
+ # Remove users from the list that have already been cast
+ # We don't do this for multiple case groups as users in these groups
+ # can be cast multiple times
+ set not_cast_list [list]
+ foreach user_id $group_members($group_id) {
+ if { [lsearch -exact $users_to_cast $user_id] != -1 } {
+ lappend not_cast_list $user_id
+ }
}
+ set group_members($group_id) $not_cast_list
}
- set group_members($group_id) $not_cast_list
if { [llength $group_members($group_id)] > 0 } {
break
Index: openacs-4/contrib/packages/simulation/www/siminst/simulation-participants.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/siminst/Attic/simulation-participants.tcl,v
diff -u -r1.13 -r1.13.2.1
--- openacs-4/contrib/packages/simulation/www/siminst/simulation-participants.tcl 5 Mar 2004 10:54:20 -0000 1.13
+++ openacs-4/contrib/packages/simulation/www/siminst/simulation-participants.tcl 23 Mar 2004 17:01:36 -0000 1.13.2.1
@@ -55,7 +55,11 @@
from sim_party_sim_map
where simulation_id = :workflow_id
and party_id = g.group_id
- and type = 'invited') as invited_p
+ and type = 'invited') as invited_p,
+ (select multiple_cases_p
+ from sim_party_sim_map
+ where simulation_id = :workflow_id
+ and party_id = g.group_id) as multiple_cases_p
from acs_rels ar,
groups g
where ar.object_id_one = :subsite_group_id
@@ -64,7 +68,7 @@
order by lower(g.group_name)
} {
ad_form -extend -name simulation -form \
- [list [list __group_$group_id:text,optional]]
+ [list [list __group_$group_id:text,optional] [list __multiple_$group_id:text,optional]]
lappend groups $group_id
@@ -111,6 +115,13 @@
}
html { align center }
}
+ multiple {
+ label "Multiple Cases"
+ display_template {
+ checked="checked">
+ }
+ html { align center }
+ }
}
wizard submit simulation -buttons { back next }
@@ -134,9 +145,10 @@
set selected_type [element get_value simulation __group_${group_id}]
if { [string equal $selected_type $type] } {
+ set multiple_cases_p [ad_decode [element get_value simulation __multiple_${group_id}] "t" "t" "f"]
db_dml insert_party {
- insert into sim_party_sim_map (simulation_id, party_id, type)
- values (:workflow_id, :group_id, :type)
+ insert into sim_party_sim_map (simulation_id, party_id, type, multiple_cases_p)
+ values (:workflow_id, :group_id, :type, :multiple_cases_p)
}
}
}
Index: openacs-4/packages/simulation/sql/postgresql/simulation-tables-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/sql/postgresql/simulation-tables-create.sql,v
diff -u -r1.26.2.1 -r1.26.2.2
--- openacs-4/packages/simulation/sql/postgresql/simulation-tables-create.sql 22 Mar 2004 15:49:02 -0000 1.26.2.1
+++ openacs-4/packages/simulation/sql/postgresql/simulation-tables-create.sql 23 Mar 2004 17:01:33 -0000 1.26.2.2
@@ -138,7 +138,10 @@
references parties
on delete cascade,
type varchar(20) constraint sim_party_sim_map_type_ck
- check (type in ('enrolled', 'invited', 'auto_enroll')),
+ check (type in ('enrolled', 'invited', 'auto_enroll')),
+ multiple_cases_p boolean constraint sim_party_sim_map_mcp_nn
+ not null
+ default 'f',
constraint sim_party_sim_map_pk
primary key (simulation_id, party_id, type)
);
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/simulation/sql/postgresql/upgrade/upgrade-1.0.0b3-1.0.0b4.sql'.
Fisheye: No comparison available. Pass `N' to diff?
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.66.2.5 -r1.66.2.6
--- openacs-4/packages/simulation/tcl/template-procs.tcl 18 Mar 2004 13:46:43 -0000 1.66.2.5
+++ openacs-4/packages/simulation/tcl/template-procs.tcl 23 Mar 2004 17:01:35 -0000 1.66.2.6
@@ -845,6 +845,16 @@
}
}
}
+ # We need to refill (re-initialize) the groups that should be in multiple (all) cases, so
+ # keep the original group member array around
+ array set full_group_members [array get group_members]
+ set multiple_case_groups [db_list select_multiple_case_groups {
+ select party_id
+ from sim_party_sim_map
+ where simulation_id = :workflow_id
+ and (type = 'invited' or type = 'auto_enroll')
+ and multiple_cases_p = 't'
+ }]
# First do user-role assignments in any existing simulation cases
set current_cases [db_list select_current_cases {
@@ -860,7 +870,13 @@
-role_names_array role_short_name \
-groups_array group_members \
-users_var users_to_cast \
- -users_not_in_groups_var users_to_cast_not_in_groups
+ -users_not_in_groups_var users_to_cast_not_in_groups \
+ -multiple_case_groups $multiple_case_groups
+
+ # Refill all multiple case groups
+ foreach multiple_group_id $multiple_case_groups {
+ set group_members($multiple_group_id) $full_group_members($multiple_group_id)
+ }
}
# If there are users left to cast, create new cases for them and repeat the same
@@ -885,7 +901,12 @@
-role_names_array role_short_name \
-groups_array group_members \
-users_var users_to_cast \
- -users_not_in_groups_var users_to_cast_not_in_groups
+ -users_not_in_groups_var users_to_cast_not_in_groups \
+ -multiple_case_groups $multiple_case_groups
+
+ foreach multiple_group_id $multiple_case_groups {
+ set group_members($multiple_group_id) $full_group_members($multiple_group_id)
+ }
}
}
@@ -897,6 +918,7 @@
{-groups_array:required}
{-users_var:required}
{-users_not_in_groups_var:required}
+ {-multiple_case_groups:required}
} {
Internal helper proc that will do user-role assignments in an existing
simulation case.
@@ -937,14 +959,18 @@
for { set i 0 } { $i < $n_users_to_assign } { incr i } {
# Get user from random non-empty group mapped to role
foreach group_id [util::randomize_list $one_role(parties)] {
- # Remove users from the list that have already been cast
- set not_cast_list [list]
- foreach user_id $group_members($group_id) {
- if { [lsearch -exact $users_to_cast $user_id] != -1 } {
- lappend not_cast_list $user_id
+ if { [lsearch $multiple_case_groups $group_id] == -1 } {
+ # Remove users from the list that have already been cast
+ # We don't do this for multiple case groups as users in these groups
+ # can be cast multiple times
+ set not_cast_list [list]
+ foreach user_id $group_members($group_id) {
+ if { [lsearch -exact $users_to_cast $user_id] != -1 } {
+ lappend not_cast_list $user_id
+ }
}
+ set group_members($group_id) $not_cast_list
}
- set group_members($group_id) $not_cast_list
if { [llength $group_members($group_id)] > 0 } {
break
Index: openacs-4/packages/simulation/www/siminst/simulation-participants.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/simulation-participants.tcl,v
diff -u -r1.13 -r1.13.2.1
--- openacs-4/packages/simulation/www/siminst/simulation-participants.tcl 5 Mar 2004 10:54:20 -0000 1.13
+++ openacs-4/packages/simulation/www/siminst/simulation-participants.tcl 23 Mar 2004 17:01:36 -0000 1.13.2.1
@@ -55,7 +55,11 @@
from sim_party_sim_map
where simulation_id = :workflow_id
and party_id = g.group_id
- and type = 'invited') as invited_p
+ and type = 'invited') as invited_p,
+ (select multiple_cases_p
+ from sim_party_sim_map
+ where simulation_id = :workflow_id
+ and party_id = g.group_id) as multiple_cases_p
from acs_rels ar,
groups g
where ar.object_id_one = :subsite_group_id
@@ -64,7 +68,7 @@
order by lower(g.group_name)
} {
ad_form -extend -name simulation -form \
- [list [list __group_$group_id:text,optional]]
+ [list [list __group_$group_id:text,optional] [list __multiple_$group_id:text,optional]]
lappend groups $group_id
@@ -111,6 +115,13 @@
}
html { align center }
}
+ multiple {
+ label "Multiple Cases"
+ display_template {
+ checked="checked">
+ }
+ html { align center }
+ }
}
wizard submit simulation -buttons { back next }
@@ -134,9 +145,10 @@
set selected_type [element get_value simulation __group_${group_id}]
if { [string equal $selected_type $type] } {
+ set multiple_cases_p [ad_decode [element get_value simulation __multiple_${group_id}] "t" "t" "f"]
db_dml insert_party {
- insert into sim_party_sim_map (simulation_id, party_id, type)
- values (:workflow_id, :group_id, :type)
+ insert into sim_party_sim_map (simulation_id, party_id, type, multiple_cases_p)
+ values (:workflow_id, :group_id, :type, :multiple_cases_p)
}
}
}