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!) { ...@@ -85,7 +85,7 @@ query ($address: String!, $number: Int!, $offset: Int!) {
const String getCertsReceived = r''' const String getCertsReceived = r'''
query ($address: String!) { query ($address: String!) {
certification(where: {receiver: {pubkey: {_eq: $address}}}) { certification(where: {receiver: {pubkey: {_eq: $address}}}, order_by: {created_at: desc}) {
issuer { issuer {
pubkey pubkey
name name
...@@ -97,7 +97,7 @@ query ($address: String!) { ...@@ -97,7 +97,7 @@ query ($address: String!) {
const String getCertsSent = r''' const String getCertsSent = r'''
query ($address: String!) { query ($address: String!) {
certification(where: {issuer: {pubkey: {_eq: $address}}}) { certification(where: {issuer: {pubkey: {_eq: $address}}}, order_by: {created_at: desc}) {
receiver { receiver {
pubkey pubkey
name name
......
...@@ -51,7 +51,7 @@ class CertificationsScreen extends StatelessWidget { ...@@ -51,7 +51,7 @@ class CertificationsScreen extends StatelessWidget {
CertsCounter(address: address) CertsCounter(address: address)
]), ]),
content: CertsList( content: CertsList(
address: address, direction: CertDirection.sent), address: address, direction: CertDirection.received),
contentHorizontalPadding: 0, contentHorizontalPadding: 0,
contentBorderWidth: 1, contentBorderWidth: 1,
), ),
......
...@@ -87,11 +87,15 @@ class CertsList extends StatelessWidget { ...@@ -87,11 +87,15 @@ class CertsList extends StatelessWidget {
final date = DateTime.parse(cert['created_at']); final date = DateTime.parse(cert['created_at']);
final dp = DateTime(date.year, date.month, date.day); final dp = DateTime(date.year, date.month, date.day);
final dateForm = '${dp.day}-${dp.month}-${dp.year}'; final dateForm = '${dp.day}-${dp.month}-${dp.year}';
listCerts.add({
'address': issuerAddress, // Check if we have a more recent certification, we skip
'name': issuerName, if (!listCerts.any((cert) => cert['address'] == issuerAddress)) {
'date': dateForm listCerts.add({
}); 'address': issuerAddress,
'name': issuerName,
'date': dateForm
});
}
} }
// Build history list // 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