diff --git a/CHANGELOG.md b/CHANGELOG.md index b620d4c2a1..81a1a07cb4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ About changelog [here](https://keepachangelog.com/en/1.0.0/) - Handle `no intervals found` warning in load_region test - Beacon remove variants - Protect remote_cors function in alignviewers view from Server-Side Request Forgery (SSRF) +- Check creation date of last document in gene collection to display when genes collection was updated last ## [4.51] ### Added diff --git a/scout/server/blueprints/genes/controllers.py b/scout/server/blueprints/genes/controllers.py index a64f7d5d42..fd52d13ac0 100644 --- a/scout/server/blueprints/genes/controllers.py +++ b/scout/server/blueprints/genes/controllers.py @@ -26,7 +26,8 @@ def genes(store, query): nr_genes_37 = store.nr_genes(build="37") nr_genes_38 = store.nr_genes(build="38") genes_subset = list(store.all_genes(add_transcripts=False, limit=20)) - last_updated = document_generated(genes_subset[0]["_id"] if genes_subset else None) + last_inserted_gene = store.hgnc_collection.find({}).sort("_id", -1).limit(1) + last_updated = document_generated(last_inserted_gene[0]["_id"] if last_inserted_gene else None) return dict(genes=genes_subset, last_updated=last_updated, nr_genes=(nr_genes_37, nr_genes_38))