Index: openacs-4/packages/imsld/sql/postgresql/imsld-status-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/Attic/imsld-status-create.sql,v
diff -u -N -r1.8 -r1.9
--- openacs-4/packages/imsld/sql/postgresql/imsld-status-create.sql 30 Jan 2006 12:00:45 -0000 1.8
+++ openacs-4/packages/imsld/sql/postgresql/imsld-status-create.sql 8 Feb 2006 17:37:59 -0000 1.9
@@ -15,35 +15,40 @@
play_id integer
constraint imsld_stat_pl_fk
references imsld_plays,
- act_id integer
+ act_id integer
constraint imsld_stat_act_fk
references imsld_acts,
role_part_id integer
constraint imsld_stat_rp_fk
references imsld_role_parts,
- completed_id integer
+ related_id integer
constraint imsld_stat_aid_fk
references cr_revisions -- reference to a learning_activity OR support_activity OR
not null, -- activity_structure OR environment OR role_part OR act OR play
user_id integer
constraint imsld_stat_user_fk
references users
not null,
+ role_id integer
+ constraint imsld_stat_role_fk
+ references cr_revisions, -- imsld_roles (not implemented, add not null then)
type varchar(20)
check (type in ('learning','support','structure','act','role-part','play','method','resource')),
- finished_date timestamptz
+ status_date timestamptz
default current_timestamp
not null,
+ status varchar(20)
+ check (status in ('started','finished')),
constraint imsld_status_un
- unique (completed_id,user_id)
+ unique (related_id,user_id)
);
create index imsld_stat_imsld_idx on imsld_status_user(imsld_id);
create index imsld_stat_rp_idx on imsld_status_user(role_part_id);
-create index imsld_stat_comp_idx on imsld_status_user(completed_id);
+create index imsld_stat_comp_idx on imsld_status_user(related_id);
create index imsld_stat_user_idx on imsld_status_user(user_id);
comment on table imsld_status_user is '
-This table holds the status of each user in the unit of learning.
-Each entry in this table says that the user referenced by user_id has already COMPLETED the role part referenced by role_part_id, so if we want to know what role part is the next one for any user, we have to see the las completed role part and find out which one is next.';
+This table holds the status of each user in the run of the unit of learning.
+Each entry in this table says that the user referenced by user_id(role_id) has already started or completed the event referenced by _id. Extra information like the imsld_id, play_id, etc. is stored in order to avoid wasting of time.';
Index: openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl,v
diff -u -N -r1.31 -r1.32
--- openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl 7 Feb 2006 13:51:39 -0000 1.31
+++ openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl 8 Feb 2006 17:37:59 -0000 1.32
@@ -535,6 +535,7 @@
ad_proc -public imsld::parse::parse_and_create_resource {
-manifest
-manifest_id
+ {-activity_name ""}
-resource_node
-parent_id
-tmp_dir
@@ -545,6 +546,7 @@
@param manifest Manifest tree
@param manifest_id Manifest ID or the manifest being parsed
+ @option activity_name In case the resource forms part of an activity, the name is passed to name the possible acs_object associated
@param resource_node Resource tree being parsed
@param parent_id Parent folder ID
@tmp_dir Temporary directory where the files were exctracted
@@ -563,10 +565,12 @@
set resource_href [imsld::parse::get_attribute -node $resource_node -attr_name href]
set community_id [dotlrn_community::get_community_id]
- if { ![string eq $resource_type forum] } {
- set acs_object_id [callback -catch imsld::import -res_type $resource_type -res_href $resource_href -tmp_dir $tmp_dir -community_id $community_id]
+ if { [string eq $resource_type forum] } {
+ # particular case specially treated in .LRN
+ # (this is not part of the spec)
+ set acs_object_id [imsld::parse::parse_and_create_forum -name $activity_name]
} else {
- set acs_object_id [imsld::parse::parse_and_create_forum -name Forum]
+ set acs_object_id [callback -catch imsld::import -res_type $resource_type -res_href $resource_href -tmp_dir $tmp_dir -community_id $community_id]
}
# Integration with other packages
# This callback gets the href of the imported content (if some package imported it)
@@ -653,6 +657,7 @@
set dependency_resource_list [imsld::parse::parse_and_create_resource -resource_node $resourcex \
-manifest $manifest \
-manifest_id $manifest_id \
+ -activity_name $activity_name \
-parent_id $parent_id \
-tmp_dir $tmp_dir]
if { ![lindex $dependency_resource_list 0] } {
@@ -667,6 +672,7 @@
ad_proc -public imsld::parse::parse_and_create_item {
-manifest
-manifest_id
+ {-activity_name ""}
-item_node
-parent_id
-tmp_dir
@@ -678,6 +684,7 @@
@param manifest Manifest tree
@param manifest_id Manifest ID or the manifest being parsed
+ @option activity_name In case the item is asociated with an activity, the name is pased to hame the possible associated objects which require pretty names
@param item_node The item node to parse
@param parent_id Parent folder ID
@param tmp_dir Temporary directory where the files were exctracted
@@ -715,6 +722,7 @@
set resource_list [imsld::parse::parse_and_create_resource -resource_node $resourcex \
-manifest $manifest \
-manifest_id $manifest_id \
+ -activity_name $activity_name \
-parent_id $parent_id \
-tmp_dir $tmp_dir]
set resource_id [lindex $resource_list 0]
@@ -733,6 +741,7 @@
set nested_item_list [imsld::parse::parse_and_create_item -manifest $manifest \
-manifest_id $manifest_id \
-item_node $nested_item \
+ -activity_name $activity_name \
-parent_id $parent_id \
-tmp_dir $tmp_dir \
-parent_item_id $item_id]
@@ -1293,7 +1302,7 @@
}
}
- return [expr { [string eq $property_id ""] ? $property_group_id : $property_group_id }]
+ return [expr { [string eq $property_id ""] ? $property_group_id : $property_id }]
}
ad_proc -public imsld::parse::parse_and_create_learning_objective {
@@ -1310,6 +1319,7 @@
@param learning_objective_node learning objective node to parse
@param manifest Manifest tree
@param manifest_id Manifest ID or the manifest being parsed
+ @option activity_name In case the learning objective forms part of an activity, the name is provided to be used as the pretty name of the possible associated objects
@param parent_id Parent folder ID
@param tmp_dir Temporary directory where the files were exctracted
} {
@@ -1398,6 +1408,7 @@
-activity_description_node
-manifest
-manifest_id
+ {-activity_name ""}
-parent_id
-tmp_dir
} {
@@ -1408,6 +1419,7 @@
@param activity_description_node activity description node to parse
@param manifest Manifest tree
@param manifest_id Manifest ID or the manifest being parsed
+ @option activity_name Provided to name the possible objects associated with the activity
@param parent_id Parent folder ID
@param tmp_dir Temporary directory where the files were exctracted
} {
@@ -1427,6 +1439,7 @@
set item_list [imsld::parse::parse_and_create_item -manifest $manifest \
-manifest_id $manifest_id \
-item_node $imsld_item \
+ -activity_name $activity_name \
-parent_id $parent_id \
-tmp_dir $tmp_dir]
@@ -2154,12 +2167,14 @@
set prerequisite_id ""
}
+ # Learning Activity: Activity Description
set activity_description [$activity_node child all imsld:activity-description]
imsld::parse::validate_multiplicity -tree $activity_description -multiplicity 1 -element_name activity-description(learning-activity) -equal
set activity_description_list [imsld::parse::parse_and_create_activity_description -activity_description_node $activity_description \
-manifest_id $manifest_id \
-manifest $manifest \
+ -activity_name $title \
-parent_id $parent_id \
-tmp_dir $tmp_dir]
@@ -2339,12 +2354,14 @@
set parameters [imsld::parse::get_attribute -node $activity_node -attr_name parameters]
set title [imsld::parse::get_title -node $activity_node -prefix imsld]
+ # Support Activity: Activity Description
set activity_description [$activity_node child all imsld:activity-description]
imsld::parse::validate_multiplicity -tree $activity_description -multiplicity 1 -element_name activity-description(support-activity) -equal
set activity_description_list [imsld::parse::parse_and_create_activity_description -activity_description_node $activity_description \
-manifest_id $manifest_id \
-manifest $manifest \
+ -activity_name $title \
-parent_id $parent_id \
-tmp_dir $tmp_dir]
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 -N -r1.32 -r1.33
--- openacs-4/packages/imsld/tcl/imsld-procs.tcl 8 Feb 2006 13:55:35 -0000 1.32
+++ openacs-4/packages/imsld/tcl/imsld-procs.tcl 8 Feb 2006 17:37:59 -0000 1.33
@@ -392,25 +392,7 @@
where role_part_id = :role_part_id
}
- db_dml insert_role_part {
- insert into imsld_status_user (imsld_id,
- play_id,
- act_id,
- completed_id,
- user_id,
- type,
- finished_date)
- (
- select :imsld_id,
- :play_id,
- :act_id,
- :role_part_id,
- :user_id,
- 'act',
- now()
- where not exists (select 1 from imsld_status_user where imsld_id = :imsld_id and user_id = :user_id and completed_id = :role_part_id)
- )
- }
+ db_dml insert_role_part { *SQL* }
# mark as finished all the referenced activities
db_1row role_part_activity {
@@ -463,23 +445,7 @@
where act_id = :act_id
}
- db_dml insert_act {
- insert into imsld_status_user (imsld_id,
- play_id,
- completed_id,
- user_id,
- type,
- finished_date)
- (
- select :imsld_id,
- :play_id,
- :act_id,
- :user_id,
- 'act',
- now()
- where not exists (select 1 from imsld_status_user where imsld_id = :imsld_id and user_id = :user_id and completed_id = :act_id)
- )
- }
+ db_dml insert_act { *SQL* }
foreach referenced_role_part [db_list_of_lists referenced_role_part {
select rp.role_part_id
@@ -508,21 +474,7 @@
if { [imsld::play_finished_p -play_id $play_id -user_id $user_id] } {
return
}
- db_dml insert_play {
- insert into imsld_status_user (imsld_id,
- completed_id,
- user_id,
- type,
- finished_date)
- (
- select :imsld_id,
- :play_id,
- :user_id,
- 'play',
- now()
- where not exists (select 1 from imsld_status_user where imsld_id = :imsld_id and user_id = :user_id and completed_id = :play_id)
- )
- }
+ db_dml insert_play { *SQL* }
foreach referenced_act [db_list_of_lists referenced_act {
select ia.act_id
from imsld_acts ia, imsld_playsi ip
@@ -548,21 +500,7 @@
if { [imsld::imsld_finished_p -imsld_id $imsld_id -user_id $user_id] } {
return
}
- db_dml insert_uol {
- insert into imsld_status_user (imsld_id,
- completed_id,
- user_id,
- type,
- finished_date)
- (
- select :imsld_id,
- :imsld_id,
- :user_id,
- 'play',
- now()
- where not exists (select 1 from imsld_status_user where imsld_id = :imsld_id and user_id = :user_id and completed_id = :imsld_id)
- )
- }
+ db_dml insert_uol { *SQL* }
foreach referenced_play [db_list_of_lists referenced_plays {
select ip.play_id
@@ -589,21 +527,7 @@
if { [imsld::method_finished_p -method_id $method_id -user_id $user_id] } {
return
}
- db_dml insert_method {
- insert into imsld_status_user (imsld_id,
- completed_id,
- user_id,
- type,
- finished_date)
- (
- select :imsld_id,
- :method_id,
- :user_id,
- 'method',
- now()
- where not exists (select 1 from imsld_status_user where imsld_id = :imsld_id and user_id = :user_id and completed_id = :method_id)
- )
- }
+ db_dml insert_method { *SQL* }
foreach referenced_play [db_list_of_lists referenced_plays {
select ip.play_id
@@ -760,19 +684,7 @@
regsub {/finish-component-element.*} $url "" return_url
}
# now that we have the necessary info, mark the finished element completed and return
- db_dml insert_element_entry {
- insert into imsld_status_user (
- select :imsld_id,
- :play_id,
- :act_id,
- :role_part_id,
- :element_id,
- :user_id,
- :type,
- now()
- where not exists (select 1 from imsld_status_user where imsld_id = :imsld_id and user_id = :user_id and completed_id = :element_id)
- )
- }
+ db_dml insert_element_entry { *SQL* }
if { [string eq $type "learning"] || [string eq $type "support"] || [string eq $type "structure"] } {
foreach referencer_structure_list [db_list_of_lists referencer_structure {
@@ -794,11 +706,7 @@
where ar.object_id_one = :structure_item_id
and ar.rel_type in ('imsld_as_la_rel','imsld_as_sa_rel','imsld_as_as_rel')
} {
- if { ![db_string completed_p {
- select count(*) from imsld_status_user
- where completed_id = :activity_id
- and user_id = :user_id
- }] } {
+ if { ![db_string completed_p { *SQL* }] } {
# there is at leas one no-completed activity, so we can't mark this activity structure yet
set scturcture_finished_p 0
}
@@ -820,7 +728,7 @@
# 2. let's see if the finished role_part triggers the ending of the act which references it.
# 3. let's see if the finished act triggers the ending the play which references it
# 4. let's see if the finished play triggers the ending of the method which references it.
- if { [imsld::role_part_finished_p -role_part_id $role_part_id -user_id $user_id] && ![db_0or1row already_marked_p {select 1 from imsld_status_user where completed_id = :role_part_id and user_id = :user_id}] } {
+ if { [imsld::role_part_finished_p -role_part_id $role_part_id -user_id $user_id] && ![db_0or1row already_marked_p { *SQL* }] } {
# case number 1
imsld::finish_component_element -imsld_id $imsld_id \
-play_id $play_id \
@@ -981,12 +889,7 @@
where item_id = :object_id_two
and content_revision__is_live(activity_id) = 't'
}
- if { ![db_string completed_p_from_la {
- select count(*)
- from imsld_status_user
- where completed_id = :learning_activity_id
- and user_id = :user_id
- }] && ( [string eq "" $min_sort_order] || $sort_order < $min_sort_order ) } {
+ if { ![db_string completed_p_from_la { *SQL* }] && ( [string eq "" $min_sort_order] || $sort_order < $min_sort_order ) } {
set min_sort_order $sort_order
set next_activity_id $learning_activity_id
set next_activity_type learning
@@ -1001,33 +904,22 @@
where item_id = :object_id_two
and content_revision__is_live(activity_id) = 't'
}
- if { ![db_string completed_p_from_sa {
- select count(*)
- from imsld_status_user
- where completed_id = :support_activity_id
- and user_id = :user_id
- }] && ( [string eq "" $min_sort_order] || $sort_order < $min_sort_order ) } {
+ if { ![db_string completed_p_from_sa { *SQL* }] && ( [string eq "" $min_sort_order] || $sort_order < $min_sort_order ) } {
set min_sort_order $sort_order
set next_activity_id $support_activity_id
set next_activity_type support
}
}
imsld_as_as_rel {
# recursive call?
-
db_1row get_as_info {
select sort_order, structure_id, item_id
from imsld_activity_structuresi
where item_id = :object_id_two
and content_revision__is_live(structure_id) = 't'
}
- if { ![db_string completed_p {
- select count(*)
- from imsld_status_user
- where completed_id = :structure_id
- and user_id = :user_id
- }] && ( [string eq "" $min_sort_order] || $sort_order < $min_sort_order ) } {
+ if { ![db_string completed_p { *SQL* }] && ( [string eq "" $min_sort_order] || $sort_order < $min_sort_order ) } {
set min_sort_order $sort_order
set activity_id $structure_id
set next_activity_type structure
@@ -2019,20 +1911,8 @@
# save the last one (the last role_part_id of THE LAST completed activity) because we will use it latter
# JOPEZ: needed to split the db_foreach from the body because of db pools
- foreach completed_activity [db_list_of_lists completed_activity {
- select stat.completed_id,
- stat.role_part_id,
- stat.type,
- rp.sort_order,
- rp.act_id
- from imsld_status_user stat, imsld_role_parts rp
- 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]
+ foreach completed_activity [db_list_of_lists completed_activity { *SQL* }] {
+ set related_id [lindex $completed_activity 0]
set role_part_id [lindex $completed_activity 1]
set type [lindex $completed_activity 2]
set sort_order [lindex $completed_activity 3]
@@ -2093,7 +1973,7 @@
$environments \
$activities \
$feedbacks \
- {}
+ ""
}
support {
db_1row get_support_activity_info_from_isa {
@@ -2123,7 +2003,7 @@
$environments \
$activities \
$feedbacks \
- {}
+ ""
}
structure {
db_1row get_support_activity_info_from_ias {
@@ -2314,7 +2194,7 @@
$environments \
$activities \
{} \
- {not completed}
+ {}
#"finish"
}
@@ -2345,21 +2225,10 @@
$environments \
$activities \
{} \
- {not completed}
+ {}
#"finish"
}
- # this should never happen, but in case the next activiy is already finished, let's throw an error
- # instead of doing nothing
- if { [db_string verify_not_completed {
- select count(*) from imsld_status_user
- where completed_id = :activity_id
- and user_id = :user_id
- }] } {
- return -code error "IMSLD::imsld::next_activity: Returning a completed activity!"
- ad_script_abort
- }
-
# first parameter: activity name
return [template::multirow size imsld_multirow]
}
@@ -2590,66 +2459,42 @@
#if not done yet, tag the resource as finished
- if { ![db_string check_completed_resource {
- select count(*)
- from imsld_status_user
- where completed_id=:resource_id
- and user_id = :user_id
- }] } {
- db_dml insert_completed_resource {
- insert into imsld_status_user (
- imsld_id,
- role_part_id,
- completed_id,
- user_id,
- type,
- finished_date
- )
- (
- select :imsld_id,
- :role_part_id,
- :resource_id,
- :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)
- )
- }
-
+ if { ![db_string check_completed_resource { *SQL* }] } {
+ db_dml insert_completed_resource { *SQL* }
+ }
#find all the resouces in the same activity
- set first_resources_item_list [imsld::process_learning_activity -activity_item_id $activity_item_id -resource_mode "t"]
+ set first_resources_item_list [imsld::process_learning_activity -activity_item_id $activity_item_id -resource_mode "t"]
#only the learning_activities must be finished
- set resources_item_list [lindex $first_resources_item_list 3]
- if { [llength $resources_item_list] == 0 } {
- set resources_item_list [lindex $first_resources_item_list 2]
- }
+ set resources_item_list [lindex $first_resources_item_list 3]
+ if { [llength $resources_item_list] == 0 } {
+ set resources_item_list [lindex $first_resources_item_list 2]
+ }
- set all_finished_p 1
- foreach resource_item_id $resources_item_list {
- foreach res_id $resource_item_id {
- if { ![db_0or1row resource_finished_p {
- select 1
- from imsld_status_user stat, imsld_cp_resourcesi icr
- where icr.item_id = :res_id
- and icr.resource_id = stat.completed_id
- and user_id = :user_id
- }] } {
- # if the resource is not in the imsld_status_user, then the resource is not finished
- set all_finished_p 0
- break
- }
+ set all_finished_p 1
+ foreach resource_item_id $resources_item_list {
+ foreach res_id $resource_item_id {
+ if { ![db_0or1row resource_finished_p {
+ select 1
+ from imsld_status_user stat, imsld_cp_resourcesi icr
+ where icr.item_id = :res_id
+ and icr.resource_id = stat.completed_id
+ and user_id = :user_id
+ }] } {
+ # if the resource is not in the imsld_status_user, then the resource is not finished
+ set all_finished_p 0
+ break
}
}
+ }
#if all are finished, tag the activity as finished
- 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 \
- -type $activity_type\
- -code_call
- }
+ 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 \
+ -type $activity_type\
+ -code_call
}
}
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 -N -r1.8 -r1.9
--- openacs-4/packages/imsld/tcl/imsld-procs.xql 8 Feb 2006 13:55:35 -0000 1.8
+++ openacs-4/packages/imsld/tcl/imsld-procs.xql 8 Feb 2006 17:37:59 -0000 1.9
@@ -195,19 +195,21 @@
insert into imsld_status_user (imsld_id,
play_id,
act_id,
- completed_id,
+ related_id,
user_id,
type,
- finished_date)
+ status_date,
+ status)
(
select :imsld_id,
:play_id,
:act_id,
:role_part_id,
:user_id,
'act',
- now()
- where not exists (select 1 from imsld_status_user where imsld_id = :imsld_id and user_id = :user_id and completed_id = :role_part_id)
+ now(),
+ 'finished'
+ where not exists (select 1 from imsld_status_user where imsld_id = :imsld_id and user_id = :user_id and related_id = :role_part_id and status = 'finished')
)
@@ -267,18 +269,20 @@
insert into imsld_status_user (imsld_id,
play_id,
- completed_id,
+ related_id,
user_id,
type,
- finished_date)
+ status_date,
+ status)
(
select :imsld_id,
:play_id,
:act_id,
:user_id,
'act',
- now()
- where not exists (select 1 from imsld_status_user where imsld_id = :imsld_id and user_id = :user_id and completed_id = :act_id)
+ now(),
+ 'finished'
+ where not exists (select 1 from imsld_status_user where imsld_id = :imsld_id and user_id = :user_id and related_id = :act_id and status = 'finished')
)
@@ -300,17 +304,19 @@
insert into imsld_status_user (imsld_id,
- completed_id,
+ related_id,
user_id,
type,
- finished_date)
+ status_date,
+ status)
(
select :imsld_id,
:play_id,
:user_id,
'play',
- now()
- where not exists (select 1 from imsld_status_user where imsld_id = :imsld_id and user_id = :user_id and completed_id = :play_id)
+ now(),
+ 'finished'
+ where not exists (select 1 from imsld_status_user where imsld_id = :imsld_id and user_id = :user_id and related_id = :play_id and status = 'finished')
)
@@ -332,17 +338,19 @@
insert into imsld_status_user (imsld_id,
- completed_id,
+ related_id,
user_id,
type,
- finished_date)
+ status_date,
+ status)
(
select :imsld_id,
:imsld_id,
:user_id,
'play',
- now()
- where not exists (select 1 from imsld_status_user where imsld_id = :imsld_id and user_id = :user_id and completed_id = :imsld_id)
+ now(),
+ 'finished'
+ where not exists (select 1 from imsld_status_user where imsld_id = :imsld_id and user_id = :user_id and related_id = :imsld_id and status = 'finished')
)
@@ -364,17 +372,19 @@
insert into imsld_status_user (imsld_id,
- completed_id,
+ related_id,
user_id,
type,
- finished_date)
+ status_date,
+ status)
(
select :imsld_id,
:method_id,
:user_id,
'method',
- now()
- where not exists (select 1 from imsld_status_user where imsld_id = :imsld_id and user_id = :user_id and completed_id = :method_id)
+ now(),
+ 'finished'
+ where not exists (select 1 from imsld_status_user where imsld_id = :imsld_id and user_id = :user_id and related_id = :method_id and status = 'finished')
)
@@ -424,16 +434,28 @@
- insert into imsld_status_user (
+ insert into imsld_status_user (
+ imsld_id,
+ play_id,
+ act_id,
+ role_part_id,
+ related_id,
+ user_id,
+ type,
+ status_date,
+ status
+ )
+ (
select :imsld_id,
:play_id,
:act_id,
:role_part_id,
:element_id,
:user_id,
:type,
- now()
- where not exists (select 1 from imsld_status_user where imsld_id = :imsld_id and user_id = :user_id and completed_id = :element_id)
+ now(),
+ 'finished'
+ where not exists (select 1 from imsld_status_user where imsld_id = :imsld_id and user_id = :user_id and related_id = :element_id and status = 'finished')
)
@@ -467,16 +489,17 @@
select count(*) from imsld_status_user
- where completed_id = :activity_id
+ where related_id = :activity_id
and user_id = :user_id
+ and status = 'finished'
-select 1 from imsld_status_user where completed_id = :role_part_id and user_id = :user_id
+select 1 from imsld_status_user where related_id = :role_part_id and user_id = :user_id and status = 'finished'
@@ -594,8 +617,9 @@
select count(*)
from imsld_status_user
- where completed_id = :learning_activity_id
+ where related_id = :learning_activity_id
and user_id = :user_id
+ and status = 'finished'
@@ -617,9 +641,9 @@
select count(*)
from imsld_status_user
- where completed_id = :support_activity_id
+ where related_id = :support_activity_id
and user_id = :user_id
-
+ and status = 'finished'
@@ -640,9 +664,9 @@
select count(*)
from imsld_status_user
- where completed_id = :structure_id
+ where related_id = :structure_id
and user_id = :user_id
-
+ and status = 'finished'
@@ -651,9 +675,9 @@
select 1
from imsld_status_user
- where completed_id = :role_part_id
+ where related_id = :role_part_id
and user_id = :user_id
-
+ and status = 'finished'
@@ -682,29 +706,29 @@
select count(*) from imsld_status_user
- where completed_id = content_item__get_live_revision(:learning_activity_id)
+ where related_id = content_item__get_live_revision(:learning_activity_id)
and user_id = :user_id
-
+ and status = 'finished'
select count(*) from imsld_status_user
- where completed_id = content_item__get_live_revision(:support_activity_id)
+ where related_id = content_item__get_live_revision(:support_activity_id)
and user_id = :user_id
-
+ and status = 'finished'
select count(*) from imsld_status_user
- where completed_id = content_item__get_live_revision(:activity_structure_id)
+ where related_id = content_item__get_live_revision(:activity_structure_id)
and user_id = :user_id
-
+ and status = 'finished'
@@ -713,9 +737,9 @@
select 1
from imsld_status_user
- where completed_id = :act_id
+ where related_id = :act_id
and user_id = :user_id
-
+ and status = 'finished'
@@ -724,9 +748,9 @@
select 1
from imsld_status_user
- where completed_id = :play_id
+ where related_id = :play_id
and user_id = :user_id
-
+ and status = 'finished'
@@ -735,9 +759,9 @@
select 1
from imsld_status_user
- where completed_id = :method_id
+ where related_id = :method_id
and user_id = :user_id
-
+ and status = 'finished'
@@ -746,9 +770,9 @@
select 1
from imsld_status_user
- where completed_id = :imsld_id
+ where related_id = :imsld_id
and user_id = :user_id
-
+ and status = 'finished'
@@ -1320,7 +1344,8 @@
from imsld_status_user
where user_id = :user_id
and imsld_id = :imsld_id
-
+ and status = 'finished'
+ and type = 'role-part'
@@ -1348,7 +1373,7 @@
- select stat.completed_id,
+ select stat.related_id,
stat.role_part_id,
stat.type,
rp.sort_order,
@@ -1358,7 +1383,7 @@
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
+ order by stat.status_date
@@ -1369,7 +1394,7 @@
select coalesce(title,identifier) as activity_title,
item_id as activity_item_id
from imsld_learning_activitiesi
- where activity_id = :completed_id
+ where activity_id = :related_id
@@ -1380,7 +1405,7 @@
select coalesce(title,identifier) as activity_title,
item_id as activity_item_id
from imsld_support_activitiesi
- where activity_id = :completed_id
+ where activity_id = :related_id
@@ -1391,7 +1416,7 @@
select coalesce(title,identifier) as activity_title,
item_id as structure_item_id
from imsld_activity_structuresi
- where structure_id = :completed_id
+ where structure_id = :related_id
@@ -1524,9 +1549,9 @@
select count(*) from imsld_status_user
- where completed_id = :activity_id
+ where related_id = :activity_id
and user_id = :user_id
-
+ and status = 'finished'
@@ -1734,19 +1759,21 @@
insert into imsld_status_user (
imsld_id,
role_part_id,
- completed_id,
+ related_id,
user_id,
type,
- finished_date
+ status_date,
+ status
)
(
select :imsld_id,
:role_part_id,
:resource_id,
: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)
+ now(),
+ 'finished'
+ where not exists (select 1 from imsld_status_user where imsld_id = :imsld_id and user_id = :user_id and related_id = :resource_id and status = 'finished')
)
@@ -1758,15 +1785,15 @@
select 1
from imsld_status_user stat, imsld_cp_resourcesi icr
where icr.item_id = :res_id
- and icr.resource_id = stat.completed_id
+ and icr.resource_id = stat.related_id
and user_id = :user_id
-
+ and status = 'finished'
- select 1 from imsld_status_user where completed_id = :activity_id and user_id = :user_id
+ select 1 from imsld_status_user where related_id = :activity_id and user_id = :user_id and status = 'finished'
@@ -1775,8 +1802,8 @@
select count(*)
from imsld_status_user
- where completed_id = :resource_id
-
+ where related_id = :resource_id
+ and status = 'finished'
Index: openacs-4/packages/imsld/www/resources/completed.png
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/resources/completed.png,v
diff -u -N
Binary files differ