Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix reputation count on profile page #1606

Merged
merged 4 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/lib/l10n/arb/app_de.arb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@
"exportWarn": "Schreibe diese Wörter auf ein Papier. Behalte das Papier an einem sicheren Ort. Diese Wörter geben jedem Zugriff auf das Konto und das Vermögen",
"fail": "Fehlgeschlagen",
"fee": "Gebühr",
"fetchingReputations": "Es wird überprüft, ob du bereits Reputation hast",
"finish": "Beenden",
"from": "Von",
"fundsReceived": "Zahlungseingang",
Expand Down
1 change: 0 additions & 1 deletion app/lib/l10n/arb/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@
"exportWarn": "Write these words down on paper. Keep the backup paper safe. These words allows anyone to recover this account and access its funds.",
"fail": "Failed",
"fee": "Fee",
"fetchingReputations": "Checking if you have reputation",
"finish": "Finish",
"from": "From",
"fundsReceived": "funds received",
Expand Down
1 change: 0 additions & 1 deletion app/lib/l10n/arb/app_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@
"exportWarn": "Écris ces mots sur un papier. Garde le papier dans un endroit sûr. Ces mots donnent à n'importe qui l'accès au compte et à la fortune.",
"fail": "Échec",
"fee": "Frais",
"fetchingReputations": "Vérifier si tu as une réputation",
"finish": "Terminer",
"from": "De",
"fundsReceived": "Réception du paiement",
Expand Down
1 change: 0 additions & 1 deletion app/lib/l10n/arb/app_ru.arb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@
"exportWarn": "Запишите эти слова на бумаге. Храните бумагу в безопасном месте. Эти слова позволят восстановить этот аккаунт и получить доступ к его средствам",
"fail": "Не удалось",
"fee": "Платеж",
"fetchingReputations": "Идет проверка Вашей репутации",
"finish": "Завершить",
"from": "Из",
"fundsReceived": "Полученные средства",
Expand Down
4 changes: 2 additions & 2 deletions app/lib/models/ceremonies/ceremonies.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ class CommunityReputation {

Map<String, dynamic> toJson() => _$CommunityReputationToJson(this);

CommunityIdentifier? communityIdentifier;
Reputation? reputation;
CommunityIdentifier communityIdentifier;
Reputation reputation;

@override
String toString() {
Expand Down
10 changes: 4 additions & 6 deletions app/lib/models/ceremonies/ceremonies.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/lib/page/profile/account/faucet_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class _FaucetListTileState extends State<FaucetListTile> {
// Create a set of futures to await in parallel.
final futures = reputations.entries.map(
(e) async {
final cid = e.value.communityIdentifier!;
final cid = e.value.communityIdentifier;
// Only check if the reputations community id is allowed to drip the faucet.
if (widget.faucet.whitelist == null || widget.faucet.whitelist!.contains(cid)) {
final hasCommitted = await webApi.encointer.hasCommittedFor(
Expand All @@ -116,7 +116,7 @@ class _FaucetListTileState extends State<FaucetListTile> {
address,
);

if (!hasCommitted) ids[e.key] = e.value.communityIdentifier!;
if (!hasCommitted) ids[e.key] = e.value.communityIdentifier;
}
},
);
Expand Down
8 changes: 4 additions & 4 deletions app/lib/page/profile/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ class _ProfileState extends State<Profile> {
},
),
ListTile(
title: Text(l10n.reputationOverall, style: h3Grey),
trailing: store.encointer.account?.reputations != null
? Text(store.encointer.account?.reputations.length.toString() ?? 0.toString())
: Text(l10n.fetchingReputations)),
Comment on lines -166 to -168
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fetching reputation could never be reached anyhow, so I removed it.

title: Text(l10n.reputationOverall, style: h3Grey),
// Account can be null after switching networks.
trailing: Text('${store.encointer.account?.reputationCount.toString() ?? 0}'),
),
ListTile(
title: Text(l10n.about,
style: context.titleLarge.copyWith(color: context.colorScheme.secondary, fontSize: 19)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ abstract class _EncointerAccountStore with Store {
@observable
Map<int, CommunityReputation> reputations = {};

/// Number of successfully attended meetups in the range of reputation lifetime.
@computed
int get reputationCount {
return reputations.values
.where((r) => r.reputation == Reputation.VerifiedLinked || r.reputation == Reputation.VerifiedUnlinked)
.length;
}

@observable
ObservableList<TransferData> txsTransfer = ObservableList<TransferData>();

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading