roelc
committed
on 09 Jun 06
Check for non-existent assessment
openacs-4/.../www/admin/one-section.tcl (+4 -2)
29 29
30 30 set community_package_id [dotlrn_community::get_package_id $community_id]
31 31
32 32 set context [list [list "course-list" "Course List"] [list "course-info?course_id=$course_id" "$course_name"] $section_name ]
33 33
34 34 set public_pages_url "../pages/${section_id}/"
35 35 set section_folder_id [dotlrn_ecommerce::section::get_public_folder_id $section_id]
36 36 set public_pages_admin_url [export_vars -base ${community_url}/file-storage/ {{folder_id $section_folder_id}}]
37 37 set num_attendees [db_string num_attendees { }]
38 38
39 39 set attendance_show_p [apm_package_installed_p "attendance"]
40 40 set expensetracking_show_p [apm_package_installed_p "expenses"]
41 41 set show_public_pages_p [parameter::get -parameter SupportPublicPagesP -default 0]
42 42
43 43 # Get application assessment
44 44 set assessment_id [db_string get_assessment {
45 45     select c.assessment_id, c.auto_register_p
46 46    
47 47     from dotlrn_ecommerce_section s,
48 48     dotlrn_catalogi c,
49       cr_items i
  49     cr_items i,
  50     as_assessmentsi a
50 51    
51 52     where s.course_id = c.item_id
52 53     and c.item_id = i.item_id
53 54     and i.live_revision = c.course_id
  55     and c.assessment_id = a.item_id
54 56     and s.section_id = :section_id
55 57    
56 58     limit 1
57 59 } -default ""]
58 60
59 61 if { ! [empty_string_p $assessment_id] } {
60 62     as::assessment::data -assessment_id $assessment_id
61 63     set assessment_package_id [parameter::get -parameter AssessmentPackage]
62 64     set assessment_package_url [site_node::get_url_from_object_id -object_id $assessment_package_id]
63 65 set assessment_select_url [export_vars -base [apm_package_url_from_key dotlrn-ecommerce]admin/course-add-edit { course_id }]
64 66     set assessment_view_url [export_vars -base ${assessment_package_url}assessment { assessment_id }]
65 67     set assessment_edit_url [export_vars -base ${assessment_package_url}asm-admin/one-a { assessment_id }]
66 68 }
67 69
68 70 # Flush cache for this section
69 71 # Shouldn't have much effect on performance and will keep the data
70 72 # more up to date
71 73 dotlrn_ecommerce::section::flush_cache $section_id