Skip to content

Instantly share code, notes, and snippets.

@jmoren
Created February 28, 2014 13:22
Show Gist options
  • Select an option

  • Save jmoren/9271007 to your computer and use it in GitHub Desktop.

Select an option

Save jmoren/9271007 to your computer and use it in GitHub Desktop.
def stats
@ivr = Smrt::Ivr.find(params[:id])
@stats = @ivr.action_flows
@rules_by_containers = Smrt::IvrActionFlow.execute_query('SELECT container_name, name, SUM(case when rule_type = "invalid" then 1 else 0 end) AS invalid_rule, SUM(case when rule_type = "match" then 1 else 0 end) AS match_rule FROM ivr_dev.ivr_action_flows WHERE ivr_id = 2008 GROUP BY name;')
end
@jmoren
Copy link
Author

jmoren commented Feb 28, 2014

mysql> SELECT name, input, count(input) from ivr_action_flows where ivr_id = 2008 and input IS NOT NULL group by input, name;
+---------+-------+--------------+
| name | input | count(input) |
+---------+-------+--------------+
| Primero | 1 | 7 |
| Segundo | 5 | 3 |
| Tercero | 8 | 1 |
+---------+-------+--------------+
3 rows in set (0.00 sec)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment