Index: openacs-4/packages/assessment/assessment.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/assessment.info,v
diff -u -r1.46 -r1.47
--- openacs-4/packages/assessment/assessment.info 2 Sep 2008 01:35:33 -0000 1.46
+++ openacs-4/packages/assessment/assessment.info 5 Nov 2008 19:08:35 -0000 1.47
@@ -7,7 +7,7 @@
f
f
-
+
Eduardo Perez Ureta
Assessment package that will replace the survey,
quizz, complex survey, poll and other data collection packages
@@ -18,12 +18,12 @@
0
#assessment.Assessment#
-
-
-
-
+
+
+
+
-
+
Index: openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.23d1-0.23d2.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.23d1-0.23d2.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.23d1-0.23d2.sql 5 Nov 2008 19:08:35 -0000 1.1
@@ -0,0 +1,81 @@
+
+alter table as_item_data add as_item_cr_item_id integer;
+alter table as_item_data add choice_value varchar2(4000);
+
+create or replace trigger as_item_data_ins_trg
+before insert on as_item_data
+for each row
+declare v_item_id integer;
+begin
+select item_id into v_item_id
+from cr_revisions where revision_id = :new.as_item_id;
+:new.as_item_cr_item_id := v_item_id;
+end as_item_data_ins_trg;
+/
+show errors;
+
+create or replace trigger as_item_data_choices_ins_trg
+after insert on as_item_data_choices
+for each row
+declare v_choice_value varchar(4000) default '';
+begin
+
+select title into v_choice_value
+from as_item_choicesx
+where choice_id = :new.choice_id;
+
+update as_item_data set choice_value = coalesce(choice_value,'') || ' ' || coalesce(v_choice_value,'') where item_data_id = :new.item_data_id;
+
+end as_item_data_choices_ins_trg;
+/
+show errors;
+
+create or replace trigger as_item_data_upd_trg
+before update on as_item_data
+for each row
+declare v_item_id integer;
+begin
+select item_id into v_item_id
+from cr_revisions where revision_id = :new.as_item_id;
+:new.as_item_cr_item_id := v_item_id;
+end as_item_data_ins_trg;
+/
+show errors;
+
+update as_item_data set item_data_id=item_data_id;
+
+drop trigger as_item_data_upd_trg;
+
+create or replace procedure as_item_data_choices_upd_trg is
+
+v_choice_value varchar(4000) default '';
+v_last_item_data_id integer default NULL;
+
+cursor choices_cur is
+select title as text_value, item_data_id from
+ as_item_choicesx c,
+ as_item_data_choices dc
+ where
+ c.choice_id = dc.choice_id
+ order by dc.item_data_id;
+begin
+for choice_rec in choices_cur loop
+ if v_last_item_data_id <> choice_rec.item_data_id then
+ v_choice_value := '';
+ end if;
+ v_choice_value := v_choice_value || ' ' || coalesce(choice_rec.text_value,'');
+
+ update as_item_data set choice_value = v_choice_value where item_data_id = choice_rec.item_data_id;
+ v_last_item_data_id := choice_rec.item_data_id;
+end loop;
+end as_item_data_choices_upd_trg;
+/
+show errors;
+
+begin
+as_item_data_choices_upd_trg;
+end;
+/
+show errors;
+drop procedure as_item_data_choices_upd_trg;
+
Index: openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.23d2-0.23d3.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.23d2-0.23d3.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.23d2-0.23d3.sql 5 Nov 2008 19:08:35 -0000 1.1
@@ -0,0 +1,64 @@
+alter table as_items rename column points to points_int;
+alter table as_items add points float;
+update as_items set points=points_int;
+alter table as_items drop column points_int;
+
+begin
+content_type.refresh_view('as_item_data');
+end;
+/
+show errors;
+
+alter table as_item_data rename column points to points_int;
+alter table as_item_data add points float;
+update as_item_data set points=points_int;
+alter table as_item_data drop column points_int;
+
+begin
+content_type.refresh_view('as_item_data');
+end;
+/
+show errors;
+
+alter table as_session_results rename column points to points_int;
+alter table as_session_results add points float;
+update as_session_results set points=points_int;
+alter table as_session_results drop column points_int;
+
+begin
+content_type.refresh_view('as_session_results');
+end;
+/
+show errors;
+
+alter table as_sections rename column points to points_int;
+alter table as_sections add points float;
+update as_sections set points=points_int;
+alter table as_sections drop column points_int;
+
+begin
+content_type.refresh_view('as_sections');
+end;
+/
+show errors;
+
+alter table as_section_data rename column points to points_int;
+alter table as_section_data add points float;
+update as_section_data set points=points_int;
+alter table as_section_data drop column points_int;
+
+begin
+content_type.refresh_view('as_section_data');
+end;
+/
+show errors;
+
+alter table as_assessment_section_map rename column points to points_int;
+alter table as_assessment_section_map add points type float;
+update as_assessment_section_map set points=points_int;
+alter table as_assessment_section_map drop column points_int;
+alter table as_item_section_map alter points type float;
+alter table as_item_section_map add points type float;
+update as_item_section_map set points=points_int;
+alter table as_item_section_map drop column points_int;
+
Index: openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.23d1-0.23d2.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.23d1-0.23d2.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.23d1-0.23d2.sql 5 Nov 2008 19:08:35 -0000 1.1
@@ -0,0 +1,57 @@
+
+alter table as_item_data add as_item_cr_item_id integer;
+alter table as_item_data add choice_value text;
+
+create or replace function as_item_data_ins_trg() returns trigger as '
+declare v_item_id integer;
+begin
+select item_id into v_item_id
+from cr_revisions where revision_id = NEW.as_item_id;
+NEW.as_item_cr_item_id = v_item_id;
+return NEW;
+end;' language 'plpgsql';
+
+create or replace function as_item_data_choices_ins_trg () returns trigger as '
+declare v_choice_value text default '''';
+begin
+
+select title into v_choice_value
+from as_item_choicesx
+where choice_id = NEW.choice_id;
+
+update as_item_data set choice_value = coalesce(choice_value,'''') || '' '' || coalesce(v_choice_value,'''') where item_data_id = new.item_data_id;
+
+return NEW;
+
+end;' language 'plpgsql';
+
+create or replace function as_item_data_choices_upd_trg() returns trigger as '
+declare v_choice_value text default '';
+declare v_row record;
+begin
+
+for v_row in select title as text_value from
+ as_item_choicesx c,
+ as_item_data_choices dc
+ where dc.item_data_id = new.item_data_id and
+ c.choice_id = dc.choice_id
+loop
+ v_choice_value := v_choice_value || ' ' || coalesce(v_row.text_value,'');
+end loop;
+
+update as_item_data set choice_value = coalesce(choice_value,'''') || '' '' || coalesce(v_choice_value,'''') where item_data_id = new.item_data_id;
+return NEW;
+end;' language 'plpgsql';
+
+create trigger as_item_data_ins_trg before insert on as_item_data for each row execute procedure as_item_data_ins_trg();
+create trigger as_item_data_upd_trg before update on as_item_data for each row execute procedure as_item_data_ins_trg();
+
+create trigger as_item_data_choices_ins_trg after insert on as_item_data_choices for each row execute procedure as_item_data_choices_ins_trg();
+create trigger as_item_data_choices_upd_trg after update on as_item_data_choices for each row execute procedure as_item_data_choices_ins_trg();
+
+update as_item_data set item_data_id=item_data_id;
+update as_item_data_choices set item_data_id = item_data_id;
+
+drop trigger as_item_data_choices_upd_trigger on as_item_data_choices;
+drop trigger as_item_data_upd_trigger on as_item_data;
+drop functon as_item_data_choices_upd_trg();
\ No newline at end of file
Index: openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.23d2-0.23d3.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.23d2-0.23d3.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.23d2-0.23d3.sql 5 Nov 2008 19:08:35 -0000 1.1
@@ -0,0 +1,27 @@
+drop view as_itemsx;
+drop view as_itemsi cascade;
+alter table as_items alter points type float;
+select content_type__refresh_view('as_items');
+
+drop view as_item_datax;
+drop view as_item_datai cascade;
+alter table as_item_data alter points type float;
+select content_type__refresh_view('as_item_data');
+
+drop view as_session_resultsx;
+drop view as_session_resultsi cascade;
+alter table as_session_results alter points type float;
+select content_type__refresh_view('as_session_results');
+
+drop view as_sectionsx;
+drop view as_sectionsi cascade;
+alter table as_sections alter points type float;
+select content_type__refresh_view('as_sections');
+
+drop view as_section_datax;
+drop view as_section_datai cascade;
+alter table as_section_data alter points type float;
+select content_type__refresh_view('as_section_data');
+
+alter table as_assessment_section_map alter points type float;
+alter table as_item_section_map alter points type float;