Skip to content
Snippets Groups Projects
Commit ebf74206 authored by poka's avatar poka
Browse files

fix: show received certifications when asked, and keep only latests

parent 31773926
No related branches found
No related tags found
No related merge requests found
Pipeline #35189 waiting for manual action
......@@ -85,7 +85,7 @@ query ($address: String!, $number: Int!, $offset: Int!) {
const String getCertsReceived = r'''
query ($address: String!) {
certification(where: {receiver: {pubkey: {_eq: $address}}}) {
certification(where: {receiver: {pubkey: {_eq: $address}}}, order_by: {created_at: desc}) {
issuer {
pubkey
name
......@@ -97,7 +97,7 @@ query ($address: String!) {
const String getCertsSent = r'''
query ($address: String!) {
certification(where: {issuer: {pubkey: {_eq: $address}}}) {
certification(where: {issuer: {pubkey: {_eq: $address}}}, order_by: {created_at: desc}) {
receiver {
pubkey
name
......
......@@ -51,7 +51,7 @@ class CertificationsScreen extends StatelessWidget {
CertsCounter(address: address)
]),
content: CertsList(
address: address, direction: CertDirection.sent),
address: address, direction: CertDirection.received),
contentHorizontalPadding: 0,
contentBorderWidth: 1,
),
......
......@@ -87,11 +87,15 @@ class CertsList extends StatelessWidget {
final date = DateTime.parse(cert['created_at']);
final dp = DateTime(date.year, date.month, date.day);
final dateForm = '${dp.day}-${dp.month}-${dp.year}';
listCerts.add({
'address': issuerAddress,
'name': issuerName,
'date': dateForm
});
// Check if we have a more recent certification, we skip
if (!listCerts.any((cert) => cert['address'] == issuerAddress)) {
listCerts.add({
'address': issuerAddress,
'name': issuerName,
'date': dateForm
});
}
}
// Build history list
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment