Index: openacs-4/packages/assessment-portlet/www/assessment-portlet-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment-portlet/www/assessment-portlet-postgresql.xql,v diff -u -r1.9 -r1.10 --- openacs-4/packages/assessment-portlet/www/assessment-portlet-postgresql.xql 20 Sep 2006 15:04:15 -0000 1.9 +++ openacs-4/packages/assessment-portlet/www/assessment-portlet-postgresql.xql 26 Sep 2006 04:10:09 -0000 1.10 @@ -5,13 +5,24 @@ - select cr.item_id as assessment_id, cr.title, cr.description, a.password, + select * from (select cr.item_id as assessment_id, cr.title, cr.description, a.password, + a.type, to_char(a.start_time, 'YYYY-MM-DD HH24:MI:SS') as start_time, to_char(a.end_time, 'YYYY-MM-DD HH24:MI:SS') as end_time, to_char(now(), 'YYYY-MM-DD HH24:MI:SS') as cur_time, cf.package_id, p.instance_name as community_name, sc.node_id as comm_node_id, sa.node_id as as_node_id, a.anonymous_p, - acs_permission__permission_p(a.assessment_id,:user_id,'admin') as admin_p + acs_permission__permission_p(a.assessment_id,:user_id,'admin') as admin_p, + (select count(*) from as_sessions s1 where + s1.assessment_id=a.assessment_id + and s1.subject_id=:user_id + and completed_datetime is null) as in_progress_p, + (select count(*) from as_sessions s1 where + s1.assessment_id=a.assessment_id + and s1.subject_id=:user_id + and completed_datetime is not null) as completed_p, + a.number_tries + from as_assessments a, cr_revisions cr, cr_items ci, cr_folders cf, site_nodes sa, site_nodes sc, apm_packages p, (select distinct asm.assessment_id @@ -29,7 +40,9 @@ and sc.node_id = sa.parent_id and p.package_id = sc.object_id and s.assessment_id = a.assessment_id + and ((a.start_time < current_timestamp and a.end_time > current_timestamp) or a.start_time is null) order by lower(p.instance_name), lower(cr.title) +) q where (q.completed_p < q.number_tries) or q.number_tries is null Index: openacs-4/packages/assessment-portlet/www/assessment-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment-portlet/www/assessment-portlet.adp,v diff -u -r1.6 -r1.7 --- openacs-4/packages/assessment-portlet/www/assessment-portlet.adp 22 Apr 2005 15:15:17 -0000 1.6 +++ openacs-4/packages/assessment-portlet/www/assessment-portlet.adp 26 Sep 2006 04:10:09 -0000 1.7 @@ -1,11 +1,12 @@ +

#assessment.Open_Assessments#

-

#assessment.answered_assessments#

+

#assessment.Closed_Assessments#

Index: openacs-4/packages/assessment-portlet/www/assessment-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment-portlet/www/assessment-portlet.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/assessment-portlet/www/assessment-portlet.tcl 20 Sep 2006 15:04:15 -0000 1.10 +++ openacs-4/packages/assessment-portlet/www/assessment-portlet.tcl 26 Sep 2006 04:10:09 -0000 1.11 @@ -29,14 +29,17 @@ lappend elements title \ [list \ - label "[_ assessment.open_assessments]" \ - display_template {@assessments.title@}] + label "[_ assessment.Title]" \ + display_template {@assessments.title@Yes(this assessment is anonymous)}] -lappend elements anonymous_p \ - [list \ - label "[_ assessment-portlet.lt_Is_this_assessment_an]" \ - display_template {YesNo}] - +lappend elements status { + label "[_ assessment.Status]" + display_template {IncompleteFinishedUntaken} +} +lappend elements take { + label "" + display_template {TakeRetake} +} if {[llength $list_of_package_ids]==1} { set admin_p [permission::permission_p \ -party_id $user_id \ @@ -52,11 +55,21 @@ set hide 1 } +lappend elements session \ + [list \ + label {} \ + display_template {[_ assessment.Review]}] + +lappend elements admin { + label "" + display_template {\#acs-kernel.common_Admin\#} +} + lappend elements results { - hide_p $hide - label "[_ assessment.View_results]" - display_template {\#assessment.View_results\#} + label "" + display_template {\#assessment.Results\#} } + # create a list with all open assessments template::list::create \ -name assessments \ @@ -66,10 +79,10 @@ -main_class narrow # get the information of all open assessments -template::multirow create assessments assessment_id title description assessment_url community_url community_name anonymous_p +template::multirow create assessments assessment_id title description assessment_url community_url community_name anonymous_p in_progress_p completed_p status number_tries admin_p set old_comm_node_id 0 db_foreach open_asssessments {} { - if {$comm_node_id == $old_comm_node_id} {e + if {$comm_node_id == $old_comm_node_id} { set community_name "" } set community_url [site_node::get_url -node_id $comm_node_id] @@ -81,8 +94,15 @@ } else { append assessment_url [export_vars -base "assessment-password" {assessment_id}] } + if {$in_progress_p > 0} { + set status in_progress + } elseif {$completed_p >0} { + set status finished + } else { + set status untaken + } - template::multirow append assessments $assessment_id $title $description $assessment_url $community_url $community_name $anonymous_p + template::multirow append assessments $assessment_id $title $description $assessment_url $community_url $community_name $anonymous_p $in_progress_p $completed_p $status $number_tries $admin_p } @@ -101,14 +121,24 @@ lappend elements title \ [list \ - label "[_ assessment.Assessments]"] \ + label "[_ assessment.Title]"] + lappend elements session \ [list \ - label {[_ assessment.Sessions]} \ - display_template {[_ assessment.Sessions]}] + label {} \ + display_template {[_ assessment.Review]}] +lappend elements admin { + label "" + display_template {\#acs-kernel.common_Admin\#} +} +lappend elements results { + label "" + display_template {\#assessment.Results\#} + } + # create a list with all answered assessments and their sessions template::list::create \ -name sessions \ @@ -124,6 +154,6 @@ set community_name "" } set community_url [site_node::get_url -node_id $comm_node_id] - set session_url "[site_node::get_url -node_id $as_node_id][export_vars -base sessions {assessment_id}]" + set session_url "[site_node::get_url -node_id $as_node_id][export_vars -base session {assessment_id}]" set old_comm_node_id $comm_node_id } Index: openacs-4/packages/assessment-portlet/www/assessment-portlet.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment-portlet/www/Attic/assessment-portlet.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/assessment-portlet/www/assessment-portlet.xql 7 Apr 2006 23:12:50 -0000 1.5 +++ openacs-4/packages/assessment-portlet/www/assessment-portlet.xql 26 Sep 2006 04:10:09 -0000 1.6 @@ -3,14 +3,26 @@ -select ass.*, sc.node_id as comm_node_id, sa.node_id as as_node_id, p.instance_name as community_name from - (select cr.item_id as assessment_id, cr.title, cr.description, cf.package_id +select * from (select ass.*, sc.node_id as comm_node_id, sa.node_id as as_node_id, p.instance_name as community_name, +acs_permission__permission_p(ass.assessment_id,:user_id,'admin') as admin_p, + (select count(*) from as_sessions s1 where + s1.assessment_id=ass.assessment_id + and s1.subject_id=:user_id + and completed_datetime is null) as in_progress_p, + (select count(*) from as_sessions s1 where + s1.assessment_id=ass.assessment_id + and s1.subject_id=:user_id + and completed_datetime is not null) as completed_p + from + (select cr.item_id as assessment_id, cr.title, cr.description, cf.package_id, + a.number_tries, a.end_time from as_assessments a, cr_revisions cr, cr_items ci, cr_folders cf, ( select distinct s.assessment_id from as_sessions s where s.subject_id = :user_id and s.completed_datetime is not null) s where a.assessment_id = cr.revision_id -- + and cf.package_id in ([join $list_of_package_ids ", "]) and cr.item_id = ci.item_id and ci.parent_id = cf.folder_id and s.assessment_id = a.assessment_id @@ -20,6 +32,7 @@ and sc.node_id = sa.parent_id and p.package_id = sc.object_id order by lower(p.instance_name), lower(ass.title) +) q where ((q.number_tries is not null and q.completed_p >= q.number_tries) or q.end_time > current_timestamp) and (q.in_progress_p <1)