Skip to content

Commit

Permalink
Merge branch 'dev' into feature/M2-7458-paragraph-item-styling
Browse files Browse the repository at this point in the history
  • Loading branch information
ramirlm authored Sep 10, 2024
2 parents cff9dc0 + bdef48c commit d1a1383
Show file tree
Hide file tree
Showing 113 changed files with 5,405 additions and 557 deletions.
37 changes: 28 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,22 @@ jobs:
~/node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}

- run: yarn install --frozen-lockfile
- name: Remove .yarnrc file to avoid conflicts
run: rm -rf .yarnrc

- name: Enable Corepack
run: corepack enable

- name: Prepare and activate Yarn version 1.22.22
run: corepack prepare [email protected] --activate

- name: Verify Yarn version
run: yarn --version

- name: Install dependencies with frozen lockfile
run: yarn install --frozen-lockfile

- uses: wearerequired/lint-action@v2
with:
eslint: true
eslint_extensions: mjs,js,jsx,mts,ts,tsx
prettier: true
prettier_extensions: mjs,js,jsx,mts,ts,tsx
continue_on_error: false
- run: yarn eslint src
tests:
runs-on: ubuntu-latest
steps:
Expand All @@ -39,7 +46,19 @@ jobs:
with:
node-version: ${{ env.NODE_VERSION }}

- name: Install deps
- name: Remove .yarnrc file to avoid conflicts
run: rm -rf .yarnrc

- name: Enable Corepack
run: corepack enable

- name: Prepare and activate Yarn version 1.22.22
run: corepack prepare [email protected] --activate

- name: Verify Yarn version
run: yarn --version

- name: Install dependencies with frozen lockfile
run: yarn install --frozen-lockfile

- uses: actions/cache@v4
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ coverage
.env
.env*
!.env.example


.yarn
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,6 @@
"vite-plugin-node-stdlib-browser": "^0.2.1",
"vitest": "^1.2.0",
"vitest-canvas-mock": "^0.3.3"
}
},
"packageManager": "[email protected]+sha256.c17d3797fb9a9115bf375e31bfd30058cac6bc9c3b8807a3d8cb2094794b51ca"
}
51 changes: 20 additions & 31 deletions src/abstract/lib/GroupBuilder/ActivityGroupsBuilder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const getActivity = (): Entity => {
order: 0,
type: ActivityType.NotDefined,
image: null,
autoAssign: true,
};
return result;
};
Expand Down Expand Up @@ -98,6 +99,7 @@ const getExpectedItem = (): ActivityListItem => {
timeLeftToComplete: null,
isInActivityFlow: false,
image: null,
targetSubject: null,
};
return expectedItem;
};
Expand Down Expand Up @@ -152,6 +154,7 @@ const getScheduledEventEntity = (settings: {
timer: null,
},
},
targetSubject: null,
};
return result;
};
Expand All @@ -175,6 +178,7 @@ const getAlwaysAvailableEventEntity = (settings: { scheduledAt: Date }): EventEn
timer: null,
},
},
targetSubject: null,
};

