c80_estate 0.1.0.28 → 0.1.0.29

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d08645faa1d97b3ac9cbafa6cf68655e4a5108b8
4
- data.tar.gz: c79aa2d2f76e257f79f5f9ff8c7490edb0a92916
3
+ metadata.gz: 369b7eee549a751f657741e22a0101841b37be5d
4
+ data.tar.gz: 31ff7efbc1e816261f8ce438dadc70f9fd0ba618
5
5
  SHA512:
6
- metadata.gz: 605ecc95640a510e7d1aa29b72d427319d5c0e1403d46556f317d2382b22548a7f3a21a4bdb8321051e7622fd52c1e51593c359cef01bde6b18fabb311844eec
7
- data.tar.gz: 3eaac5d2ce9e94f2ee5a859f0337ad8cb39c1cf5f39d189b014b4c8bc8516e8191783caec451ef326a57c93d618b29ff1e6a7b74019710081dae8d0463816d35
6
+ metadata.gz: a1e91158b43738a18a46649ab4ab68a8561eb052a5d9029742b46edd9e56863fdce616e832f2adc25f7b67daaded7810d41890c0a3a78dd29368ec8c58a53e2b
7
+ data.tar.gz: b9dfc87f7f2811c4aaa01efcf7241b429512bc382d2b56788dac3c334ffa2f394585eeeac1235bc7f642a84c21f901fdf5c926f7f9ef68b4b62cf97eec0ee6f1
@@ -192,7 +192,7 @@ ActiveAdmin.register C80Estate::Area, as: 'Area' do
192
192
  f.input :atype, :input_html => {:class => 'selectpicker', 'data-size' => "10", 'data-width' => '400px'}
193
193
  f.input :property,
194
194
  :input_html => {:class => 'selectpicker', 'data-size' => "10", 'data-width' => '400px'},
195
- :collection => C80Estate::Property.where(:assigned_person_id => current_admin_user.id).map { |p| ["#{p.title}", p.id] }
195
+ :collection => C80Estate::Property.where_assig_user(current_admin_user).map { |p| ["#{p.title}", p.id] }
196
196
  # f.input :assigned_person,
197
197
  # :input_html => {:class => 'selectpicker', 'data-size' => "10", 'data-width' => '400px'},
198
198
  # :collection => AdminUser.all.map { |u| ["#{u.email}", u.id] }
@@ -27,7 +27,7 @@ module C80Estate
27
27
  list << {
28
28
  id: prop.id,
29
29
  title: prop.title,
30
- busy_coef: busy_coef,
30
+ busy_coef: "#{busy_coef.to_s(:rounded, :precision => 2)} %",
31
31
  props: {
32
32
  all_areas: pstat.free_areas + pstat.busy_areas,
33
33
  free_areas: pstat.free_areas,
@@ -68,11 +68,11 @@ module C80Estate
68
68
  list << {
69
69
  id: prop.id,
70
70
  title: prop.title,
71
- busy_coef: busy_coef,
71
+ busy_coef: "#{busy_coef.to_s(:rounded, :precision => 2)} %",
72
72
  props: {
73
73
  all_areas_sq: pstat.free_areas_sq + pstat.busy_areas_sq,
74
- free_areas: pstat.free_areas_sq,
75
- busy_areas: pstat.busy_areas_sq
74
+ free_areas_sq: pstat.free_areas_sq.to_s(:rounded, :precision => 2),
75
+ busy_areas_sq: pstat.busy_areas_sq.to_s(:rounded, :precision => 2)
76
76
  }
77
77
  }
78
78
  # Rails.logger.debug "<render_table_prop_busy_coef> #{prop.title}"
@@ -88,6 +88,18 @@ module C80Estate
88
88
  res
89
89
  end
90
90
 
91
+ # для селекта формы админки Area выдать
92
+ # список объектов, на которые назначен пользователь
93
+ # если юзер - админ - ему выдаются все объекты
94
+ def self.where_assig_user(user)
95
+ if user.can_create_properties?
96
+ C80Estate::Property.all
97
+ else
98
+ C80Estate::Property.where(:assigned_person_id => current_admin_user.id)
99
+ end
100
+
101
+ end
102
+
91
103
  def average_price(atype_id: nil)
92
104
 
93
105
  if atype_id.nil?
@@ -1,3 +1,3 @@
1
1
  module C80Estate
2
- VERSION = '0.1.0.28'
2
+ VERSION = '0.1.0.29'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: c80_estate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.28
4
+ version: 0.1.0.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - C80609A