diff --git a/src/electron/electron/ipc/IpcHandler.ts b/src/electron/electron/ipc/IpcHandler.ts index 525d3f03..9dfa1191 100644 --- a/src/electron/electron/ipc/IpcHandler.ts +++ b/src/electron/electron/ipc/IpcHandler.ts @@ -49,8 +49,18 @@ export class IpcHandler { }); } - private async createExperienceSample(promptedAt: number, question: string, response: number) { - await this.experienceSamplingService.createExperienceSample(promptedAt, question, response); + private async createExperienceSample( + promptedAt: number, + question: string, + response: number, + skipped: boolean = false + ) { + await this.experienceSamplingService.createExperienceSample( + promptedAt, + question, + response, + skipped + ); } private async closeExperienceSamplingWindow(): Promise { diff --git a/src/electron/electron/main/entities/ExperienceSamplingResponseEntity.ts b/src/electron/electron/main/entities/ExperienceSamplingResponseEntity.ts index 976cb41d..6ff1202a 100644 --- a/src/electron/electron/main/entities/ExperienceSamplingResponseEntity.ts +++ b/src/electron/electron/main/entities/ExperienceSamplingResponseEntity.ts @@ -9,6 +9,9 @@ export class ExperienceSamplingResponseEntity extends BaseTrackedEntity { @Column('text') question: string; - @Column('int') + @Column('int', { nullable: true }) response: number; + + @Column('boolean', { default: false, nullable: false }) + skipped: boolean; } diff --git a/src/electron/electron/main/services/ExperienceSamplingService.ts b/src/electron/electron/main/services/ExperienceSamplingService.ts index 327e6154..995cd00e 100644 --- a/src/electron/electron/main/services/ExperienceSamplingService.ts +++ b/src/electron/electron/main/services/ExperienceSamplingService.ts @@ -4,14 +4,20 @@ import { getLogger } from '../../shared/Logger'; const LOG = getLogger('ExperienceSamplingService'); export class ExperienceSamplingService { - public async createExperienceSample(promptedAt: number, question: string, response: number) { + public async createExperienceSample( + promptedAt: number, + question: string, + response: number, + skipped: boolean + ): Promise { LOG.debug( - `createExperienceSample: promptedAt=${promptedAt}, question=${question}, response=${response}` + `createExperienceSample: promptedAt=${promptedAt}, question=${question}, response=${response}, skipped=${skipped}` ); await ExperienceSamplingResponseEntity.save({ question, response, - promptedAt + promptedAt, + skipped }); } } diff --git a/src/electron/src/utils/Commands.ts b/src/electron/src/utils/Commands.ts index 8a6a58fe..972f3577 100644 --- a/src/electron/src/utils/Commands.ts +++ b/src/electron/src/utils/Commands.ts @@ -1,7 +1,12 @@ import { StudyInfoDto } from '../../shared/dto/StudyInfoDto'; type Commands = { - createExperienceSample: (promptedAt: number, question: string, response: number) => Promise; + createExperienceSample: ( + promptedAt: number, + question: string, + response?: number, + skipped?: boolean + ) => Promise; closeExperienceSamplingWindow: () => Promise; getStudyInfo: () => Promise; }; diff --git a/src/electron/src/views/ExperienceSamplingView.vue b/src/electron/src/views/ExperienceSamplingView.vue index 00279263..a87c6346 100644 --- a/src/electron/src/views/ExperienceSamplingView.vue +++ b/src/electron/src/views/ExperienceSamplingView.vue @@ -1,6 +1,7 @@