return result;
Expand Down Expand Up @@ -903,8 +907,6 @@ describe('ActivityGroupsBuilder', () => {
progress,
};

let builder = createActivityGroupsBuilder(input);

const eventEntity: EventEntity = getScheduledEventEntity({
scheduledAt,
startDate: subDays(startOfDay(scheduledAt), 2),
Expand All @@ -929,7 +931,7 @@ describe('ActivityGroupsBuilder', () => {
progress,
};

builder = createActivityGroupsBuilder(input);
const builder = createActivityGroupsBuilder(input);

const now = addMinutes(scheduledAt, 10);

Expand All @@ -939,18 +941,9 @@ describe('ActivityGroupsBuilder', () => {
expect(result).toEqual(expectedResult);
});

it('5Should not return group-item for scheduled event and periodicity is Weekly and allowAccessBeforeFromTime is false when started yesterday, but not completed yet', () => {
it('Should not return group-item for scheduled event and periodicity is Weekly and allowAccessBeforeFromTime is false when started yesterday, but not completed yet', () => {
const scheduledAt = new Date(2023, 8, 1, 15, 0, 0);

let progress: GroupProgressState = getEmptyProgress();

let input: GroupsBuildContext = {
allAppletActivities: [],
progress,
};

let builder = createActivityGroupsBuilder(input);

const eventEntity: EventEntity = getScheduledEventEntity({
scheduledAt,
startDate: subDays(startOfDay(scheduledAt), 2),
Expand All @@ -968,14 +961,14 @@ describe('ActivityGroupsBuilder', () => {
activities: [],
};

progress = getProgress(subDays(scheduledAt, 1), null);
const progress = getProgress(subDays(scheduledAt, 1), null);

input = {
const input = {
allAppletActivities: [],
progress,
};

builder = createActivityGroupsBuilder(input);
const builder = createActivityGroupsBuilder(input);

const now = addMinutes(scheduledAt, 10);

Expand Down Expand Up @@ -1108,8 +1101,6 @@ describe('ActivityGroupsBuilder', () => {
eventEntity.event.availability.startDate = subMonths(now, 3);
eventEntity.event.availability.endDate = subMonths(now, 2);

let result = builder.buildAvailable([eventEntity]);

const expectedItem = getExpectedAvailableItem();
expectedItem.availableTo = new Date(startOfDay(scheduledAt));
expectedItem.availableTo.setHours(16);
Expand All @@ -1121,7 +1112,7 @@ describe('ActivityGroupsBuilder', () => {
activities: [],
};

result = builder.buildAvailable([eventEntity]);
const result = builder.buildAvailable([eventEntity]);
expect(result).toEqual(expectedEmptyResult);
});

Expand Down Expand Up @@ -1154,8 +1145,6 @@ describe('ActivityGroupsBuilder', () => {
eventEntity.event.availability.startDate = subMonths(now, 2);
eventEntity.event.availability.endDate = addMonths(now, 2);

let result = builder.buildAvailable([eventEntity]);

const expectedItem = getExpectedAvailableItem();
expectedItem.availableTo = new Date(startOfDay(scheduledAt));
expectedItem.availableTo.setHours(16);
Expand All @@ -1170,7 +1159,7 @@ describe('ActivityGroupsBuilder', () => {
activities: [expectedItem],
};

result = builder.buildAvailable([eventEntity]);
const result = builder.buildAvailable([eventEntity]);

expect(result).toEqual(expectedResult);
});
Expand Down Expand Up @@ -1375,8 +1364,6 @@ describe('ActivityGroupsBuilder', () => {
eventEntity.event.availability.startDate = addMonths(now, 2);
eventEntity.event.availability.endDate = addMonths(now, 3);

let result = builder.buildScheduled([eventEntity]);

const expectedItem: ActivityListItem = getExpectedScheduledItem();
expectedItem.availableFrom = startOfDay(scheduledAt);
expectedItem.availableFrom.setHours(15);
Expand All @@ -1390,7 +1377,7 @@ describe('ActivityGroupsBuilder', () => {
activities: [expectedItem],
};

result = builder.buildScheduled([eventEntity]);
const result = builder.buildScheduled([eventEntity]);

expect(result).toEqual(expectedEmptyResult);
});
Expand Down Expand Up @@ -1424,8 +1411,6 @@ describe('ActivityGroupsBuilder', () => {
eventEntity.event.availability.startDate = subMonths(now, 3);
eventEntity.event.availability.endDate = subMonths(now, 2);

let result = builder.buildScheduled([eventEntity]);

const expectedItem: ActivityListItem = getExpectedScheduledItem();
expectedItem.availableFrom = startOfDay(scheduledAt);
expectedItem.availableFrom.setHours(15);
Expand All @@ -1439,7 +1424,7 @@ describe('ActivityGroupsBuilder', () => {
activities: [expectedItem],
};

result = builder.buildScheduled([eventEntity]);
const result = builder.buildScheduled([eventEntity]);

expect(result).toEqual(expectedEmptyResult);
});
Expand Down Expand Up @@ -1471,8 +1456,6 @@ describe('ActivityGroupsBuilder', () => {
eventEntity.event.availability.timeFrom = { hours: 15, minutes: 0 };
eventEntity.event.availability.timeTo = { hours: 16, minutes: 30 };

let result = builder.buildScheduled([eventEntity]);

const expectedItem: ActivityListItem = getExpectedScheduledItem();
expectedItem.availableFrom = startOfDay(scheduledAt);
expectedItem.availableFrom.setHours(15);
Expand Down Expand Up @@ -1500,7 +1483,7 @@ describe('ActivityGroupsBuilder', () => {
eventEntity.event.availability.startDate = subMonths(now, 2);
eventEntity.event.availability.endDate = addMonths(now, 2);

result = builder.buildScheduled([eventEntity]);
const result = builder.buildScheduled([eventEntity]);
expect(result).toEqual(expectedResult);
});

Expand Down Expand Up @@ -1611,6 +1594,7 @@ describe('ActivityGroupsBuilder', () => {
type: ActivityType.NotDefined,
order: 0,
image: null,
autoAssign: true,
},
{
description: 'test-description-2',
Expand All @@ -1621,6 +1605,7 @@ describe('ActivityGroupsBuilder', () => {
type: ActivityType.NotDefined,
order: 1,
image: null,
autoAssign: true,
},
],
progress,
Expand All @@ -1638,6 +1623,7 @@ describe('ActivityGroupsBuilder', () => {
isHidden: false,
order: 0,
image: null,
autoAssign: true,
};

const eventEntity: EventEntity = {
Expand All @@ -1656,6 +1642,7 @@ describe('ActivityGroupsBuilder', () => {
timer: null,
},
},
targetSubject: null,
};

let result = builder.buildInProgress([eventEntity]);
Expand Down Expand Up @@ -1684,6 +1671,7 @@ describe('ActivityGroupsBuilder', () => {
numberOfActivitiesInFlow: 2,
activityPositionInFlow: 1,
},
targetSubject: null,
},
],
name: 'additional.in_progress',
Expand Down Expand Up @@ -1725,6 +1713,7 @@ describe('ActivityGroupsBuilder', () => {
numberOfActivitiesInFlow: 2,
activityPositionInFlow: 2,
},
targetSubject: null,
},
],
name: 'additional.in_progress',
Expand Down
24 changes: 12 additions & 12 deletions src/abstract/lib/GroupBuilder/ActivityGroupsBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ export class ActivityGroupsBuilder implements IActivityGroupsBuilder {
this.utility = new GroupUtility(inputParams);
}

public buildInProgress(eventsActivities: Array<EventEntity>): ActivityListGroup {
const filtered = eventsActivities.filter((x) => this.utility.isInProgress(x));
public buildInProgress(eventEntities: Array<EventEntity>): ActivityListGroup {
const filtered = eventEntities.filter((x) => this.utility.isInProgress(x));

const activityItems: Array<ActivityListItem> = [];

for (const eventActivity of filtered) {
const item = this.itemsFactory.createProgressItem(eventActivity);
for (const eventEntity of filtered) {
const item = this.itemsFactory.createProgressItem(eventEntity);

activityItems.push(item);
}
Expand All @@ -52,13 +52,13 @@ export class ActivityGroupsBuilder implements IActivityGroupsBuilder {
return result;
}

public buildAvailable(eventsEntities: Array<EventEntity>): ActivityListGroup {
const filtered = this.availableEvaluator.evaluate(eventsEntities);
public buildAvailable(eventEntities: Array<EventEntity>): ActivityListGroup {
const filtered = this.availableEvaluator.evaluate(eventEntities);

const activityItems: Array<ActivityListItem> = [];

for (const eventActivity of filtered) {
const item = this.itemsFactory.createAvailableItem(eventActivity);
for (const eventEntity of filtered) {
const item = this.itemsFactory.createAvailableItem(eventEntity);

activityItems.push(item);
}
Expand All @@ -72,13 +72,13 @@ export class ActivityGroupsBuilder implements IActivityGroupsBuilder {
return result;
}

public buildScheduled(eventsEntities: Array<EventEntity>): ActivityListGroup {
const filtered = this.scheduledEvaluator.evaluate(eventsEntities);
public buildScheduled(eventEntities: Array<EventEntity>): ActivityListGroup {
const filtered = this.scheduledEvaluator.evaluate(eventEntities);

const activityItems: Array<ActivityListItem> = [];

for (const eventActivity of filtered) {
const item = this.itemsFactory.createScheduledItem(eventActivity);
for (const eventEntity of filtered) {
const item = this.itemsFactory.createScheduledItem(eventEntity);

activityItems.push(item);
}
Expand Down
2 changes: 2 additions & 0 deletions src/abstract/lib/GroupBuilder/AvailableGroupBuilder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const getActivity = (): Entity => {
order: 0,
type: ActivityType.NotDefined,
image: null,
autoAssign: true,
};
return result;
};
Expand Down Expand Up @@ -104,6 +105,7 @@ const getScheduledEventEntity = (settings: {
timer: null,
},
},
targetSubject: null,
};

return result;
Expand Down
Loading

0 comments on commit d1a1383

Please sign in to comment.