Skip to content
Extraits de code Groupes Projets
Valider e18b0736 rédigé par Delphine van Rossum's avatar Delphine van Rossum Validation de Brieuc Dubois
Parcourir les fichiers

session duration replaced by number of sessions

parent 195e1f7f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!38New studies & tests logic
...@@ -346,6 +346,7 @@ ...@@ -346,6 +346,7 @@
"startDate": "Date de début", "startDate": "Date de début",
"endDate": "Date de fin", "endDate": "Date de fin",
"chatDuration": "Durée des sessions (en minutes)", "chatDuration": "Durée des sessions (en minutes)",
"nbSession": "Nombre de sessions",
"updated": "Étude mise à jour avec succès", "updated": "Étude mise à jour avec succès",
"noChanges": "Aucune modification", "noChanges": "Aucune modification",
"updateError": "Erreur lors de la mise à jour de l'étude", "updateError": "Erreur lors de la mise à jour de l'étude",
......
...@@ -26,7 +26,7 @@ export async function createStudyAPI( ...@@ -26,7 +26,7 @@ export async function createStudyAPI(
description: string, description: string,
startDate: Date, startDate: Date,
endDate: Date, endDate: Date,
chatDuration: number, nbSession: number,
tests: { type: string; id?: number }[], tests: { type: string; id?: number }[],
consentParticipation: string, consentParticipation: string,
consentPrivacy: string, consentPrivacy: string,
...@@ -41,7 +41,7 @@ export async function createStudyAPI( ...@@ -41,7 +41,7 @@ export async function createStudyAPI(
description, description,
start_date: formatToUTCDate(startDate), start_date: formatToUTCDate(startDate),
end_date: formatToUTCDate(endDate), end_date: formatToUTCDate(endDate),
chat_duration: chatDuration, nb_session: nbSession,
tests, tests,
consent_participation: consentParticipation, consent_participation: consentParticipation,
consent_privacy: consentPrivacy, consent_privacy: consentPrivacy,
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
let description = study ? study.description : ''; let description = study ? study.description : '';
let startDate = study ? study.startDate : new Date(); let startDate = study ? study.startDate : new Date();
let endDate = study ? study.endDate : new Date(); let endDate = study ? study.endDate : new Date();
let chatDuration = study ? study.chatDuration : 30; let nbSession = study ? study.nbSession : 8;
let tests = study ? [...study.tests] : []; let tests = study ? [...study.tests] : [];
let consentParticipation = study ? study.consentParticipation : ''; let consentParticipation = study ? study.consentParticipation : '';
let consentPrivacy = study ? study.consentPrivacy : ''; let consentPrivacy = study ? study.consentPrivacy : '';
...@@ -106,14 +106,14 @@ ...@@ -106,14 +106,14 @@
<DateInput class="input w-full" id="endDate" name="endDate" date={endDate} required /> <DateInput class="input w-full" id="endDate" name="endDate" date={endDate} required />
<!-- Chat Duration --> <!-- Chat Duration -->
<label class="label" for="chatDuration">{$t('studies.chatDuration')} *</label> <label class="label" for="nbSession">{$t('studies.nbSession')} *</label>
<input <input
class="input w-full" class="input w-full"
type="number" type="number"
id="chatDuration" id="nbSession"
name="chatDuration" name="nbSession"
min="0" min="0"
bind:value={chatDuration} bind:value={nbSession}
required required
/> />
......
...@@ -18,7 +18,7 @@ export default class Study { ...@@ -18,7 +18,7 @@ export default class Study {
private _description: string; private _description: string;
private _startDate: Date; private _startDate: Date;
private _endDate: Date; private _endDate: Date;
private _chatDuration: number; private _nbSession: number = $state(0);
private _users: User[]; private _users: User[];
private _consentParticipation: string; private _consentParticipation: string;
private _consentPrivacy: string; private _consentPrivacy: string;
...@@ -32,7 +32,7 @@ export default class Study { ...@@ -32,7 +32,7 @@ export default class Study {
description: string, description: string,
startDate: Date, startDate: Date,
endDate: Date, endDate: Date,
chatDuration: number, nbSession: number,
users: User[], users: User[],
consentParticipation: string, consentParticipation: string,
consentPrivacy: string, consentPrivacy: string,
...@@ -45,7 +45,7 @@ export default class Study { ...@@ -45,7 +45,7 @@ export default class Study {
this._description = description; this._description = description;
this._startDate = startDate; this._startDate = startDate;
this._endDate = endDate; this._endDate = endDate;
this._chatDuration = chatDuration; this._nbSession = nbSession;
this._users = users; this._users = users;
this._consentParticipation = consentParticipation; this._consentParticipation = consentParticipation;
this._consentPrivacy = consentPrivacy; this._consentPrivacy = consentPrivacy;
...@@ -90,12 +90,12 @@ export default class Study { ...@@ -90,12 +90,12 @@ export default class Study {
this._endDate = value; this._endDate = value;
} }
get chatDuration(): number { get nbSession(): number {
return this._chatDuration; return this._nbSession;
} }
set chatDuration(value: number) { set nbSession(value: number) {
this._chatDuration = value; this._nbSession = value;
} }
get users(): User[] { get users(): User[] {
...@@ -155,7 +155,7 @@ export default class Study { ...@@ -155,7 +155,7 @@ export default class Study {
description: string, description: string,
startDate: Date, startDate: Date,
endDate: Date, endDate: Date,
chatDuration: number, nbSession: number,
consentParticipation: string, consentParticipation: string,
consentPrivacy: string, consentPrivacy: string,
consentRights: string, consentRights: string,
...@@ -163,19 +163,7 @@ export default class Study { ...@@ -163,19 +163,7 @@ export default class Study {
tests: (SurveyTypingSvelte | Survey)[], tests: (SurveyTypingSvelte | Survey)[],
f: fetchType = fetch f: fetchType = fetch
): Promise<Study | null> { ): Promise<Study | null> {
const id = await createStudyAPI( const id = await createStudyAPI(f, title, description, startDate, endDate, nbSession, []);
f,
title,
description,
startDate,
endDate,
chatDuration,
[],
consentParticipation,
consentPrivacy,
consentRights,
consentStudyData
);
if (id) { if (id) {
return new Study( return new Study(
...@@ -184,7 +172,7 @@ export default class Study { ...@@ -184,7 +172,7 @@ export default class Study {
description, description,
startDate, startDate,
endDate, endDate,
chatDuration, nbSession,
[], [],
consentParticipation, consentParticipation,
consentPrivacy, consentPrivacy,
...@@ -207,7 +195,7 @@ export default class Study { ...@@ -207,7 +195,7 @@ export default class Study {
if (data.description) this._description = data.description; if (data.description) this._description = data.description;
if (data.start_date) this._startDate = parseToLocalDate(data.start_date); if (data.start_date) this._startDate = parseToLocalDate(data.start_date);
if (data.end_date) this._endDate = parseToLocalDate(data.end_date); if (data.end_date) this._endDate = parseToLocalDate(data.end_date);
if (data.chat_duration) this._chatDuration = data.chat_duration; if (data.chat_duration) this._nbSession = data.chat_duration;
if (data.consent_participation) this._consentParticipation = data.consent_participation; if (data.consent_participation) this._consentParticipation = data.consent_participation;
if (data.consent_privacy) this._consentPrivacy = data.consent_privacy; if (data.consent_privacy) this._consentPrivacy = data.consent_privacy;
if (data.consent_rights) this._consentRights = data.consent_rights; if (data.consent_rights) this._consentRights = data.consent_rights;
......
...@@ -9,7 +9,7 @@ export const actions: Actions = { ...@@ -9,7 +9,7 @@ export const actions: Actions = {
let description = formData.get('description')?.toString(); let description = formData.get('description')?.toString();
const startDateStr = formData.get('startDate')?.toString(); const startDateStr = formData.get('startDate')?.toString();
const endDateStr = formData.get('endDate')?.toString(); const endDateStr = formData.get('endDate')?.toString();
const chatDurationStr = formData.get('chatDuration')?.toString(); const nbSessionStr = formData.get('nbSession')?.toString();
const consentParticipation = formData.get('consentParticipation')?.toString(); const consentParticipation = formData.get('consentParticipation')?.toString();
const consentPrivacy = formData.get('consentPrivacy')?.toString(); const consentPrivacy = formData.get('consentPrivacy')?.toString();
...@@ -20,7 +20,7 @@ export const actions: Actions = { ...@@ -20,7 +20,7 @@ export const actions: Actions = {
!title || !title ||
!startDateStr || !startDateStr ||
!endDateStr || !endDateStr ||
!chatDurationStr || !nbSessionStr ||
!consentParticipation || !consentParticipation ||
!consentPrivacy || !consentPrivacy ||
!consentRights || !consentRights ||
...@@ -44,8 +44,8 @@ export const actions: Actions = { ...@@ -44,8 +44,8 @@ export const actions: Actions = {
}; };
} }
const chatDuration = parseInt(chatDurationStr, 10); const nbSession = parseInt(nbSessionStr, 10);
if (isNaN(chatDuration)) { if (isNaN(nbSession)) {
return { return {
message: 'Invalid request 3' message: 'Invalid request 3'
}; };
...@@ -74,7 +74,7 @@ export const actions: Actions = { ...@@ -74,7 +74,7 @@ export const actions: Actions = {
description, description,
startDate, startDate,
endDate, endDate,
chatDuration, nbSession,
tests, tests,
consentParticipation, consentParticipation,
consentPrivacy, consentPrivacy,
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter