Skip to content

Commit

Permalink
Fixed taxon tree response
Browse files Browse the repository at this point in the history
  • Loading branch information
Samseys committed Jun 13, 2023
1 parent 7a44955 commit 35b84e8
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions service/database/taxonomy.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,24 @@ func (db *appDB) FindTaxonTree(search string, typeN string) (str.TaxonomyTree, e
for i := 0; i < len(t.SubClasses); i++ {
var t1 str.TaxonomyTree
filter := bson.M{"TaxId": t.SubClasses[i].TaxId}
_ = db.taxonomy_tree.FindOne(context.TODO(), filter).Decode(&t1)
err = db.taxonomy_tree.FindOne(context.TODO(), filter).Decode(&t1)
if err != nil {
continue
}
for k := 0; k < len(t1.SubClasses); k++ {
var t2 str.TaxonomyTree
filter := bson.M{"TaxId": t1.SubClasses[k].TaxId}
_ = db.taxonomy_tree.FindOne(context.TODO(), filter).Decode(&t2)
err = db.taxonomy_tree.FindOne(context.TODO(), filter).Decode(&t2)
if err != nil {
continue
}
for j := 0; j < len(t2.SubClasses); j++ {
var t3 str.TaxonomyTree
filter := bson.M{"TaxId": t2.SubClasses[j].TaxId}
_ = db.taxonomy_tree.FindOne(context.TODO(), filter).Decode(&t3)

err = db.taxonomy_tree.FindOne(context.TODO(), filter).Decode(&t3)
if err != nil {
continue
}
t2.SubClasses[j] = t3
}
t1.SubClasses[k] = t2
Expand Down

0 comments on commit 35b84e8

Please sign in to comment.