@glissandoo/lib 1.102.7 → 1.102.9
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.
|
@@ -5,6 +5,8 @@ export default class EventoPlayerBasic {
|
|
|
5
5
|
protected data: AEventPlayerBasicData;
|
|
6
6
|
constructor(eventId: string, data: AEventPlayerBasicData);
|
|
7
7
|
get id(): string;
|
|
8
|
+
get name(): string;
|
|
9
|
+
get lastname(): string;
|
|
8
10
|
get username(): string;
|
|
9
11
|
get displayName(): string;
|
|
10
12
|
get photoURL(): string;
|
|
@@ -2,11 +2,14 @@ import { BadgesTypes } from '../../../helpers/badges';
|
|
|
2
2
|
import { LanguagesTypes } from '../../../lang';
|
|
3
3
|
import { EventType } from '../../Evento/types';
|
|
4
4
|
import { DocumentModel } from '../../Model';
|
|
5
|
+
import { PlayerBasicData } from '../../Player/types';
|
|
5
6
|
import UserExtended from '../../User/extended';
|
|
6
7
|
import { GroupPlayerData, GroupPlayerRole } from './types';
|
|
7
8
|
export default class GroupPlayer extends UserExtended<GroupPlayerData> {
|
|
8
9
|
constructor(doc: DocumentModel, lang?: LanguagesTypes);
|
|
10
|
+
get basicInfo(): PlayerBasicData;
|
|
9
11
|
get groupId(): string;
|
|
12
|
+
get mainInstrument(): import("../../../helpers/instruments").InstrumentId;
|
|
10
13
|
get instruments(): import("../../../helpers/instruments").InstrumentId[];
|
|
11
14
|
get instrumentsLastUpdatedBy(): string | null;
|
|
12
15
|
get role(): GroupPlayerRole;
|
|
@@ -14,6 +17,9 @@ export default class GroupPlayer extends UserExtended<GroupPlayerData> {
|
|
|
14
17
|
get joinedAt(): FirebaseFirestore.Timestamp;
|
|
15
18
|
get leavedAt(): FirebaseFirestore.Timestamp | null;
|
|
16
19
|
get leavedBy(): string | null;
|
|
20
|
+
get additionalInfo(): import("../../../helpers/slate").Descendant[];
|
|
21
|
+
get lastEditAdditionalInfoAt(): FirebaseFirestore.Timestamp | null;
|
|
22
|
+
get lastEditAdditionalInfoBy(): string | null;
|
|
17
23
|
get isActive(): boolean;
|
|
18
24
|
get eventsInvited(): number;
|
|
19
25
|
get eventsAnswered(): number;
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const lodash_1 = require("lodash");
|
|
7
7
|
const badges_1 = require("../../../helpers/badges");
|
|
8
|
+
const instruments_1 = require("../../../helpers/instruments");
|
|
8
9
|
const utils_1 = require("../../../helpers/utils");
|
|
9
10
|
const lang_1 = require("../../../lang");
|
|
10
11
|
const extended_1 = __importDefault(require("../../User/extended"));
|
|
@@ -13,9 +14,18 @@ class GroupPlayer extends extended_1.default {
|
|
|
13
14
|
constructor(doc, lang = lang_1.defaultLocale) {
|
|
14
15
|
super(doc, lang);
|
|
15
16
|
}
|
|
17
|
+
get basicInfo() {
|
|
18
|
+
return {
|
|
19
|
+
...super.basicInfo,
|
|
20
|
+
mainInstrument: this.mainInstrument,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
16
23
|
get groupId() {
|
|
17
24
|
return (0, utils_1.at)(this.ref.path.split('/'), 1) || '';
|
|
18
25
|
}
|
|
26
|
+
get mainInstrument() {
|
|
27
|
+
return this.data.mainInstrument || instruments_1.DefaultInstrumentId.Maracas;
|
|
28
|
+
}
|
|
19
29
|
get instruments() {
|
|
20
30
|
return this.data.instruments || [];
|
|
21
31
|
}
|
|
@@ -23,7 +33,7 @@ class GroupPlayer extends extended_1.default {
|
|
|
23
33
|
return this.data.instrumentsLastUpdatedBy || null;
|
|
24
34
|
}
|
|
25
35
|
get role() {
|
|
26
|
-
return this.data.role;
|
|
36
|
+
return this.data.role || types_1.GroupPlayerRole.Member;
|
|
27
37
|
}
|
|
28
38
|
get isAdmin() {
|
|
29
39
|
return this.role === types_1.GroupPlayerRole.Admin;
|
|
@@ -37,6 +47,15 @@ class GroupPlayer extends extended_1.default {
|
|
|
37
47
|
get leavedBy() {
|
|
38
48
|
return this.data.leavedBy || null;
|
|
39
49
|
}
|
|
50
|
+
get additionalInfo() {
|
|
51
|
+
return this.data.additionalInfo || [];
|
|
52
|
+
}
|
|
53
|
+
get lastEditAdditionalInfoAt() {
|
|
54
|
+
return this.data.lastEditAdditionalInfoAt || null;
|
|
55
|
+
}
|
|
56
|
+
get lastEditAdditionalInfoBy() {
|
|
57
|
+
return this.data.lastEditAdditionalInfoBy || null;
|
|
58
|
+
}
|
|
40
59
|
get isActive() {
|
|
41
60
|
return this.exists && (0, lodash_1.isNull)(this.leavedAt);
|
|
42
61
|
}
|
|
@@ -138,47 +157,6 @@ class GroupPlayer extends extended_1.default {
|
|
|
138
157
|
const field = [type, 'rollcall', action, 'count'].join('_');
|
|
139
158
|
return (0, lodash_1.get)(this.data, field) || 0;
|
|
140
159
|
}
|
|
141
|
-
// public rollCallData(type?: EventType) {
|
|
142
|
-
// if (type) {
|
|
143
|
-
// const total = (this.get(`${type}_rollcall_count`) as number) || 0;
|
|
144
|
-
// const confirmed = (this.get(`${type}_rollcall_confirmed_count`) as number) || 0;
|
|
145
|
-
// const declined = (this.get(`${type}_rollcall_declined_count`) as number) || 0;
|
|
146
|
-
// return {
|
|
147
|
-
// total,
|
|
148
|
-
// confirmed,
|
|
149
|
-
// declined,
|
|
150
|
-
// nostatus: total - confirmed - declined,
|
|
151
|
-
// };
|
|
152
|
-
// }
|
|
153
|
-
// return {
|
|
154
|
-
// total: this.eventsRollCall,
|
|
155
|
-
// confirmed: this.eventsRollCallConfirmed,
|
|
156
|
-
// declined: this.eventsRollCallDeclined,
|
|
157
|
-
// nostatus:
|
|
158
|
-
// this.eventsRollCall - this.eventsRollCallConfirmed - this.eventsRollCallDeclined,
|
|
159
|
-
// };
|
|
160
|
-
// }
|
|
161
|
-
// public percPassEventsAnswered() {
|
|
162
|
-
// if (this.eventsPassed === 0) {
|
|
163
|
-
// return 0;
|
|
164
|
-
// }
|
|
165
|
-
// return Math.floor((this.eventsPassedAnswered * 100) / this.eventsPassed);
|
|
166
|
-
// }
|
|
167
|
-
// public answeredFreq() {
|
|
168
|
-
// const perc = this.percPassEventsAnswered();
|
|
169
|
-
// if (perc >= 0 && perc < 10) {
|
|
170
|
-
// return 'never';
|
|
171
|
-
// } else if (perc >= 10 && perc < 40) {
|
|
172
|
-
// return 'sometimes';
|
|
173
|
-
// } else if (perc >= 40 && perc < 70) {
|
|
174
|
-
// return 'often';
|
|
175
|
-
// } else if (perc >= 70 && perc < 90) {
|
|
176
|
-
// return 'usually';
|
|
177
|
-
// } else if (perc >= 90 && perc <= 100) {
|
|
178
|
-
// return 'always';
|
|
179
|
-
// }
|
|
180
|
-
// return null;
|
|
181
|
-
// }
|
|
182
160
|
getBadgeLevel(field, level) {
|
|
183
161
|
const _level = level || this.getCurrentBadgeLevel(field);
|
|
184
162
|
const badge = this[field];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Timestamp } from '@google-cloud/firestore';
|
|
2
2
|
import { InstrumentId } from '../../../helpers/instruments';
|
|
3
|
+
import { Descendant } from '../../../helpers/slate';
|
|
3
4
|
import { UserExtendedData } from '../../User/types';
|
|
4
5
|
export declare enum GroupPlayerRole {
|
|
5
6
|
Admin = "admin",
|
|
@@ -17,6 +18,9 @@ export interface GroupPlayerData extends UserExtendedData {
|
|
|
17
18
|
joinedAt: Timestamp;
|
|
18
19
|
leavedAt: Timestamp | null;
|
|
19
20
|
leavedBy: string | null;
|
|
21
|
+
additionalInfo: Descendant[];
|
|
22
|
+
lastEditAdditionalInfoAt: Timestamp | null;
|
|
23
|
+
lastEditAdditionalInfoBy: string | null;
|
|
20
24
|
badgeAccPractices?: BadgeLevels;
|
|
21
25
|
badgeAccPerformances?: BadgeLevels;
|
|
22
26
|
badgeStrikePractices?: BadgeLevels;
|