fix: show received certifications when asked, and keep only latests
This commit is contained in:
parent
3177392604
commit
ebf7420615
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue