@@ -590,6 +590,33 @@ private function validateDate($date)
590
590
return $ date ;
591
591
}
592
592
593
+ /**
594
+ * In some cases, a project returns multiple records. Try and find the one with metadata.
595
+ */
596
+ private function getProjectDetails ($ address )
597
+ {
598
+ $ query = '
599
+ projects(filter: {id: {equalTo: " ' . $ address . '"}}) {
600
+ id
601
+ name
602
+ metadata
603
+ }
604
+ ' ;
605
+
606
+ $ projectData = $ this ->graphQLQuery ($ query );
607
+
608
+ if (count ($ projectData ['projects ' ]) > 0 ) {
609
+ // return the project that has metadata
610
+ foreach ($ projectData ['projects ' ] as $ key => $ data ) {
611
+ if (isset ($ data ['metadata ' ])) {
612
+ return $ data ;
613
+ }
614
+ }
615
+ }
616
+
617
+ return null ;
618
+ }
619
+
593
620
/**
594
621
* Update project data by pulling projects for a specific round
595
622
*/
@@ -598,7 +625,7 @@ private function updateProjects($round)
598
625
$ cacheName = $ this ->cacheName . 'IngestData::updateProjects( ' . $ round ->id . ') ' ;
599
626
600
627
$ query = '
601
- applications(filter: {roundId: {equalTo: " ' . $ round ->round_addr . '"}}) {
628
+ applications(filter: {roundId: {equalTo: " ' . $ round ->round_addr . '"}, chainId: {equalTo: ' . $ round -> chain -> chain_id . ' } }) {
602
629
id
603
630
statusSnapshots
604
631
project {
@@ -609,6 +636,7 @@ private function updateProjects($round)
609
636
}
610
637
}
611
638
' ;
639
+
612
640
$ applicationData = $ this ->graphQLQuery ($ query );
613
641
614
642
$ hash = HashService::hashMultidimensionalArray ($ applicationData );
@@ -624,6 +652,14 @@ private function updateProjects($round)
624
652
625
653
$ metadata = $ data ['project ' ]['metadata ' ];
626
654
655
+ if (!isset ($ metadata ['description ' ])) {
656
+ // If we can't find the metadata, try and make a direct query for the project metadata
657
+ $ projectData = $ this ->getProjectDetails ($ data ['project ' ]['id ' ]);
658
+ if ($ projectData ) {
659
+ $ metadata = $ projectData ['metadata ' ];
660
+ }
661
+ }
662
+
627
663
$ description = null ;
628
664
if (isset ($ metadata ['description ' ])) {
629
665
$ description = $ metadata ['description ' ];
@@ -641,7 +677,6 @@ private function updateProjects($round)
641
677
642
678
$ title = isset ($ data ['project ' ]['name ' ]) ? $ data ['project ' ]['name ' ] : (isset ($ metadata ['title ' ]) ? $ metadata ['title ' ] : null );
643
679
644
-
645
680
$ project = Project::updateOrCreate (
646
681
['id_addr ' => Str::lower ($ data ['project ' ]['id ' ])],
647
682
[
0 commit comments