def delete_from_web
metric = Metric.by_id(params[:id].to_i) if params[:id] && params[:id].size > 0
if metric
- del_count = Metric.delete(params[:id].to_i)
+ del_count = Metric.delete_with_manual_measures(params[:id].to_i)
flash[:notice] = 'Successfully deleted.' if del_count == 1
flash[:error] = 'Unable to delete this metric.' if del_count != 1
Metric.clear_cache
keys_array.collect{ |key| Metric.by_name(key).id if Metric.by_name(key) }
end
+ def self.delete_with_manual_measures(id)
+ ManualMeasure.delete_all(["metric_id = ?", id])
+ self.delete(id)
+ end
+
def to_hash_json(options={})
return {'key' => name, 'name' => short_name, 'description' => description, 'domain' => domain,
'qualitative' => qualitative, 'user_managed' => self.user_managed,