From b59df112d76d0cb7bd11bdce176a762a1663c215 Mon Sep 17 00:00:00 2001 From: CoralineAda Date: Fri, 1 Nov 2024 11:54:39 -0500 Subject: [PATCH] Add :Persona to histogram query --- app/models/code.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/code.rb b/app/models/code.rb index 7d05a9c..f0bdb42 100644 --- a/app/models/code.rb +++ b/app/models/code.rb @@ -19,7 +19,7 @@ class Code # Given a context, generates a hash with each unique Codes as a key and the counts of its uses as a value. def self.histogram(context) - codes = where(context: context).query_as(:c).with('c, count{(c)-[:EXPERIENCES]-()} AS ct').where('ct > 0').order('c DESC').return('c.name, ct') + codes = where(context: context).query_as(:c).with('c, count{(c)-[:EXPERIENCES]-(:Persona)} AS ct').where('ct > 0').order('c DESC').return('c.name, ct') codes.inject({}) {|accumulator,code| accumulator[code.values[0]] ||= 0; accumulator[code.values[0]] += code.values[1]; accumulator} end