snapshots_values[:root_sid] = (@snapshot.root_snapshot_id || @snapshot.id)
snapshots_values[:path]="#{@snapshot.path}#{@snapshot.id}.%"
- measures_conditions = ["project_measures.rule_id IS NULL", "project_measures.characteristic_id IS NULL", "project_measures.person_id IS NULL"]
+ measures_conditions = ["project_measures.rule_id IS NULL AND project_measures.characteristic_id IS NULL AND project_measures.person_id IS NULL"]
measures_values = {}
measures_conditions << "project_measures.metric_id = :m_id"
measures_values[:m_id] = metric.id
:conditions => [(snapshots_conditions + measures_conditions).join(' AND '), snapshots_values.merge(measures_values)],
:order => "project_measures.value #{'DESC' if metric.direction<0}",
:limit => limit)
+ measures=measures.select{|m| m.text_value.present?}
snapshots=Snapshot.find(measures.map { |m| m.snapshot_id }, :include => 'project')
snapshots_by_id = {}