캠페인 실시간 랭킹 후원자 이름 · 위치 핀 도로명 주소
This commit is contained in:
@@ -177,12 +177,15 @@ class FirestoreCampaignRepository implements CampaignRepository {
|
||||
RankWindow.weekly => DateTime.now().subtract(const Duration(days: 7)),
|
||||
};
|
||||
final totals = <String, int>{};
|
||||
final names = <String, String>{};
|
||||
for (final d in snap.docs) {
|
||||
final m = d.data();
|
||||
if (since != null && m.dateOr('createdAt', since).isBefore(since))
|
||||
continue;
|
||||
final uid = m.strOr('uid');
|
||||
totals[uid] = (totals[uid] ?? 0) + m.intOr('amount');
|
||||
// 서버가 후원 때 실은 공개 닉네임(`donorName`, M-7). 예전 후원에는 없어 「팬」이다.
|
||||
if (m.strOr('donorName').isNotEmpty) names[uid] = m.strOr('donorName');
|
||||
}
|
||||
final me = _backend.uid;
|
||||
final rows = totals.entries.toList()
|
||||
@@ -191,8 +194,10 @@ class FirestoreCampaignRepository implements CampaignRepository {
|
||||
for (var i = 0; i < rows.length; i++)
|
||||
ContributorRank(
|
||||
rank: i + 1,
|
||||
// 남의 이름은 서버에 읽을 자리가 없다. UID 는 화면에 내보내지 않는다.
|
||||
name: rows[i].key == me ? appL10n.commonMe : appL10n.commonFan,
|
||||
// UID · 이메일은 화면에 내보내지 않는다(G-07) — 공개 닉네임만.
|
||||
name: rows[i].key == me
|
||||
? appL10n.commonMe
|
||||
: publicName(names[rows[i].key]),
|
||||
pop: rows[i].value,
|
||||
isMe: rows[i].key == me,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user