Skip to content

Commit 4248d4f

Browse files
committed
fix end of study
1 parent 25ce790 commit 4248d4f

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/services/user/mock.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ export default class MockUser implements IUserService {
1414
recipient_certificate_pem_string: 'false',
1515
start_date: '2099-01-01T04:00:00.000Z',
1616
subjectId: id,
17-
personal_study_end_date: new Date(),
18-
general_study_end_date: new Date(),
17+
personal_study_end_date: '9999-12-31',
18+
general_study_end_date: '9999-12-31',
1919
status: 'on-study' as 'on-study',
2020
};
2121
}

src/services/user/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ export interface UserResponse {
1212
recipient_certificate_pem_string: string;
1313
start_date: UserDateTime;
1414
subjectId: string;
15-
personal_study_end_date: Date;
16-
general_study_end_date: Date;
15+
personal_study_end_date: string;
16+
general_study_end_date: string;
1717
status: 'on-study' | 'off-study';
1818
}
1919

src/stores/user.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ const storeBuilder = () => {
2929
store.set('questionnaireStartDate', response.start_date ? new Date(response.start_date) : null);
3030
store.set('questionnaireDueDate', response.due_date ? new Date(response.due_date) : null);
3131
store.set('instanceId', response.current_instance_id);
32-
store.set('personalEndDate', response.personal_study_end_date);
33-
store.set('generalEndDate', response.general_study_end_date);
32+
store.set('personalEndDate', new Date(response.personal_study_end_date));
33+
store.set('generalEndDate', new Date(response.general_study_end_date));
3434
store.set('isPopulated', true);
3535
store.set('status', response.status);
3636
}
@@ -48,7 +48,7 @@ const storeBuilder = () => {
4848
get isOnStudy() {
4949
const now = new Date();
5050
const { personalEndDate, generalEndDate, status } = this;
51-
return now >= personalEndDate || now >= generalEndDate || status === 'off-study';
51+
return (now <= personalEndDate || now <= generalEndDate) && status === 'on-study';
5252
}
5353

5454
get isFirstTimeUser() {

0 commit comments

Comments
 (0)