ソースを参照

Merge branch 'feat/questionnaire' into feat/110272-112702-show-questionnaire-ui

Futa Arai 3 年 前
コミット
14d51cd6da

+ 0 - 1
.devcontainer/Dockerfile

@@ -42,7 +42,6 @@ RUN apt-get update \
       google-chrome-stable \
       # for Cypress
       libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb fonts-noto-cjk \
-
    # Clean up
    && apt-get autoremove -y \
    && apt-get clean -y \

+ 2 - 1
packages/app/src/interfaces/questionnaire/growi-info.ts

@@ -35,7 +35,8 @@ interface IGrowiOSInfo {
 
 export interface IGrowiInfo {
   version: string
-  appSiteUrl: string // it may be hashed
+  appSiteUrl?: string
+  appSiteUrlHashed: string
   type: GrowiServiceType
   currentUsersCount: number
   currentActiveUsersCount: number

+ 4 - 3
packages/app/src/server/service/questionnaire-cron.ts

@@ -1,10 +1,11 @@
 import axiosRetry from 'axios-retry';
 
+import { IQuestionnaireOrder } from '~/interfaces/questionnaire/questionnaire-order';
 import loggerFactory from '~/utils/logger';
 import { getRandomIntInRange } from '~/utils/rand';
 import { sleep } from '~/utils/sleep';
 
-import QuestionnaireOrder, { QuestionnaireOrderDocument } from '../models/questionnaire/questionnaire-order';
+import QuestionnaireOrder from '../models/questionnaire/questionnaire-order';
 
 const logger = loggerFactory('growi:service:questionnaire-cron');
 
@@ -39,7 +40,7 @@ class QuestionnaireCronService {
 
   private questionnaireOrderGetCron(cronSchedule: string, maxSecondsUntilRequest: number) {
     const growiQuestionnaireServerOrigin = this.crowi.configManager?.getConfig('crowi', 'app:growiQuestionnaireServerOrigin');
-    const saveOrders = async(questionnaireOrders: QuestionnaireOrderDocument[]) => {
+    const saveOrders = async(questionnaireOrders: IQuestionnaireOrder[]) => {
       const currentDate = new Date(Date.now());
       // save questionnaires that are not finished (doesn't have to be started)
       const nonFinishedOrders = questionnaireOrders.filter(order => new Date(order.showUntil) > currentDate);
@@ -53,7 +54,7 @@ class QuestionnaireCronService {
 
       try {
         const response = await axios.get(`${growiQuestionnaireServerOrigin}/questionnaire-order/index`);
-        const questionnaireOrders: QuestionnaireOrderDocument[] = response.data.questionnaireOrders;
+        const questionnaireOrders: IQuestionnaireOrder[] = response.data.questionnaireOrders;
 
         await QuestionnaireOrder.deleteMany();
         await saveOrders(questionnaireOrders);

+ 8 - 8
packages/app/test/integration/service/questionnaire-cron.test.ts

@@ -32,7 +32,7 @@ describe('QuestionnaireCronService', () => {
           questions: [
             {
               type: 'points',
-              text: 'Growi は使いやすいですか?',
+              text: 'Is Growi easy to use?',
             },
           ],
           condition: {
@@ -56,7 +56,7 @@ describe('QuestionnaireCronService', () => {
           questions: [
             {
               type: 'points',
-              text: 'アンケート機能は支障なく動いていますか?',
+              text: 'Is this questionnaire functioning properly?',
             },
           ],
           condition: {
@@ -80,7 +80,7 @@ describe('QuestionnaireCronService', () => {
           questions: [
             {
               type: 'points',
-              text: 'これはいい質問ですか?',
+              text: 'Is this a good question?',
             },
           ],
           condition: {
@@ -119,7 +119,7 @@ describe('QuestionnaireCronService', () => {
         questions: [
           {
             type: 'points',
-            text: 'Growi は使いやすいですか?',
+            text: 'Is Growi easy to use?',
           },
         ],
         condition: {
@@ -140,7 +140,7 @@ describe('QuestionnaireCronService', () => {
         questions: [
           {
             type: 'points',
-            text: '最近どうですか?',
+            text: 'Is ver 2.0 better than 1.0?',
           },
         ],
         condition: {
@@ -161,7 +161,7 @@ describe('QuestionnaireCronService', () => {
         questions: [
           {
             type: 'points',
-            text: '最新のデザインはどうですか?',
+            text: 'How would you rate the latest design?',
           },
         ],
         condition: {
@@ -215,7 +215,7 @@ describe('QuestionnaireCronService', () => {
         questions: [
           {
             type: 'points',
-            text: 'Growi は使いやすいですか?',
+            text: 'Is Growi easy to use?',
           },
         ],
         condition: {
@@ -238,7 +238,7 @@ describe('QuestionnaireCronService', () => {
         questions: [
           {
             type: 'points',
-            text: 'アンケート機能は支障なく動いていますか?',
+            text: 'Is this questionnaire functioning properly?',
           },
         ],
         condition: {