Index: openacs-4/contrib/packages/simulation/lib/cases.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/lib/Attic/cases.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/contrib/packages/simulation/lib/cases.tcl 22 Jan 2004 15:47:23 -0000 1.11 +++ openacs-4/contrib/packages/simulation/lib/cases.tcl 23 Jan 2004 11:11:28 -0000 1.12 @@ -49,23 +49,15 @@ w.pretty_name, case when (select count(*) from workflow_case_enabled_actions wcea - where wcea.case_id = wc.case_id - and wcea.enabled_state = 'enabled')=0 then 'Completed' + where wcea.case_id = wc.case_id) = 0 then 'Completed' else 'Active' end as status, r.role_id, r.pretty_name as role_pretty, - (select count(distinct wa2.action_id) - from workflow_case_enabled_actions wcea2, - workflow_actions wa2, - workflow_case_role_party_map wcrpm2 - where wcea2.case_id = wc.case_id - and wcea2.enabled_state = 'enabled' - and wa2.action_id = wcea2.action_id - and wcrpm2.role_id = wa2.assigned_role - and wcrpm2.party_id = :party_id - and wcrpm2.role_id = r.role_id - and wcrpm2.case_id = wc.case_id) as num_user_tasks + (select count(distinct wcaua.enabled_action_id) + from workflow_case_assigned_user_actions wcaua + where wcaua.case_id = wc.case_id + and wcaua.user_id = :party_id) as num_user_tasks from workflow_cases wc, sim_cases sc, workflow_case_role_party_map wcrpm, Index: openacs-4/contrib/packages/simulation/lib/sim-templates.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/lib/Attic/sim-templates.tcl,v diff -u -r1.17 -r1.18 --- openacs-4/contrib/packages/simulation/lib/sim-templates.tcl 15 Jan 2004 13:58:35 -0000 1.17 +++ openacs-4/contrib/packages/simulation/lib/sim-templates.tcl 23 Jan 2004 11:11:28 -0000 1.18 @@ -130,11 +130,7 @@ where workflow_id = w.workflow_id) as role_count, (select count(a2.action_id) from workflow_actions a2 - where a2.workflow_id = w.workflow_id - and not exists (select 1 - from workflow_initial_action ia2 - where ia2.workflow_id = w.workflow_id - and ia2.action_id = a2.action_id)) as task_count + where a2.workflow_id = w.workflow_id) as task_count from workflows w, sim_simulations ss, acs_objects a Index: openacs-4/contrib/packages/simulation/lib/tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/lib/Attic/tasks.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/contrib/packages/simulation/lib/tasks.tcl 12 Jan 2004 15:52:44 -0000 1.10 +++ openacs-4/contrib/packages/simulation/lib/tasks.tcl 23 Jan 2004 11:11:28 -0000 1.11 @@ -49,6 +49,7 @@ role { label "Role" hide_p {[ad_decode [exists_and_not_null case_id] 1 1 0]} + display_col role_pretty } case_label { label "Case" @@ -66,30 +67,38 @@ -no_data "You don't have any tasks." \ -elements $elements +# NOTE: Our "pick case and role" design of simplay doesn't work if a child workflow uses per_user mapping +# because the role in the child workflow will then no longer match any role in the top case. + db_multirow -extend { task_url } tasks select_tasks " - select wcea.enabled_action_id, + select wcaa.enabled_action_id, wa.pretty_name as name, - wcea.case_id, + wcaa.top_case_id as case_id, + wcaa.real_role_id as role_id, sc.label as case_label, w.pretty_name as sim_name, - wr.pretty_name as role, - wr.role_id as role_id - from workflow_case_enabled_actions wcea, + wr.pretty_name as role_pretty, + wr.role_id + from workflow_case_assigned_actions wcaa, workflow_actions wa, - workflow_cases wc, + workflow_cases topwc, sim_cases sc, workflows w, workflow_roles wr - where wcea.enabled_state = 'enabled' - and wa.action_id = wcea.action_id - and wr.role_id = wa.assigned_role - and wc.case_id = wcea.case_id - and sc.sim_case_id = wc.object_id - and w.workflow_id = wc.workflow_id - [ad_decode [exists_and_not_null role_id] 1 "and wr.role_id = :role_id" ""] - [ad_decode [exists_and_not_null case_id] 1 "and wcea.case_id = :case_id" "and exists (select 1 from workflow_case_role_user_map where case_id = wc.case_id and wa.assigned_role = role_id and user_id = :user_id)"] - + where wa.action_id = wcaa.action_id + and topwc.case_id = wcaa.top_case_id + and sc.sim_case_id = topwc.object_id + and w.workflow_id = topwc.workflow_id + and wr.role_id = wcaa.real_role_id + [ad_decode [exists_and_not_null role_id] 1 "and wcaa.real_role_id = :role_id" ""] + [ad_decode [exists_and_not_null case_id] 1 "and wcaa.top_case_id = :case_id" "and exists (select 1 + from workflow_case_role_user_map + where case_id = wcaa.real_case_id + and role_id = wcaa.real_role_id + and user_id = :user_id)"] order by wa.sort_order " { set task_url [export_vars -base "[apm_package_url_from_id $package_id]simplay/task-detail" { enabled_action_id case_id role_id }] } + + Index: openacs-4/packages/simulation/lib/cases.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/cases.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/simulation/lib/cases.tcl 22 Jan 2004 15:47:23 -0000 1.11 +++ openacs-4/packages/simulation/lib/cases.tcl 23 Jan 2004 11:11:28 -0000 1.12 @@ -49,23 +49,15 @@ w.pretty_name, case when (select count(*) from workflow_case_enabled_actions wcea - where wcea.case_id = wc.case_id - and wcea.enabled_state = 'enabled')=0 then 'Completed' + where wcea.case_id = wc.case_id) = 0 then 'Completed' else 'Active' end as status, r.role_id, r.pretty_name as role_pretty, - (select count(distinct wa2.action_id) - from workflow_case_enabled_actions wcea2, - workflow_actions wa2, - workflow_case_role_party_map wcrpm2 - where wcea2.case_id = wc.case_id - and wcea2.enabled_state = 'enabled' - and wa2.action_id = wcea2.action_id - and wcrpm2.role_id = wa2.assigned_role - and wcrpm2.party_id = :party_id - and wcrpm2.role_id = r.role_id - and wcrpm2.case_id = wc.case_id) as num_user_tasks + (select count(distinct wcaua.enabled_action_id) + from workflow_case_assigned_user_actions wcaua + where wcaua.case_id = wc.case_id + and wcaua.user_id = :party_id) as num_user_tasks from workflow_cases wc, sim_cases sc, workflow_case_role_party_map wcrpm, Index: openacs-4/packages/simulation/lib/sim-templates.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/sim-templates.tcl,v diff -u -r1.17 -r1.18 --- openacs-4/packages/simulation/lib/sim-templates.tcl 15 Jan 2004 13:58:35 -0000 1.17 +++ openacs-4/packages/simulation/lib/sim-templates.tcl 23 Jan 2004 11:11:28 -0000 1.18 @@ -130,11 +130,7 @@ where workflow_id = w.workflow_id) as role_count, (select count(a2.action_id) from workflow_actions a2 - where a2.workflow_id = w.workflow_id - and not exists (select 1 - from workflow_initial_action ia2 - where ia2.workflow_id = w.workflow_id - and ia2.action_id = a2.action_id)) as task_count + where a2.workflow_id = w.workflow_id) as task_count from workflows w, sim_simulations ss, acs_objects a Index: openacs-4/packages/simulation/lib/tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/tasks.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/simulation/lib/tasks.tcl 12 Jan 2004 15:52:44 -0000 1.10 +++ openacs-4/packages/simulation/lib/tasks.tcl 23 Jan 2004 11:11:28 -0000 1.11 @@ -49,6 +49,7 @@ role { label "Role" hide_p {[ad_decode [exists_and_not_null case_id] 1 1 0]} + display_col role_pretty } case_label { label "Case" @@ -66,30 +67,38 @@ -no_data "You don't have any tasks." \ -elements $elements +# NOTE: Our "pick case and role" design of simplay doesn't work if a child workflow uses per_user mapping +# because the role in the child workflow will then no longer match any role in the top case. + db_multirow -extend { task_url } tasks select_tasks " - select wcea.enabled_action_id, + select wcaa.enabled_action_id, wa.pretty_name as name, - wcea.case_id, + wcaa.top_case_id as case_id, + wcaa.real_role_id as role_id, sc.label as case_label, w.pretty_name as sim_name, - wr.pretty_name as role, - wr.role_id as role_id - from workflow_case_enabled_actions wcea, + wr.pretty_name as role_pretty, + wr.role_id + from workflow_case_assigned_actions wcaa, workflow_actions wa, - workflow_cases wc, + workflow_cases topwc, sim_cases sc, workflows w, workflow_roles wr - where wcea.enabled_state = 'enabled' - and wa.action_id = wcea.action_id - and wr.role_id = wa.assigned_role - and wc.case_id = wcea.case_id - and sc.sim_case_id = wc.object_id - and w.workflow_id = wc.workflow_id - [ad_decode [exists_and_not_null role_id] 1 "and wr.role_id = :role_id" ""] - [ad_decode [exists_and_not_null case_id] 1 "and wcea.case_id = :case_id" "and exists (select 1 from workflow_case_role_user_map where case_id = wc.case_id and wa.assigned_role = role_id and user_id = :user_id)"] - + where wa.action_id = wcaa.action_id + and topwc.case_id = wcaa.top_case_id + and sc.sim_case_id = topwc.object_id + and w.workflow_id = topwc.workflow_id + and wr.role_id = wcaa.real_role_id + [ad_decode [exists_and_not_null role_id] 1 "and wcaa.real_role_id = :role_id" ""] + [ad_decode [exists_and_not_null case_id] 1 "and wcaa.top_case_id = :case_id" "and exists (select 1 + from workflow_case_role_user_map + where case_id = wcaa.real_case_id + and role_id = wcaa.real_role_id + and user_id = :user_id)"] order by wa.sort_order " { set task_url [export_vars -base "[apm_package_url_from_id $package_id]simplay/task-detail" { enabled_action_id case_id role_id }] } + +