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'''
|
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!) {
|
||||||
|
|
||||||
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 {
|
||||||
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 {
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue