Index: openacs-4/packages/imsld/tcl/imsld-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-procs.tcl,v diff -u -r1.26 -r1.27 --- openacs-4/packages/imsld/tcl/imsld-procs.tcl 6 Feb 2006 15:26:59 -0000 1.26 +++ openacs-4/packages/imsld/tcl/imsld-procs.tcl 6 Feb 2006 16:46:06 -0000 1.27 @@ -2016,6 +2016,7 @@ where stat.imsld_id = :imsld_id and stat.user_id = :user_id and stat.role_part_id = rp.role_part_id + and stat.type in ('learning','support','structure') order by stat.finished_date }] { set completed_id [lindex $completed_activity 0] @@ -2587,6 +2588,7 @@ :user_id, 'resource', now() + where not exists (select 1 from imsld_status_user where imsld_id = :imsld_id and user_id = :user_id and completed_id = :resource_id) ) } @@ -2617,7 +2619,7 @@ } #if all are finished, tag the activity as finished - if { $all_finished_p } { + if { $all_finished_p && ![db_0or1row already_finished { *SQL* }] } { imsld::finish_component_element -imsld_id $imsld_id \ -role_part_id $role_part_id \ -element_id $activity_id \ Index: openacs-4/packages/imsld/tcl/imsld-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-procs.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/imsld/tcl/imsld-procs.xql 3 Feb 2006 10:18:54 -0000 1.4 +++ openacs-4/packages/imsld/tcl/imsld-procs.xql 6 Feb 2006 16:46:06 -0000 1.5 @@ -1337,6 +1337,7 @@ where stat.imsld_id = :imsld_id and stat.user_id = :user_id and stat.role_part_id = rp.role_part_id + and stat.type in ('learning','support','structure') order by stat.finished_date @@ -1725,6 +1726,7 @@ :user_id, 'resource', now() + where not exists (select 1 from imsld_status_user where imsld_id = :imsld_id and user_id = :user_id and completed_id = :resource_id) ) @@ -1742,7 +1744,13 @@ + + + select 1 from imsld_status_user where completed_id = :activity_id and user_id = :user_id + + + select count(*)