Skip to content
This repository has been archived by the owner on Feb 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3066 from ilios/dependabot/npm_and_yarn/ember-dat…
Browse files Browse the repository at this point in the history
…a-4.7.1

Bump ember-data from 4.3.0 to 4.7.1
  • Loading branch information
dartajax authored Oct 20, 2022
2 parents 2ae233c + 1480689 commit 4b0e2c4
Show file tree
Hide file tree
Showing 16 changed files with 367 additions and 276 deletions.
4 changes: 2 additions & 2 deletions addon/components/new-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import { dropTask } from 'ember-concurrency';
import { validatable, Length, NotBlank } from 'ilios-common/decorators/validation';
import { filterBy, findBy } from '../utils/array-helpers';
import { findBy } from '../utils/array-helpers';

@validatable
export default class NewSessionComponent extends Component {
Expand All @@ -14,7 +14,7 @@ export default class NewSessionComponent extends Component {
@tracked selectedSessionTypeId;

get activeSessionTypes() {
return filterBy(this.args.sessionTypes, 'active');
return this.args.sessionTypes.filter((sessionType) => sessionType.active);
}

get selectedSessionType() {
Expand Down
2 changes: 1 addition & 1 deletion addon/components/objective-list-item-terms.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
{{#if vocab.termCount}}
<DetailTermsList
@vocabulary={{vocab}}
@terms={{@subject.terms}}
@terms={{await @subject.terms}}
@canEdit={{false}}
@manage={{if @editable @manage (noop)}}
/>
Expand Down
35 changes: 0 additions & 35 deletions addon/components/objective-list-item-terms.js

This file was deleted.

3 changes: 1 addition & 2 deletions addon/components/print-course.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { dropTask } from 'ember-concurrency';
import sortableByPosition from 'ilios-common/utils/sortable-by-position';
import { filterBy } from '../utils/array-helpers';

export default class PrintCourseComponent extends Component {
@service store;
Expand Down Expand Up @@ -37,7 +36,7 @@ export default class PrintCourseComponent extends Component {
}

if (!this.args.includeUnpublishedSessions) {
return filterBy(this.sessionsRelationship, 'isPublishedOrScheduled');
return this.sessionsRelationship.filter((session) => session.isPublishedOrScheduled);
}

return this.sessionsRelationship.slice();
Expand Down
7 changes: 5 additions & 2 deletions addon/components/session-copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { dropTask, restartableTask, timeout } from 'ember-concurrency';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
import moment from 'moment';
import { filterBy, findById, sortBy } from '../utils/array-helpers';
import { findById, sortBy } from '../utils/array-helpers';

export default class SessionCopyComponent extends Component {
@service store;
Expand Down Expand Up @@ -54,7 +54,10 @@ export default class SessionCopyComponent extends Component {
if (!this.allCourses) {
return null;
}
return sortBy(filterBy(this.allCourses, 'year', this.bestSelectedYear), 'title');
return sortBy(
this.allCourses.filter((course) => course.year === this.bestSelectedYear),
'title'
);
}

get bestSelectedCourse() {
Expand Down
55 changes: 28 additions & 27 deletions addon/components/single-event.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import { isBlank, isEmpty } from '@ember/utils';
import moment from 'moment';
import { filterBy, findById } from '../utils/array-helpers';
import { findById } from '../utils/array-helpers';

export default class SingleEvent extends Component {
@service currentUser;
Expand Down Expand Up @@ -83,27 +83,29 @@ export default class SingleEvent extends Component {

get courseLearningMaterials() {
const eventLms = this.typedLearningMaterials;
return filterBy(eventLms, 'courseLearningMaterial').sort((lm1, lm2) => {
const pos1 = parseInt(lm1.position, 10) || 0;
const pos2 = parseInt(lm2.position, 10) || 0;
return eventLms
.filter((lm) => Boolean(lm.courseLearningMaterial))
.sort((lm1, lm2) => {
const pos1 = parseInt(lm1.position, 10) || 0;
const pos2 = parseInt(lm2.position, 10) || 0;

// 1. position, asc
if (pos1 > pos2) {
return 1;
} else if (pos1 < pos2) {
return -1;
}
// 1. position, asc
if (pos1 > pos2) {
return 1;
} else if (pos1 < pos2) {
return -1;
}

// 2. course learning material id, desc
const id1 = lm1.courseLearningMaterial;
const id2 = lm2.courseLearningMaterial;
if (id1 > id2) {
return -1;
} else if (id1 < id2) {
return 1;
}
return 0;
});
// 2. course learning material id, desc
const id1 = lm1.courseLearningMaterial;
const id2 = lm2.courseLearningMaterial;
if (id1 > id2) {
return -1;
} else if (id1 < id2) {
return 1;
}
return 0;
});
}

get sessionObjectives() {
Expand Down Expand Up @@ -139,9 +141,9 @@ export default class SingleEvent extends Component {

get sessionLearningMaterials() {
const eventLms = this.typedLearningMaterials;
return filterBy(eventLms, 'sessionLearningMaterial').sort(
this.sessionLearningMaterialSortingCalling
);
return eventLms
.filter((lm) => Boolean(lm.sessionLearningMaterial))
.sort(this.sessionLearningMaterialSortingCalling);
}

get preworkMaterials() {
Expand All @@ -154,10 +156,9 @@ export default class SingleEvent extends Component {
slug: ev.slug,
learningMaterials: [],
};
rhett.learningMaterials = filterBy(
this.getTypedLearningMaterialProxies(ev.learningMaterials),
'sessionLearningMaterial'
).sort(this.sessionLearningMaterialSortingCalling);
rhett.learningMaterials = this.getTypedLearningMaterialProxies(ev.learningMaterials)
.filter((lm) => Boolean(lm.sessionLearningMaterial))
.sort(this.sessionLearningMaterialSortingCalling);
return rhett;
});
}
Expand Down
4 changes: 2 additions & 2 deletions addon/components/visualizer-course-objectives.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { restartableTask, timeout } from 'ember-concurrency';
import { use } from 'ember-could-get-used-to-this';
import ResolveAsyncValue from 'ilios-common/classes/resolve-async-value';
import AsyncProcess from 'ilios-common/classes/async-process';
import { filterBy, mapBy, sortBy } from 'ilios-common/utils/array-helpers';
import { mapBy, sortBy } from 'ilios-common/utils/array-helpers';

export default class VisualizerCourseObjectives extends Component {
@service router;
Expand Down Expand Up @@ -61,7 +61,7 @@ export default class VisualizerCourseObjectives extends Component {
}

get objectiveWithoutMinutes() {
return filterBy(this.dataObjects, 'data', 0);
return this.dataObjects?.filter((obj) => obj.data === 0);
}

get isLoaded() {
Expand Down
12 changes: 6 additions & 6 deletions addon/components/week-glance-event.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import Component from '@glimmer/component';
import { filterBy } from '../utils/array-helpers';

export default class WeekGlanceEvent extends Component {
sortString(a, b) {
return a.localeCompare(b);
}
get sessionLearningMaterials() {
return filterBy(this.args.event.learningMaterials ?? [], 'sessionLearningMaterial');
return (
this.args.event.learningMaterials?.filter((lm) => Boolean(lm.sessionLearningMaterial)) ?? []
);
}

get preworkEvents() {
Expand All @@ -19,10 +20,9 @@ export default class WeekGlanceEvent extends Component {
slug: ev.slug,
learningMaterials: [],
};
rhett.learningMaterials = filterBy(
this.getTypedLearningMaterialProxies(ev.learningMaterials),
'sessionLearningMaterial'
).sort(this.sessionLearningMaterialSortingCalling);
rhett.learningMaterials = this.getTypedLearningMaterialProxies(ev.learningMaterials)
.filter((lm) => Boolean(lm.sessionLearningMaterial))
.sort(this.sessionLearningMaterialSortingCalling);
return rhett;
});
}
Expand Down
4 changes: 2 additions & 2 deletions addon/models/course.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import AsyncProcess from 'ilios-common/classes/async-process';
import ResolveFlatMapBy from 'ilios-common/classes/resolve-flat-map-by';
import { map } from 'rsvp';
import moment from 'moment';
import { filterBy, mapBy, sortBy, uniqueValues } from '../utils/array-helpers';
import { mapBy, sortBy, uniqueValues } from '../utils/array-helpers';

export default class Course extends Model {
@attr('string')
Expand Down Expand Up @@ -94,7 +94,7 @@ export default class Course extends Model {
terms;

get publishedSessions() {
return filterBy(this.sessions, 'isPublished');
return this.sessions.filter((session) => session.isPublished);
}

@use publishedSessionOfferings = new ResolveAsyncValue(() => [
Expand Down
6 changes: 4 additions & 2 deletions addon/models/learner-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import AsyncProcess from 'ilios-common/classes/async-process';
import DeprecatedAsyncCP from 'ilios-common/classes/deprecated-async-cp';
import DeprecatedResolveCP from 'ilios-common/classes/deprecated-resolve-cp';
import ResolveFlatMapBy from 'ilios-common/classes/resolve-flat-map-by';
import { filterBy, mapBy, uniqueValues } from '../utils/array-helpers';
import { mapBy, uniqueValues } from '../utils/array-helpers';

export default class LearnerGroup extends Model {
@attr('string')
Expand Down Expand Up @@ -292,7 +292,9 @@ export default class LearnerGroup extends Model {
return false;
}

const subGroupsInNeedOfAccomodation = filterBy(this.allDescendants, 'needsAccommodation');
const subGroupsInNeedOfAccomodation = this.allDescendants?.filter(
(group) => group.needsAccommodation
);

return subGroupsInNeedOfAccomodation?.length > 0;
}
Expand Down
5 changes: 2 additions & 3 deletions addon/services/current-user.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { get } from '@ember/object';
import Service, { inject as service } from '@ember/service';
import moment from 'moment';
import jwtDecode from '../utils/jwt-decode';
import { filterBy } from '../utils/array-helpers';

export default class CurrentUserService extends Service {
@service store;
Expand Down Expand Up @@ -203,7 +202,7 @@ export default class CurrentUserService extends Service {
const user = await this.getModel();

const courses = await user.get('allInstructedCourses');
const matches = filterBy(courses, 'id', course.id);
const matches = courses.filter((c) => c.id === course.id);

return matches.length > 0;
}
Expand All @@ -218,7 +217,7 @@ export default class CurrentUserService extends Service {
const user = await this.getModel();

const sessions = await user.get('allInstructedSessions');
const matches = filterBy(sessions, 'id', session.id);
const matches = sessions.filter((s) => s.id === session.id);

return matches.length > 0;
}
Expand Down
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ module.exports = {
],
},
},
'@embroider/macros': {
setConfig: {
'@ember-data/store': {
polyfillUUID: true,
},
},
},
},

included: function () {
Expand Down
Loading

0 comments on commit 4b0e2c4

Please sign in to comment.