@dev-crew-berlin/enter-js-utils 0.38.1 → 0.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -72,7 +72,7 @@ export class Attendee {
72
72
  getCheckinCountForTag(checkinTag) {
73
73
  const checkins = this.checkin[checkinTag];
74
74
  if (!checkins) return 0;
75
- return checkins.getAllCheckins().length;
75
+ return checkins.getActiveCheckins().length;
76
76
  }
77
77
  addCheckinForTag(args) {
78
78
  const exsitingCheckins = this.getCheckinsForTag(args.checkinTag);
@@ -3,7 +3,6 @@ export declare type CheckinJSON = components['schemas']['Checkin'];
3
3
  export declare class Checkin {
4
4
  id: string;
5
5
  time: Date;
6
- main: boolean;
7
6
  constructor(json: CheckinJSON);
8
7
  toJSON(): CheckinJSON;
9
8
  }
@@ -2,13 +2,12 @@ export class Checkin {
2
2
  constructor(json) {
3
3
  this.id = json.id;
4
4
  this.time = new Date(json.time);
5
- this.main = json.main;
6
5
  }
7
6
  toJSON() {
8
7
  return {
9
8
  id: this.id,
10
9
  time: this.time.toISOString(),
11
- main: this.main
10
+ main: false
12
11
  };
13
12
  }
14
13
  }
@@ -6,8 +6,6 @@ export declare class Checkins {
6
6
  deleted: string[];
7
7
  constructor(json?: CheckinsJSON);
8
8
  toJSON(): CheckinsJSON;
9
- getAllCheckins(): Checkin[];
10
- getOtherCheckins(): Checkin[];
11
- getMainCheckin(): Checkin | undefined;
9
+ getActiveCheckins(): Checkin[];
12
10
  merge(otherCheckin: Checkins): Checkins;
13
11
  }
@@ -1,4 +1,3 @@
1
- import { notUndefined } from '../lib';
2
1
  import { Checkin } from './checkin';
3
2
  export class Checkins {
4
3
  checkins = [];
@@ -15,16 +14,8 @@ export class Checkins {
15
14
  deleted: this.deleted
16
15
  };
17
16
  }
18
- getAllCheckins() {
19
- const mainAndOthers = [this.getMainCheckin(), ...this.getOtherCheckins()];
20
- return mainAndOthers.filter(notUndefined);
21
- }
22
- getOtherCheckins() {
23
- return this.checkins.filter(c => c.main === false && !this.deleted.includes(c.id));
24
- }
25
- getMainCheckin() {
26
- const nonDeletedCheckins = this.checkins.filter(checkin => checkin.main === true && !this.deleted.includes(checkin.id)).sort((a, b) => a.time.getTime() - b.time.getTime());
27
- return nonDeletedCheckins[0];
17
+ getActiveCheckins() {
18
+ return this.checkins.filter(c => !this.deleted.includes(c.id));
28
19
  }
29
20
  merge(otherCheckin) {
30
21
  const checkins = new Map([...this.checkins, ...otherCheckin.checkins].map(checkin => [checkin.id, checkin])).values();
@@ -40,7 +40,7 @@ export const GuestCard = props => {
40
40
  findMainGuest: props.findMainGuest,
41
41
  formatName: props.formatName
42
42
  }), /*#__PURE__*/React.createElement(CheckinCountIndicator, {
43
- checkins: props.attendee.getCheckinsForTag(props.checkinTag).getAllCheckins(),
43
+ checkins: props.attendee.getCheckinsForTag(props.checkinTag).getActiveCheckins(),
44
44
  response: props.attendee.getResponseForTag(props.checkinTag),
45
45
  rsvpCount: props.attendee.getRsvpCountForTag(props.checkinTag)
46
46
  })), /*#__PURE__*/React.createElement("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-crew-berlin/enter-js-utils",
3
- "version": "0.38.1",
3
+ "version": "0.39.0",
4
4
  "description": "utils such as vaildation and other helpers to work with data from the enter app",
5
5
  "files": [
6
6
  "dist",