Index: openacs-4/packages/assessment/assessment.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/assessment.info,v diff -u -r1.44 -r1.45 --- openacs-4/packages/assessment/assessment.info 27 Jun 2007 22:45:26 -0000 1.44 +++ openacs-4/packages/assessment/assessment.info 2 Sep 2008 01:08:46 -0000 1.45 @@ -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,7 +18,7 @@ 0 #assessment.Assessment# - + Index: openacs-4/packages/assessment/sql/oracle/assessment-collected-data-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/oracle/assessment-collected-data-create.sql,v diff -u -r1.6 -r1.7 --- openacs-4/packages/assessment/sql/oracle/assessment-collected-data-create.sql 15 May 2007 20:14:16 -0000 1.6 +++ openacs-4/packages/assessment/sql/oracle/assessment-collected-data-create.sql 2 Sep 2008 01:08:46 -0000 1.7 @@ -138,14 +138,29 @@ file_id integer constraint as_item_data_file_id_fk references cr_revisions(revision_id) - on delete cascade + on delete cascade, + as_cr_item_id integer, + choice_value varchar2(4000) -- to do: figure out how attachment answers should be supported; the Attachment package is still in need of considerable help. Can we rely on it here? ); create index as_item_data_pk2 on as_item_data (session_id, section_id, as_item_id); create index as_item_data_pk3 on as_item_data (as_item_id, section_id, session_id); create index as_item_data_subj_idx on as_item_data (subject_id); create index as_item_data_as_item_id_idx on as_item_data (as_item_id); + +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 table as_session_results ( result_id integer constraint as_sess_res_res_id_pk @@ -179,6 +194,22 @@ create unique index as_idata_choices_pk2 on as_item_data_choices (choice_id, item_data_id); +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; + -- here the order of the displayed sections is stored per session create table as_session_sections ( session_id integer Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/assessment/sql/oracle/upgrade/upgrade-0.22d5-0.22d6.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/assessment/sql/postgresql/assessment-collected-data-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/sql/postgresql/assessment-collected-data-create.sql,v diff -u -r1.13 -r1.14 --- openacs-4/packages/assessment/sql/postgresql/assessment-collected-data-create.sql 7 Oct 2007 22:36:53 -0000 1.13 +++ openacs-4/packages/assessment/sql/postgresql/assessment-collected-data-create.sql 2 Sep 2008 01:08:46 -0000 1.14 @@ -136,7 +136,9 @@ file_id integer constraint as_item_data_file_id_fk references cr_revisions(revision_id) - on delete cascade + on delete cascade, + as_cr_item_id integer, + choice_value text -- to do: figure out how attachment answers should be supported; the Attachment package is still in need of considerable help. Can we rely on it here? ); @@ -145,6 +147,17 @@ create index as_item_data_subject_id_idx on as_item_data (subject_id); create index as_item_data_as_item_id_idx on as_item_data (as_item_id); +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 trigger as_item_data_ins_trg before insert on as_item_data for each row execute procedure as_item_data_ins_trg(); + create table as_session_results ( result_id integer constraint as_session_results_result_id_pk @@ -178,6 +191,22 @@ create unique index as_item_data_choices_pk2 on as_item_data_choices (choice_id, item_data_id); +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_choices +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 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(); + -- here the order of the displayed sections is stored per session create table as_session_sections ( session_id integer Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/assessment/sql/postgresql/upgrade/upgrade-0.22d5-0.22d6.sql'. Fisheye: No comparison available. Pass `N' to diff?