From cf74b143afd609aa142c390848ebb827506a6951 Mon Sep 17 00:00:00 2001 From: rei Date: Sat, 16 Dec 2023 17:48:46 +0900 Subject: [PATCH 1/6] =?UTF-8?q?[feat]=20new-response-form=E3=82=92?= =?UTF-8?q?=E3=82=B3=E3=83=94=E3=83=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../response-form/response-form-settings.ts | 50 ++++ components/response-form/response-form.vue | 263 ++++++++++++++++++ pages/responses/[responseID]/index.vue | 71 +++++ pages/{responses.vue => responses/index.vue} | 2 +- 4 files changed, 385 insertions(+), 1 deletion(-) create mode 100644 components/response-form/response-form-settings.ts create mode 100644 components/response-form/response-form.vue create mode 100644 pages/responses/[responseID]/index.vue rename pages/{responses.vue => responses/index.vue} (79%) diff --git a/components/response-form/response-form-settings.ts b/components/response-form/response-form-settings.ts new file mode 100644 index 0000000..d1ea80a --- /dev/null +++ b/components/response-form/response-form-settings.ts @@ -0,0 +1,50 @@ +export type ResponseSettingsText = { + type: 'Text'; + text: string; +}; + +export type ResponseSettingsTextLong = { + type: 'TextLong'; + textLong: string; +}; + +export type ResponseSettingsNumber = { + type: 'Number'; + number: number | null; +}; + +export type ResponseSettingsSingleChoice = { + type: 'SingleChoice'; + index: number; +}; + +export type ResponseSettingsMultipleChoice = { + type: 'MultipleChoice'; + indexes: number[]; +}; + +export type ResponseSettingsScale = { + type: 'Scale'; + number: number; +}; + +export type ResponseSettings = + | ResponseSettingsText + | ResponseSettingsTextLong + | ResponseSettingsNumber + | ResponseSettingsSingleChoice + | ResponseSettingsMultipleChoice + | ResponseSettingsScale; + +export type ResponseQuestionType = ResponseSettings['type']; + +export type ResponseFormBody = ResponseSettings[]; + +export const defaultQuestionSettingsByType = { + Text: { type: 'Text', text: '' }, + TextLong: { type: 'TextLong', textLong: '' }, + Number: { type: 'Number', number: null }, + SingleChoice: { type: 'SingleChoice', index: -1 }, + MultipleChoice: { type: 'MultipleChoice', indexes: [] }, + Scale: { type: 'Scale', number: -1 }, +} satisfies Record; diff --git a/components/response-form/response-form.vue b/components/response-form/response-form.vue new file mode 100644 index 0000000..b46d81f --- /dev/null +++ b/components/response-form/response-form.vue @@ -0,0 +1,263 @@ + + + + + diff --git a/pages/responses/[responseID]/index.vue b/pages/responses/[responseID]/index.vue new file mode 100644 index 0000000..d02b35e --- /dev/null +++ b/pages/responses/[responseID]/index.vue @@ -0,0 +1,71 @@ + + + + + diff --git a/pages/responses.vue b/pages/responses/index.vue similarity index 79% rename from pages/responses.vue rename to pages/responses/index.vue index ab5393e..f1ca20f 100644 --- a/pages/responses.vue +++ b/pages/responses/index.vue @@ -1,7 +1,7 @@ From 37362f43ee93196be4bd1513f0238cf43cc93f97 Mon Sep 17 00:00:00 2001 From: rei Date: Sun, 17 Dec 2023 14:16:48 +0900 Subject: [PATCH 2/6] =?UTF-8?q?[feat]=20responses/{responseId}=20=E3=83=97?= =?UTF-8?q?=E3=83=AB=E3=83=AA=E3=82=AF=E5=87=BA=E3=81=99=E7=94=A8=E3=81=AE?= =?UTF-8?q?=E3=82=B3=E3=83=9F=E3=83=83=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/response-form/response-form.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/response-form/response-form.vue b/components/response-form/response-form.vue index b46d81f..7375a34 100644 --- a/components/response-form/response-form.vue +++ b/components/response-form/response-form.vue @@ -3,7 +3,7 @@ import { defaultQuestionSettingsByType, type ResponseFormBody, type ResponseSettings, -} from '~/components/response-form/response-form-settings'; +} from '~/components/new-response-form/new-response-form-settings'; import type { ResponseFormQuestionInvalid, ResponseFormQuestionnaireFormSettings, From a7c153e009894ff7389cd462f02af918169d197c Mon Sep 17 00:00:00 2001 From: rei Date: Thu, 11 Jan 2024 19:47:20 +0900 Subject: [PATCH 3/6] =?UTF-8?q?=E7=B7=A8=E9=9B=86=E3=83=9C=E3=82=BF?= =?UTF-8?q?=E3=83=B3=E3=82=92=E4=BD=9C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/response-form/response-form.vue | 77 ++-------------------- pages/responses/[responseID]/edit.vue | 7 ++ 2 files changed, 14 insertions(+), 70 deletions(-) create mode 100644 pages/responses/[responseID]/edit.vue diff --git a/components/response-form/response-form.vue b/components/response-form/response-form.vue index 7375a34..0375e7b 100644 --- a/components/response-form/response-form.vue +++ b/components/response-form/response-form.vue @@ -1,15 +1,15 @@ @@ -186,13 +127,9 @@ const handleSave = () => { />
- -
diff --git a/pages/responses/[responseID]/edit.vue b/pages/responses/[responseID]/edit.vue new file mode 100644 index 0000000..f1ca20f --- /dev/null +++ b/pages/responses/[responseID]/edit.vue @@ -0,0 +1,7 @@ + + + + + From 97cc22d035fbd22bb545953a2e8bc01dd69d7cfd Mon Sep 17 00:00:00 2001 From: rei Date: Fri, 12 Jan 2024 00:38:55 +0900 Subject: [PATCH 4/6] =?UTF-8?q?=E3=83=9A=E3=83=BC=E3=82=B8=E9=81=B7?= =?UTF-8?q?=E7=A7=BB=E3=82=92=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/response-form/response-form.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/response-form/response-form.vue b/components/response-form/response-form.vue index 0375e7b..838e2d6 100644 --- a/components/response-form/response-form.vue +++ b/components/response-form/response-form.vue @@ -96,7 +96,7 @@ for (let i = 0; i < responseSettings.value.length; i++) { } const handleEdit = () => { - route.path = route.path + '/edit'; + navigateTo('/responses/' + route.params.responseID + '/edit'); }; From 7d67aa674e7ffce681e28abc09dcfa2bff11f86f Mon Sep 17 00:00:00 2001 From: rei Date: Sat, 13 Apr 2024 09:08:30 +0900 Subject: [PATCH 5/6] openapi:anke-to --- composables/type-fetch/anke-to/openapi.ts | 67 ++++++++--------------- 1 file changed, 22 insertions(+), 45 deletions(-) diff --git a/composables/type-fetch/anke-to/openapi.ts b/composables/type-fetch/anke-to/openapi.ts index 6bbbbb5..8bf80bc 100644 --- a/composables/type-fetch/anke-to/openapi.ts +++ b/composables/type-fetch/anke-to/openapi.ts @@ -75,17 +75,22 @@ export interface components { * @enum {string} */ ResShareType: "admins" | "respondents" | "anyone"; - NewQuestionnaire: components["schemas"]["QuestionnaireTitle"] & components["schemas"]["QuestionnaireDescription"] & components["schemas"]["QuestionnaireResponseDueDateTime"] & components["schemas"]["QuestionnaireResponseViewableBy"] & components["schemas"]["QuestionnaireIsAnonymous"] & components["schemas"]["QuestionnaireIsAllowingMultipleResponses"] & components["schemas"]["QuestionnaireIsPublished"] & components["schemas"]["QuestionnaireTargetsAndAdmins"] & { + QuestionnaireBase: components["schemas"]["QuestionnaireTitle"] & components["schemas"]["QuestionnaireDescription"] & components["schemas"]["QuestionnaireResponseDueDateTime"] & components["schemas"]["QuestionnaireResponseViewableBy"] & components["schemas"]["QuestionnaireIsAnonymous"] & components["schemas"]["QuestionnaireIsAllowingMultipleResponses"] & components["schemas"]["QuestionnaireIsPublished"] & components["schemas"]["QuestionnaireTargetsAndAdmins"]; + NewQuestionnaire: components["schemas"]["QuestionnaireBase"] & { questions: components["schemas"]["NewQuestion"][]; }; - QuestionnaireDetail: components["schemas"]["QuestionnaireID"] & components["schemas"]["NewQuestionnaire"] & components["schemas"]["QuestionnaireRespondents"] & components["schemas"]["QuestionnaireCreatedAt"] & components["schemas"]["QuestionnaireModifiedAt"]; + QuestionnaireDetail: components["schemas"]["QuestionnaireID"] & components["schemas"]["QuestionnaireBase"] & components["schemas"]["QuestionnaireCreatedAt"] & components["schemas"]["QuestionnaireModifiedAt"] & { + questions: components["schemas"]["Question"][]; + /** @description 回答者の一覧。匿名回答の場合はnull。 */ + respondents: components["schemas"]["Users"]; + }; QuestionnaireSummary: components["schemas"]["QuestionnaireID"] & components["schemas"]["QuestionnaireTitle"] & components["schemas"]["QuestionnaireDescription"] & components["schemas"]["QuestionnaireResponseDueDateTime"] & components["schemas"]["QuestionnaireResponseViewableBy"] & components["schemas"]["QuestionnaireIsAnonymous"] & components["schemas"]["QuestionnaireIsAllowingMultipleResponses"] & components["schemas"]["QuestionnaireIsPublished"] & components["schemas"]["QuestionnaireIsTargetingMe"] & components["schemas"]["QuestionnaireCreatedAt"] & components["schemas"]["QuestionnaireModifiedAt"] & { /** @description 下書きが存在する */ has_my_draft: boolean; /** @description 回答が存在する */ has_my_response: boolean; /** Format: date-time */ - responded_date_time_by_me: string; + responded_date_time_by_me?: string; /** * @description すべての対象者が回答済みの場合 true を返す。それ以外は false を返す。 (対象者が存在しない場合は true を返す) * @@ -176,9 +181,6 @@ export interface components { targets: components["schemas"]["UsersAndGroups"]; admins: components["schemas"]["UsersAndGroups"]; }; - QuestionnaireRespondents: { - respondents: components["schemas"]["Users"]; - }; QuestionnaireHasMyResponse: { /** @description 回答済みあるいは下書きが存在する */ has_response: boolean; @@ -197,7 +199,6 @@ export interface components { */ created_at: string; }; - Questions: components["schemas"]["Question"][]; QuestionBase: { /** @example 1 */ questionnaire_id: number; @@ -295,44 +296,20 @@ export interface components { ResponseBodyBaseInteger: { answer: number; }; - Result: { - /** @example 1 */ - questionnaire_id: number; - /** @example 1 */ - response_count: number; - body: components["schemas"]["ResultBody"][]; - }; - ResultBody: components["schemas"]["ResultBodyText"] | components["schemas"]["ResultBodyTextLong"] | components["schemas"]["ResultBodyNumber"] | components["schemas"]["ResultBodySingleChoice"] | components["schemas"]["ResultBodyMultipleChoice"] | components["schemas"]["ResultBodyScale"]; - /** @description 回答文ごとの回答数の配列 */ - ResultBodyText: components["schemas"]["QuestionTypeText"] & components["schemas"]["ResultBodyBaseStringAnswer"]; - /** @description 回答文ごとの回答数の配列 */ - ResultBodyTextLong: components["schemas"]["QuestionTypeTextLong"] & components["schemas"]["ResultBodyBaseStringAnswer"]; - /** @description 数値ごとの回答数の配列 */ - ResultBodyNumber: components["schemas"]["QuestionTypeNumber"] & components["schemas"]["ResultBodyBaseNumberAnswer"]; - /** @description 選択肢ごとの回答数の配列 */ - ResultBodySingleChoice: components["schemas"]["QuestionTypeSingleChoice"] & components["schemas"]["ResultBodyBaseIntegerAnswer"]; - /** @description 選択肢ごとの回答数の配列 */ - ResultBodyMultipleChoice: components["schemas"]["QuestionTypeMultipleChoice"] & components["schemas"]["ResultBodyBaseIntegerAnswer"]; - /** @description 数値ごとの回答数の配列 */ - ResultBodyScale: components["schemas"]["QuestionTypeScale"] & components["schemas"]["ResultBodyBaseIntegerAnswer"]; - ResultBodyBaseStringAnswer: { - aggregated_answers: { - answer: string; - answer_count: number; - }[]; - }; - ResultBodyBaseNumberAnswer: { - aggregated_answers: { - answer: number; - answer_count: number; - }[]; - }; - ResultBodyBaseIntegerAnswer: { - aggregated_answers: { - answer: number; - answer_count: number; - }[]; - }; + Result: (components["schemas"]["QuestionnaireID"] & { + /** @example 1 */ + response_id: number; + /** + * Format: date-time + * @example "2019-12-31T15:00:00.000Z" + */ + submitted_at: string; + /** + * Format: date-time + * @example "2019-12-31T15:00:00.000Z" + */ + modified_at: string; + } & components["schemas"]["NewResponse"])[]; UsersAndGroups: { users: components["schemas"]["Users"]; groups: components["schemas"]["Groups"]; From 1f5a22288a48c4f25d4cb2cd07577aacdb19a822 Mon Sep 17 00:00:00 2001 From: rei Date: Thu, 2 May 2024 17:29:24 +0900 Subject: [PATCH 6/6] in progress --- ...-settings.ts => response-page-settings.ts} | 0 .../{response-form.vue => response-page.vue} | 0 .../[questionnaireID]/index.vue | 14 +- .../[questionnaireID]/result.vue | 138 ++++++++++-------- pages/responses/[responseID]/index.vue | 2 +- 5 files changed, 92 insertions(+), 62 deletions(-) rename components/response-form/{response-form-settings.ts => response-page-settings.ts} (100%) rename components/response-form/{response-form.vue => response-page.vue} (100%) diff --git a/components/response-form/response-form-settings.ts b/components/response-form/response-page-settings.ts similarity index 100% rename from components/response-form/response-form-settings.ts rename to components/response-form/response-page-settings.ts diff --git a/components/response-form/response-form.vue b/components/response-form/response-page.vue similarity index 100% rename from components/response-form/response-form.vue rename to components/response-form/response-page.vue diff --git a/pages/questionnaires/[questionnaireID]/index.vue b/pages/questionnaires/[questionnaireID]/index.vue index e9c0225..573d859 100644 --- a/pages/questionnaires/[questionnaireID]/index.vue +++ b/pages/questionnaires/[questionnaireID]/index.vue @@ -25,6 +25,8 @@ const questionnaireDetail: QuestionnaireDetail = { description: '質問1の説明', question_type: 'Text', is_required: true, + created_at: '2021-09-01T00:00:00+09:00', + question_id: 1, }, { questionnaire_id: 1, @@ -32,6 +34,8 @@ const questionnaireDetail: QuestionnaireDetail = { description: '質問2の説明', question_type: 'TextLong', is_required: true, + created_at: '2021-09-01T00:00:00+09:00', + question_id: 2, }, { questionnaire_id: 1, @@ -39,6 +43,8 @@ const questionnaireDetail: QuestionnaireDetail = { description: '質問3の説明', question_type: 'Number', is_required: true, + created_at: '2021-09-01T00:00:00+09:00', + question_id: 3, }, { questionnaire_id: 1, @@ -47,6 +53,8 @@ const questionnaireDetail: QuestionnaireDetail = { question_type: 'SingleChoice', is_required: true, options: ['選択肢1', '選択肢2', '選択肢3'], + created_at: '2021-09-01T00:00:00+09:00', + question_id: 4, }, { questionnaire_id: 1, @@ -55,6 +63,8 @@ const questionnaireDetail: QuestionnaireDetail = { question_type: 'MultipleChoice', is_required: true, options: ['選択肢1', '選択肢2', '選択肢3'], + created_at: '2021-09-01T00:00:00+09:00', + question_id: 5, }, { questionnaire_id: 1, @@ -63,9 +73,9 @@ const questionnaireDetail: QuestionnaireDetail = { question_type: 'Scale', is_required: true, min_value: 1, - min_label: '最小値', max_value: 5, - max_label: '最大値', + created_at: '2021-09-01T00:00:00+09:00', + question_id: 6, }, ], respondents: ['cp20'], diff --git a/pages/questionnaires/[questionnaireID]/result.vue b/pages/questionnaires/[questionnaireID]/result.vue index 65f891a..b01e282 100644 --- a/pages/questionnaires/[questionnaireID]/result.vue +++ b/pages/questionnaires/[questionnaireID]/result.vue @@ -23,6 +23,8 @@ const questionnaireDetail: QuestionnaireDetail = { description: '質問1の説明', question_type: 'Text', is_required: true, + created_at: '2021-09-01T00:00:00+09:00', + question_id: 1, }, { questionnaire_id: 1, @@ -30,6 +32,8 @@ const questionnaireDetail: QuestionnaireDetail = { description: '質問2の説明', question_type: 'TextLong', is_required: true, + created_at: '2021-09-01T00:00:00+09:00', + question_id: 2, }, { questionnaire_id: 1, @@ -37,6 +41,8 @@ const questionnaireDetail: QuestionnaireDetail = { description: '質問3の説明', question_type: 'Number', is_required: true, + created_at: '2021-09-01T00:00:00+09:00', + question_id: 3, }, { questionnaire_id: 1, @@ -45,6 +51,8 @@ const questionnaireDetail: QuestionnaireDetail = { question_type: 'SingleChoice', is_required: true, options: ['選択肢1', '選択肢2', '選択肢3'], + created_at: '2021-09-01T00:00:00+09:00', + question_id: 4, }, { questionnaire_id: 1, @@ -53,6 +61,8 @@ const questionnaireDetail: QuestionnaireDetail = { question_type: 'MultipleChoice', is_required: true, options: ['選択肢1', '選択肢2', '選択肢3'], + created_at: '2021-09-01T00:00:00+09:00', + question_id: 5, }, { questionnaire_id: 1, @@ -62,71 +72,81 @@ const questionnaireDetail: QuestionnaireDetail = { is_required: true, min_value: 1, max_value: 5, + created_at: '2021-09-01T00:00:00+09:00', + question_id: 6, }, ], respondents: ['cp20'], response_due_date_time: '2021-09-01T00:00:00+09:00', response_viewable_by: 'anyone', }; -const questionnaireResult: QuestionnaireResult = { - response_count: 1, - questionnaire_id: 1, - body: [ - { - question_type: 'Text', - aggregated_answers: [ - { answer: 'こっちは結構短めでもいいかも', answer_count: 1 }, - { answer: 'テスト回答テスト回答テスト回答テスト回答', answer_count: 1 }, - ], - }, - { - question_type: 'TextLong', - aggregated_answers: [ - { - answer: - 'けっこう長めの回答をする場合を考慮した方がいいんじゃないかな~けっこう長めの回答をする場合を考慮した方がいいんじゃないかな~けっこう長めの回答をする場合を考慮した方がいいんじゃないかな~', - answer_count: 1, - }, - { - answer: - '改行のテスト\n改行のテスト\n改行のテスト\n改行のテスト\n改行のテスト\n改行のテスト\n改行のテスト\n改行のテスト\n改行のテスト\n改行のテスト\n改行のテスト\n改行のテスト\n改行のテスト', - answer_count: 1, - }, - ], - }, - { - question_type: 'Number', - aggregated_answers: [ - { answer: 100, answer_count: 1 }, - { answer: 50, answer_count: 1 }, - ], - }, - { - question_type: 'SingleChoice', - aggregated_answers: [ - { answer: 0, answer_count: 1 }, - { answer: 1, answer_count: 1 }, - ], - }, - { - question_type: 'MultipleChoice', - aggregated_answers: [ - { answer: 0, answer_count: 1 }, - { answer: 1, answer_count: 1 }, - { answer: 2, answer_count: 2 }, - ], - }, - { - question_type: 'Scale', - aggregated_answers: [ - { - answer: 3, - answer_count: 2, - }, - ], - }, - ], -}; +const questionnaireResult: QuestionnaireResult = [ + { + questionnaire_id: 1, + response_id: 1, + submitted_at: '2023-12-15T00:00:00+09:00', + modified_at: '2023-12-15T00:00:00+09:00', + is_draft: false, + body: [ + { + question_type: 'Text', + aggregated_answers: [ + { answer: 'こっちは結構短めでもいいかも', answer_count: 1 }, + { + answer: 'テスト回答テスト回答テスト回答テスト回答', + answer_count: 1, + }, + ], + }, + { + question_type: 'TextLong', + aggregated_answers: [ + { + answer: + 'けっこう長めの回答をする場合を考慮した方がいいんじゃないかな~けっこう長めの回答をする場合を考慮した方がいいんじゃないかな~けっこう長めの回答をする場合を考慮した方がいいんじゃないかな~', + answer_count: 1, + }, + { + answer: + '改行のテスト\n改行のテスト\n改行のテスト\n改行のテスト\n改行のテスト\n改行のテスト\n改行のテスト\n改行のテスト\n改行のテスト\n改行のテスト\n改行のテスト\n改行のテスト\n改行のテスト', + answer_count: 1, + }, + ], + }, + { + question_type: 'Number', + aggregated_answers: [ + { answer: 100, answer_count: 1 }, + { answer: 50, answer_count: 1 }, + ], + }, + { + question_type: 'SingleChoice', + aggregated_answers: [ + { answer: 0, answer_count: 1 }, + { answer: 1, answer_count: 1 }, + ], + }, + { + question_type: 'MultipleChoice', + aggregated_answers: [ + { answer: 0, answer_count: 1 }, + { answer: 1, answer_count: 1 }, + { answer: 2, answer_count: 2 }, + ], + }, + { + question_type: 'Scale', + aggregated_answers: [ + { + answer: 3, + answer_count: 2, + }, + ], + }, + ], + }, +]; const questionnaireResponses: QuestionnaireResponses = [ { diff --git a/pages/responses/[responseID]/index.vue b/pages/responses/[responseID]/index.vue index d02b35e..63ac853 100644 --- a/pages/responses/[responseID]/index.vue +++ b/pages/responses/[responseID]/index.vue @@ -65,7 +65,7 @@ const formSettings: ResponseFormQuestionnaireFormSettings = {