derickl
committed
on 23 Jun 08
Removing duplicate images (*.GIF)
/www/evaluation-evaluations-portlet-postgresql.xql (+28 -1)
5 5
6 6 <fullquery name="get_grades">     
7 7       <querytext>
8 8
9 9                 select eg.grade_plural_name,
10 10                 eg.grade_id,
11 11                 eg.grade_item_id
12 12                 from evaluation_gradesx eg, acs_objects ao
13 13                 where exists (select 1 from cr_items
14 14                     where live_revision = eg.grade_id)
15 15                   and eg.item_id = ao.object_id
16 16                   and ao.context_id in  ([join $list_of_package_ids ,])
17 17                 order by grade_plural_name desc
18 18         
19 19       </querytext>
20 20 </fullquery>
21 21
22 22 <fullquery name="get_total_grade">     
23 23       <querytext>
24 24
25           select evaluation__class_total_grade(:user_id,[lindex $list_of_package_ids 0])
  25         select coalesce(sum((ese.grade*et.weight*eg.weight)/10000),0) as grade
  26         from evaluation_grades eg, evaluation_tasks et, evaluation_student_evals ese, acs_objects ao
  27         where et.task_item_id = ese.task_item_id
  28                   and et.grade_item_id = eg.grade_item_id
  29           and eg.grade_item_id = ao.object_id
  30                   and ao.context_id = [lindex $list_of_package_ids 0]
  31                   and ese.party_id =
26 32
  33         ( select
  34         CASE
  35           WHEN et3.number_of_members = 1 THEN $user_id
  36           ELSE
  37         (select etg2.group_id from evaluation_task_groups etg2,
  38                                                       evaluation_tasks et2,
  39                                                       acs_rels map
  40                                                       where map.object_id_one = etg2.group_id
  41                                                         and map.object_id_two = $user_id
  42                                                         and etg2.task_item_id = et2.task_item_id
  43                                                         and et2.task_id = et.task_id)
  44
  45         END as nom
  46                from evaluation_tasks et3
  47               where et3.task_id = et.task_id
  48         )
  49
  50         and exists (select 1 from cr_items where live_revision = eg.grade_id)
  51         and exists (select 1 from cr_items where live_revision = et.task_id)
  52         and exists (select 1 from cr_items where live_revision = ese.evaluation_id)
  53         
27 54       </querytext>
28 55 </fullquery>
29 56
30 57 </queryset>