c80_estate 0.1.0.14 → 0.1.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/admin/c80_estate/properties.rb +5 -0
- data/app/assets/javascript/c80_estate/backend/admin/shared/areas/gallery3.js +27 -26
- data/app/assets/javascript/c80_estate/backend/admin/shared/properties/property_show.js +480 -0
- data/app/assets/javascript/c80_estate/backend/admin/src/properties.js +5 -0
- data/app/assets/javascript/c80_estate/backend/admin/src/pstats.js +67 -3
- data/app/assets/javascript/c80_estate/lib/highstock.js +434 -0
- data/app/assets/stylesheets/c80_estate/backend/admin_pstats.scss +0 -132
- data/app/assets/stylesheets/c80_estate/backend/dashboard/prop_in_list.scss +1 -1
- data/app/assets/stylesheets/c80_estate/backend/shared/areas/stroitelnye_materialy_item/div_comments.scss +3 -1
- data/app/assets/stylesheets/c80_estate/backend/shared/areas/stroitelnye_materialy_item/div_main.scss +4 -2
- data/app/assets/stylesheets/c80_estate/backend/shared/index_adds_like_pstats.scss +131 -0
- data/app/helpers/c80_estate/app_helper.rb +38 -0
- data/app/helpers/c80_estate/properties_helper.rb +67 -0
- data/app/models/c80_estate/area.rb +15 -8
- data/app/models/c80_estate/property.rb +28 -0
- data/app/models/c80_estate/pstat.rb +96 -10
- data/app/uploaders/c80_estate/pphoto_uploader.rb +2 -2
- data/app/views/admin/properties/_show_property.html.erb +1 -0
- data/app/views/c80_estate/shared/areas/_single_area_on_page.html.erb +1 -1
- data/app/views/c80_estate/shared/properties/_single_property_on_page.html.erb +38 -0
- data/lib/c80_estate/version.rb +1 -1
- metadata +9 -2
@@ -37,5 +37,33 @@ module C80Estate
|
|
37
37
|
url
|
38
38
|
end
|
39
39
|
|
40
|
+
def main_image_url
|
41
|
+
url = 'no_thumb.png'
|
42
|
+
if pphotos.count > 0
|
43
|
+
url = pphotos.first.image.thumb512
|
44
|
+
end
|
45
|
+
url
|
46
|
+
end
|
47
|
+
|
48
|
+
def last_updater
|
49
|
+
pstats.last.sevent.auser.email
|
50
|
+
end
|
51
|
+
|
52
|
+
def square_value
|
53
|
+
sum = 0
|
54
|
+
areas.all.each do |area|
|
55
|
+
sum += area.square_value
|
56
|
+
end
|
57
|
+
sum
|
58
|
+
end
|
59
|
+
|
60
|
+
def power_price_value
|
61
|
+
sum = 0
|
62
|
+
areas.all.each do |area|
|
63
|
+
sum += area.power_price_value
|
64
|
+
end
|
65
|
+
sum
|
66
|
+
end
|
67
|
+
|
40
68
|
end
|
41
69
|
end
|
@@ -89,7 +89,12 @@ module C80Estate
|
|
89
89
|
result[:raw_props][:all_areas_count] = free_areas_atnow + busy_areas_atnow
|
90
90
|
result[:raw_props][:free_areas_count] = free_areas_atnow
|
91
91
|
result[:raw_props][:busy_areas_atnow] = busy_areas_atnow
|
92
|
-
result[:graph_dynamic] = _parse_for_js_dynamic_graph_canvasjs(pstats.ordered_by_created_at)
|
92
|
+
# result[:graph_dynamic] = _parse_for_js_dynamic_graph_canvasjs(pstats.ordered_by_created_at)
|
93
|
+
result[:graph_dynamic] = _parse_for_js_dynamic_graph_highstock(
|
94
|
+
pstats.ordered_by_created_at,
|
95
|
+
tcut[:used_start_date],
|
96
|
+
tcut[:used_end_date]
|
97
|
+
)
|
93
98
|
result[:graph_radial] = _parse_for_js_radial_graph(free_areas_atnow, busy_areas_atnow)
|
94
99
|
|
95
100
|
# Rails.logger.debug "<Pstat.busy_coef> busy_areas_count = #{ busy_areas_count }"
|
@@ -120,7 +125,11 @@ module C80Estate
|
|
120
125
|
result[:raw_props_sq][:all_areas_count_sq] = free_areas_atnow_sq + busy_areas_atnow_sq
|
121
126
|
result[:raw_props_sq][:free_areas_count_sq] = free_areas_atnow_sq
|
122
127
|
result[:raw_props_sq][:busy_areas_atnow_sq] = busy_areas_atnow_sq
|
123
|
-
result[:graph_dynamic_sq] =
|
128
|
+
result[:graph_dynamic_sq] = _parse_for_js_dynamic_graph_highstock_sq(
|
129
|
+
pstats.where(:atype_id => nil).ordered_by_created_at,
|
130
|
+
tcut[:used_start_date],
|
131
|
+
tcut[:used_end_date]
|
132
|
+
)
|
124
133
|
result[:graph_radial_sq] = _parse_for_js_radial_graph_sq(free_areas_atnow_sq, busy_areas_atnow_sq)
|
125
134
|
|
126
135
|
# common
|
@@ -207,11 +216,21 @@ module C80Estate
|
|
207
216
|
if atype_id.nil?
|
208
217
|
free_areas_atnow = pstats.where(:atype_id => nil).last.free_areas
|
209
218
|
busy_areas_atnow = pstats.where(:atype_id => nil).last.busy_areas
|
210
|
-
graph_data = _parse_for_js_dynamic_graph_canvasjs(pstats.where(:atype_id => nil).ordered_by_created_at)
|
219
|
+
# graph_data = _parse_for_js_dynamic_graph_canvasjs(pstats.where(:atype_id => nil).ordered_by_created_at)
|
220
|
+
graph_data = _parse_for_js_dynamic_graph_highstock(
|
221
|
+
pstats.where(:atype_id => nil).ordered_by_created_at,
|
222
|
+
used_start_date,
|
223
|
+
used_end_date
|
224
|
+
)
|
211
225
|
else
|
212
226
|
free_areas_atnow = pstats.last.free_areas
|
213
227
|
busy_areas_atnow = pstats.last.busy_areas
|
214
|
-
graph_data = _parse_for_js_dynamic_graph_canvasjs(pstats.ordered_by_created_at)
|
228
|
+
# graph_data = _parse_for_js_dynamic_graph_canvasjs(pstats.ordered_by_created_at)
|
229
|
+
graph_data = _parse_for_js_dynamic_graph_highstock(
|
230
|
+
pstats.ordered_by_created_at,
|
231
|
+
used_start_date,
|
232
|
+
used_end_date
|
233
|
+
)
|
215
234
|
end
|
216
235
|
|
217
236
|
# Rails.logger.debug("\t\t atype_id = #{atype_id}")
|
@@ -241,11 +260,17 @@ module C80Estate
|
|
241
260
|
if atype_id.nil?
|
242
261
|
free_areas_atnow_sq = pstats.where(:atype_id => nil).last.free_areas_sq
|
243
262
|
busy_areas_atnow_sq = pstats.where(:atype_id => nil).last.busy_areas_sq
|
244
|
-
graph_data_sq =
|
263
|
+
graph_data_sq = _parse_for_js_dynamic_graph_highstock_sq(pstats.where(:atype_id => nil).ordered_by_created_at,
|
264
|
+
used_start_date,
|
265
|
+
used_end_date
|
266
|
+
)
|
245
267
|
else
|
246
268
|
free_areas_atnow_sq = pstats.last.free_areas_sq
|
247
269
|
busy_areas_atnow_sq = pstats.last.busy_areas_sq
|
248
|
-
graph_data_sq =
|
270
|
+
graph_data_sq = _parse_for_js_dynamic_graph_highstock_sq(pstats.ordered_by_created_at,
|
271
|
+
used_start_date,
|
272
|
+
used_end_date
|
273
|
+
)
|
249
274
|
end
|
250
275
|
|
251
276
|
# защищаемся от деления на ноль
|
@@ -381,7 +406,12 @@ module C80Estate
|
|
381
406
|
result[:busy_coef] = sprintf "%.2f%", bcoef
|
382
407
|
result[:comment] = "<abbr title='Период рассчёта занятости'>C #{used_start_date_str} по #{used_end_date_str}</abbr>"
|
383
408
|
result[:abbr] = 'Занятость объекта в конце указанного периода: число b/N, где b - кол-во свободных, N - всего площадей'
|
384
|
-
result[:graph_dynamic] = _parse_for_js_dynamic_graph_canvasjs(pstats.ordered_by_created_at)
|
409
|
+
# result[:graph_dynamic] = _parse_for_js_dynamic_graph_canvasjs(pstats.ordered_by_created_at)
|
410
|
+
result[:graph_dynamic] = _parse_for_js_dynamic_graph_highstock(
|
411
|
+
pstats.ordered_by_created_at,
|
412
|
+
used_start_date,
|
413
|
+
used_end_date
|
414
|
+
)
|
385
415
|
result[:graph_radial] = _parse_for_js_radial_graph(free_areas_atnow, busy_areas_atnow)
|
386
416
|
|
387
417
|
result[:raw_props] = {}
|
@@ -393,7 +423,10 @@ module C80Estate
|
|
393
423
|
|
394
424
|
free_areas_atnow_sq = pstats.last.free_areas_sq
|
395
425
|
busy_areas_atnow_sq = pstats.last.busy_areas_sq
|
396
|
-
graph_data_sq =
|
426
|
+
graph_data_sq = _parse_for_js_dynamic_graph_highstock_sq(pstats.ordered_by_created_at,
|
427
|
+
used_start_date,
|
428
|
+
used_end_date
|
429
|
+
)
|
397
430
|
|
398
431
|
# защищаемся от деления на ноль
|
399
432
|
if busy_areas_atnow_sq + free_areas_atnow_sq == 0
|
@@ -473,11 +506,11 @@ module C80Estate
|
|
473
506
|
|
474
507
|
self.free_areas = self.property.areas.free_areas.count
|
475
508
|
self.busy_areas = self.property.areas.busy_areas.count
|
476
|
-
self.coef_busy = self.busy_areas*1.0 / (self.free_areas + self.busy_areas) * 100.0
|
509
|
+
self.coef_busy = (self.free_areas + self.busy_areas == 0) ? 0 : self.busy_areas*1.0 / (self.free_areas + self.busy_areas) * 100.0
|
477
510
|
|
478
511
|
self.free_areas_sq = self.property.areas.free_areas_sq
|
479
512
|
self.busy_areas_sq = self.property.areas.busy_areas_sq
|
480
|
-
self.coef_busy_sq = self.busy_areas_sq*1.0 / (self.free_areas_sq + self.busy_areas_sq) * 100.0
|
513
|
+
self.coef_busy_sq = (self.free_areas_sq + self.busy_areas_sq == 0) ? 0 : self.busy_areas_sq*1.0 / (self.free_areas_sq + self.busy_areas_sq) * 100.0
|
481
514
|
|
482
515
|
# здесь считаем коэф-ты для 'atype related записей'
|
483
516
|
else
|
@@ -586,6 +619,7 @@ module C80Estate
|
|
586
619
|
|
587
620
|
end
|
588
621
|
|
622
|
+
=begin
|
589
623
|
def self._parse_for_js_dynamic_graph_canvasjs(pstats)
|
590
624
|
# res: [
|
591
625
|
# {
|
@@ -612,6 +646,57 @@ module C80Estate
|
|
612
646
|
Rails.logger.debug "<Pstat.parse_for_js_graph> res = #{res}"
|
613
647
|
res
|
614
648
|
end
|
649
|
+
=end
|
650
|
+
|
651
|
+
def self._parse_for_js_dynamic_graph_highstock(pstats, start_date, end_date)
|
652
|
+
res = []
|
653
|
+
res << [start_date.to_i*1000,pstats.first.coef_busy]
|
654
|
+
|
655
|
+
pstats.each do |pstat|
|
656
|
+
|
657
|
+
res << [
|
658
|
+
pstat.created_at.to_i*1000,
|
659
|
+
pstat.coef_busy
|
660
|
+
]
|
661
|
+
|
662
|
+
# Rails.logger.debug "#{res.last[0]}"
|
663
|
+
|
664
|
+
end
|
665
|
+
|
666
|
+
res << [end_date.to_i*1000,pstats.last.coef_busy]
|
667
|
+
# Rails.logger.debug "#{end_date.to_i*1000}"
|
668
|
+
|
669
|
+
# Rails.logger.debug "<Pstat.parse_for_js_graph> pstat.last.created_at = #{pstats.last.created_at}, #{end_date}"
|
670
|
+
# res.sort! { |a,b| a[0] <=> b[0] }
|
671
|
+
res
|
672
|
+
|
673
|
+
end
|
674
|
+
|
675
|
+
def self._parse_for_js_dynamic_graph_highstock_sq(pstats, start_date, end_date)
|
676
|
+
res = []
|
677
|
+
res << [start_date.to_i*1000,pstats.first.coef_busy_sq]
|
678
|
+
|
679
|
+
pstats.each do |pstat|
|
680
|
+
|
681
|
+
res << [
|
682
|
+
pstat.created_at.to_i*1000,
|
683
|
+
pstat.coef_busy_sq
|
684
|
+
]
|
685
|
+
|
686
|
+
# Rails.logger.debug "#{res.last[0]}"
|
687
|
+
|
688
|
+
end
|
689
|
+
|
690
|
+
res << [end_date.to_i*1000,pstats.last.coef_busy_sq]
|
691
|
+
# Rails.logger.debug "#{end_date.to_i*1000}"
|
692
|
+
|
693
|
+
# Rails.logger.debug "<Pstat.parse_for_js_graph> pstat.last.created_at = #{pstats.last.created_at}, #{end_date}"
|
694
|
+
# res.sort! { |a,b| a[0] <=> b[0] }
|
695
|
+
res
|
696
|
+
|
697
|
+
end
|
698
|
+
|
699
|
+
=begin
|
615
700
|
|
616
701
|
def self._parse_for_js_dynamic_graph3_canvasjs(pstats)
|
617
702
|
# res: [
|
@@ -636,6 +721,7 @@ module C80Estate
|
|
636
721
|
end
|
637
722
|
res
|
638
723
|
end
|
724
|
+
=end
|
639
725
|
|
640
726
|
def self._calc_time_cut(first_created_at, time_now, start_date, end_date)
|
641
727
|
|
@@ -5,11 +5,11 @@ module C80Estate
|
|
5
5
|
process :resize_to_limit => [1024, 1024]
|
6
6
|
|
7
7
|
version :thumb512 do
|
8
|
-
process :
|
8
|
+
process :resize_to_fill => [621, 377]
|
9
9
|
end
|
10
10
|
|
11
11
|
version :thumb256 do
|
12
|
-
process :
|
12
|
+
process :resize_to_fill => [310, 188]
|
13
13
|
end
|
14
14
|
|
15
15
|
def store_dir
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render_show_property(property) %>
|
@@ -22,7 +22,7 @@
|
|
22
22
|
|
23
23
|
</div>
|
24
24
|
</div>
|
25
|
-
<div id="gallery_block"><%= lh_render_gallery4(@vparams[:galleries]) %></div>
|
25
|
+
<div id="gallery_block" class="hidden"><%= lh_render_gallery4(@vparams[:galleries]) %></div>
|
26
26
|
</div>
|
27
27
|
|
28
28
|
<div id="price_info hidden" class="clearfix">
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<%
|
2
|
+
item_title = @item.title
|
3
|
+
%>
|
4
|
+
|
5
|
+
<h4 class="bold">Общая информация</h4>
|
6
|
+
|
7
|
+
<div class="clearfix">
|
8
|
+
<div id="div_main_show_area" class="clearfix">
|
9
|
+
<%= link_to image_tag('w227x182px.gif',
|
10
|
+
:alt=>item_title,
|
11
|
+
:data => {:original => image_path(@item.main_image_url)},
|
12
|
+
:class => 'lazy'),
|
13
|
+
image_path(@item.main_image_url),
|
14
|
+
:title => item_title,
|
15
|
+
:class => 'lazy-image-wrapper no-outline' %>
|
16
|
+
<div id="main_props">
|
17
|
+
<%= smiph_render_property_props(@item) %>
|
18
|
+
|
19
|
+
<div id="div_vendor_logo">
|
20
|
+
<%# smiph_render_vendor_logo(@item) %>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<div id="div_desc">
|
28
|
+
<%= @item.desc.html_safe if @item.desc.present? %>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div id="div_common_props" class="clearfix">
|
32
|
+
<h4 class="bold">Техническая информация</h4>
|
33
|
+
<%= ph_render_tech_props(@item) %>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<div id="related_items" class="hidden">
|
37
|
+
<%# smiph_render_related_items(@item) %>
|
38
|
+
</div>
|
data/lib/c80_estate/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: c80_estate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.0.
|
4
|
+
version: 0.1.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- C80609A
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -84,7 +84,9 @@ files:
|
|
84
84
|
- app/assets/javascript/c80_estate/backend/admin/shared/areas/_area_show_common.js
|
85
85
|
- app/assets/javascript/c80_estate/backend/admin/shared/areas/area_show.js
|
86
86
|
- app/assets/javascript/c80_estate/backend/admin/shared/areas/gallery3.js
|
87
|
+
- app/assets/javascript/c80_estate/backend/admin/shared/properties/property_show.js
|
87
88
|
- app/assets/javascript/c80_estate/backend/admin/src/areas.js
|
89
|
+
- app/assets/javascript/c80_estate/backend/admin/src/properties.js
|
88
90
|
- app/assets/javascript/c80_estate/backend/admin/src/pstats.js
|
89
91
|
- app/assets/javascript/c80_estate/backend/admin/src/sevents.js
|
90
92
|
- app/assets/javascript/c80_estate/backend/init.js
|
@@ -92,6 +94,7 @@ files:
|
|
92
94
|
- app/assets/javascript/c80_estate/lib/Chart.bundle.js
|
93
95
|
- app/assets/javascript/c80_estate/lib/bootstrap-slider.js
|
94
96
|
- app/assets/javascript/c80_estate/lib/google_charts_loader.js
|
97
|
+
- app/assets/javascript/c80_estate/lib/highstock.js
|
95
98
|
- app/assets/javascript/c80_estate/lib/jalert.js
|
96
99
|
- app/assets/javascript/c80_estate/lib/jquery.canvasjs.min.js
|
97
100
|
- app/assets/javascript/c80_estate/lib/jquery.magnific-popup.js
|
@@ -118,6 +121,7 @@ files:
|
|
118
121
|
- app/assets/stylesheets/c80_estate/backend/shared/areas/stroitelnye_materialy_item/div_price_info.scss
|
119
122
|
- app/assets/stylesheets/c80_estate/backend/shared/areas/stroitelnye_materialy_item/div_related_items.scss
|
120
123
|
- app/assets/stylesheets/c80_estate/backend/shared/areas/stroitelnye_materialy_item/div_vendor_logo.scss
|
124
|
+
- app/assets/stylesheets/c80_estate/backend/shared/index_adds_like_pstats.scss
|
121
125
|
- app/assets/stylesheets/c80_estate/backend/shared/index_adds_like_sevents.scss
|
122
126
|
- app/assets/stylesheets/c80_estate/lib/bootstrap-slider.scss
|
123
127
|
- app/assets/stylesheets/c80_estate/lib/magnific-popup-custom.scss
|
@@ -132,6 +136,7 @@ files:
|
|
132
136
|
- app/controllers/c80_estate/ajax_view_controller.rb
|
133
137
|
- app/helpers/c80_estate/app_helper.rb
|
134
138
|
- app/helpers/c80_estate/areas_helper.rb
|
139
|
+
- app/helpers/c80_estate/properties_helper.rb
|
135
140
|
- app/models/c80_estate/aphoto.rb
|
136
141
|
- app/models/c80_estate/area.rb
|
137
142
|
- app/models/c80_estate/astatus.rb
|
@@ -156,6 +161,7 @@ files:
|
|
156
161
|
- app/views/admin/areas/_show_area.html.erb
|
157
162
|
- app/views/admin/dashboard/_atype_in_list.html.erb
|
158
163
|
- app/views/admin/dashboard/_prop_in_list.html.erb
|
164
|
+
- app/views/admin/properties/_show_property.html.erb
|
159
165
|
- app/views/c80_estate/ajax_areas/exel_import.html.erb
|
160
166
|
- app/views/c80_estate/ajax_areas/exel_import.js.erb
|
161
167
|
- app/views/c80_estate/ajax_view/table_properties_coef_busy.js.erb
|
@@ -165,6 +171,7 @@ files:
|
|
165
171
|
- app/views/c80_estate/shared/_table_properties_coef_busy_sq.html.erb
|
166
172
|
- app/views/c80_estate/shared/areas/_gallery4.html.erb
|
167
173
|
- app/views/c80_estate/shared/areas/_single_area_on_page.html.erb
|
174
|
+
- app/views/c80_estate/shared/properties/_single_property_on_page.html.erb
|
168
175
|
- bin/console
|
169
176
|
- bin/setup
|
170
177
|
- c80_estate.gemspec
|