app/models/c80_estate/pstat.rb in c80_estate-0.1.0.26 vs app/models/c80_estate/pstat.rb in c80_estate-0.1.0.27
- old
+ new
@@ -135,10 +135,12 @@
)
result[:graph_radial_sq] = _parse_for_js_radial_graph_sq(free_areas_atnow_sq, busy_areas_atnow_sq)
# common
+ result[:average_price] = "#{Property.all.average_price.to_s(:rounded, :precision => 2)} руб" #'123,50 руб'
+ result[:average_price_busy] = "#{Property.all.average_price_busy.to_s(:rounded, :precision => 2)} руб" # '73,50 руб'
result[:title] = 'Статистика - Все объекты недвижимости'
# Rails.logger.debug "result ============= #{result}"
# если фильтруем по property
elsif prop_id.present?
@@ -299,12 +301,16 @@
result[:raw_props_sq][:all_areas_count_sq] = free_areas_atnow_sq + busy_areas_atnow_sq
result[:raw_props_sq][:free_areas_count_sq] = free_areas_atnow_sq
result[:raw_props_sq][:busy_areas_atnow_sq] = busy_areas_atnow_sq
# common
-
+ result[:average_price] = "#{property.average_price(atype_id:atype_id).to_s(:rounded, :precision => 2)} руб" #'123,50 руб'
+ result[:average_price_busy] = "#{property.average_price_busy(atype_id:atype_id).to_s(:rounded, :precision => 2)} руб" #'73,50 руб'
result[:title] = "Статистика - Объект - #{property.title}"
+ if atype_id.present?
+ result[:title] += " <span class='h2_title_span'>// фильтр по типу: #{Atype.find(atype_id).title}</span>"
+ end
# result[:graph] = _parse_for_js_radial_graph(free_areas_atnow,busy_areas_atnow)
# if atype_id.present?
# result[:title] += " (#{Atype.find(atype_id).title})"
@@ -388,19 +394,24 @@
# end
end
# Занятость
- tt = _calc_free_busy_areas(pstats)
-
- free_areas_atnow = tt[:sum_free_areas] #*1.0/all_props.count #pstats.last.free_areas
- busy_areas_atnow = tt[:sum_busy_areas] #*1.0/all_props.count #pstats.last.busy_areas
-
+=begin
+ # tt = _calc_free_busy_areas(pstats)
+ #
+ # free_areas_atnow = tt[:sum_free_areas] #*1.0/all_props.count #pstats.last.free_areas
+ # busy_areas_atnow = tt[:sum_busy_areas] #*1.0/all_props.count #pstats.last.busy_areas
+ #
# Rails.logger.debug("\t\t atype_id = #{atype_id}")
# Rails.logger.debug("\t\t free_areas_atnow = #{free_areas_atnow}")
# Rails.logger.debug("\t\t busy_areas_atnow = #{busy_areas_atnow}")
+=end
+ free_areas_atnow = pstats.last.free_areas
+ busy_areas_atnow = pstats.last.busy_areas
+
# защищаемся от деления на ноль
if free_areas_atnow + busy_areas_atnow == 0
bcoef = 0.0
else
bcoef = busy_areas_atnow*1.0 / (free_areas_atnow + busy_areas_atnow) * 100.0
@@ -454,11 +465,12 @@
result[:raw_props_sq][:all_areas_count_sq] = free_areas_atnow_sq + busy_areas_atnow_sq
result[:raw_props_sq][:free_areas_count_sq] = free_areas_atnow_sq
result[:raw_props_sq][:busy_areas_atnow_sq] = busy_areas_atnow_sq
# common
-
- result[:title] = "Статистика - Объекты - Фильтр по типу площади '#{ Atype.find(atype_id).title }'"
+ result[:average_price] = "#{Property.all.average_price(atype_id: atype_id).to_s(:rounded, :precision => 2)} руб" #'123,50 руб'
+ result[:average_price_busy] = "#{Property.all.average_price_busy(atype_id: atype_id).to_s(:rounded, :precision => 2)} руб" # '73,50 руб'
+ result[:title] = "Статистика - Все объекты <span class='h2_title_span'>// фильтр по типу: #{Atype.find(atype_id).title}</span>"
# if atype_id.present?
# result[:title] += " (#{Atype.find(atype_id).title})"
# end
\ No newline at end of file