From c33e01ee12ec9ec675809210973167d1c991e2e4 Mon Sep 17 00:00:00 2001 From: Sibyl Date: Tue, 5 May 2020 23:27:33 +0000 Subject: [PATCH] return counts instead of data when # variations is large WormBase/website#7690 --- src/rest_api/classes/strain/widgets/contains.clj | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/rest_api/classes/strain/widgets/contains.clj b/src/rest_api/classes/strain/widgets/contains.clj index 9ccdabef..f6d94f29 100644 --- a/src/rest_api/classes/strain/widgets/contains.clj +++ b/src/rest_api/classes/strain/widgets/contains.clj @@ -17,11 +17,14 @@ :description "clones contained in the strain"}) (defn alleles [s] - {:data (when-let [vhs (:variation.strain/_strain s)] - (for [vh vhs - :let [variation (:variation/_strain vh)]] - (variation-core/process-variation variation (set [])))) - :description "alleles contained in the strain"}) + (let [vhs (:variation.strain/_strain s)] + {:data (if (< (count vhs) 3000) + (for [vh vhs + :let [variation (:variation/_strain vh)]] + (variation-core/process-variation variation (set [])))) + :count (count vhs) + :description "alleles contained in the strain"} + )) (defn genes [s] {:data (when-let [genes (:gene/_strain s)]