Index: openacs-4/packages/assessment/www/asm-admin/toggle-publish.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/toggle-publish.xql,v diff -u -r1.1 -r1.1.2.1 --- openacs-4/packages/assessment/www/asm-admin/toggle-publish.xql 28 Nov 2006 18:17:53 -0000 1.1 +++ openacs-4/packages/assessment/www/asm-admin/toggle-publish.xql 23 Mar 2007 16:35:56 -0000 1.1.2.1 @@ -1,6 +1,26 @@ + + + select publish_status from cr_items where item_id=:assessment_id + + + + + + -- group sections with item_counts, then select those sections with 0 items + select title + from (select asm.section_id, count(ism.as_item_id) as count, cr.title + from cr_items i, cr_revisions cr, as_assessment_section_map asm left join as_item_section_map ism using (section_id) + where i.item_id=:assessment_id + and asm.assessment_id=i.latest_revision + and cr.revision_id = asm.section_id + group by asm.section_id, cr.title) item_counts + where count = 0 + + + update cr_items set publish_status = (case when publish_status is null or publish_status <> 'live' then 'live' else null end) where item_id=:assessment_id