Index: openacs-4/packages/survey/survey.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey/survey.info,v diff -u -r1.1 -r1.2 --- openacs-4/packages/survey/survey.info 15 Sep 2002 23:56:54 -0000 1.1 +++ openacs-4/packages/survey/survey.info 16 Sep 2002 01:04:46 -0000 1.2 @@ -113,6 +113,7 @@ + @@ -181,8 +182,8 @@ - + Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/survey/sql/oracle/diff'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/survey/sql/oracle/survey-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey/sql/oracle/survey-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/survey/sql/oracle/survey-drop.sql 15 Sep 2002 23:57:20 -0000 1.1 +++ openacs-4/packages/survey/sql/oracle/survey-drop.sql 16 Sep 2002 01:04:51 -0000 1.2 @@ -7,10 +7,9 @@ @@ survey-package-drop.sql - -drop view survey_question_responses_un; +drop view survey_ques_responses_latest; drop table survey_question_responses cascade constraints; -drop view survey_responses_unique; +drop view survey_responses_latest; drop table survey_responses cascade constraints; drop table survey_question_choices cascade constraints; Index: openacs-4/packages/survey/sql/postgresql/survey-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey/sql/postgresql/survey-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/survey/sql/postgresql/survey-create.sql 15 Sep 2002 23:57:48 -0000 1.1 +++ openacs-4/packages/survey/sql/postgresql/survey-create.sql 16 Sep 2002 01:04:53 -0000 1.2 @@ -255,28 +255,11 @@ ); -create index survey_response_index on survey_question_responses (response_id, question_id); -create index survey_q_r_choice_id on survey_question_responses(choice_id); -create index survey_q_r_attachment_answer on survey_question_responses(attachment_answer); - - -- this view contains only the most recently edited version -- of each survey response. -create view survey_responses_latest as -select sr.*, o.creation_date, - o.creation_user, - survey_response__initial_user_id(sr.response_id) as initial_user_id - from survey_responses sr - join acs_objects o - on (sr.response_id = o.object_id) - join (select max(response_id) as response_id - from survey_responses - group by survey_response__initial_response_id(response_id)) latest - on (sr.response_id = latest.response_id); - -- this table stores the answers to each question for a survey -- we want to be able to hold different data types in one long skinny table -- but we also may want to do averages, etc., so we can't just use CLOBs @@ -307,14 +290,8 @@ on delete cascade ); - -create or replace view survey_ques_responses_latest as -select qr.* - from survey_question_responses qr, survey_responses_latest r - where qr.response_id=r.response_id; - - - +create index survey_q_r_choice_id on survey_question_responses(choice_id); +create index survey_q_r_attachment_answer on survey_question_responses(attachment_answer); create index survey_response_index on survey_question_responses (response_id, question_id); -- We create a view that selects out only the last response from each @@ -415,8 +392,6 @@ end;' language 'plpgsql'; - - create function survey_section__delete (integer) returns integer as ' declare @@ -431,8 +406,6 @@ end;' language 'plpgsql'; - - create function survey_question__new (integer,integer,integer,text,varchar,boolean,boolean,varchar,varchar,varchar,integer,integer) returns integer as ' declare @@ -565,3 +538,20 @@ end;' language 'plpgsql'; +create view survey_responses_latest as +select sr.*, o.creation_date, + o.creation_user, + survey_response__initial_user_id(sr.response_id) as initial_user_id + from survey_responses sr + join acs_objects o + on (sr.response_id = o.object_id) + join (select max(response_id) as response_id + from survey_responses + group by survey_response__initial_response_id(response_id)) latest + on (sr.response_id = latest.response_id); + +create view survey_ques_responses_latest as +select qr.* + from survey_question_responses qr, survey_responses_latest r + where qr.response_id=r.response_id; + Index: openacs-4/packages/survey/sql/postgresql/survey-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey/sql/postgresql/survey-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/survey/sql/postgresql/survey-drop.sql 15 Sep 2002 23:57:48 -0000 1.1 +++ openacs-4/packages/survey/sql/postgresql/survey-drop.sql 16 Sep 2002 01:04:53 -0000 1.2 @@ -19,9 +19,9 @@ drop table survey_variables; drop view survey_variable_id_sequence; drop sequence survey_variable_id_seq; -drop view survey_question_responses_un; +drop view survey_responses_latest; +drop view survey_ques_responses_latest; drop table survey_question_responses; -drop view survey_responses_unique; drop table survey_responses; drop table survey_question_choices; drop view survey_choice_id_sequence;