|
|
@@ -104,21 +104,20 @@ export class Dashboard {
|
|
104
|
104
|
const today = this.toDateOnly(new Date());
|
|
105
|
105
|
const endDate = this.addDays(today, 30);
|
|
106
|
106
|
|
|
107
|
|
- this.upcomingMemorials = (await this.kakochoService
|
|
108
|
|
- .getKakochoList())
|
|
109
|
|
- .map((kakocho): UpcomingMemorial | null => {
|
|
|
107
|
+ const kakochoList = await this.kakochoService.getKakochoList();
|
|
|
108
|
+
|
|
|
109
|
+ const results = await Promise.all(
|
|
|
110
|
+ kakochoList.map(async (kakocho): Promise<UpcomingMemorial | null> => {
|
|
110
|
111
|
const deathDate = this.parseDate(kakocho.deathDate);
|
|
111
|
|
- if (!deathDate) {
|
|
112
|
|
- return null;
|
|
113
|
|
- }
|
|
|
112
|
+ if (!deathDate) return null;
|
|
114
|
113
|
|
|
115
|
114
|
const eventDate = new Date(this.targetYear, deathDate.getMonth(), deathDate.getDate());
|
|
116
|
|
- if (eventDate < today || eventDate > endDate) {
|
|
117
|
|
- return null;
|
|
118
|
|
- }
|
|
|
115
|
+ if (eventDate < today || eventDate > endDate) return null;
|
|
119
|
116
|
|
|
120
|
117
|
const memorialType = this.getMemorialType(deathDate);
|
|
121
|
|
- const danka = this.dankaService.getDankaById(kakocho.dankaId);
|
|
|
118
|
+
|
|
|
119
|
+ const danka = await this.dankaService.getDankaById(kakocho.dankaId);
|
|
|
120
|
+
|
|
122
|
121
|
const type = memorialType ? '年忌法要' : '命日';
|
|
123
|
122
|
const status = memorialType ? '準備確認' : '要確認';
|
|
124
|
123
|
|
|
|
@@ -133,8 +132,14 @@ export class Dashboard {
|
|
133
|
132
|
status,
|
|
134
|
133
|
};
|
|
135
|
134
|
})
|
|
|
135
|
+ );
|
|
|
136
|
+
|
|
|
137
|
+ this.upcomingMemorials = results
|
|
136
|
138
|
.filter((memorial): memorial is UpcomingMemorial => memorial !== null)
|
|
137
|
|
- .sort((a, b) => a.date.getTime() - b.date.getTime() || a.title.localeCompare(b.title, 'ja'))
|
|
|
139
|
+ .sort((a, b) =>
|
|
|
140
|
+ a.date.getTime() - b.date.getTime() ||
|
|
|
141
|
+ a.title.localeCompare(b.title, 'ja')
|
|
|
142
|
+ )
|
|
138
|
143
|
.slice(0, 3);
|
|
139
|
144
|
}
|
|
140
|
145
|
|