usman 0.3.18 → 0.3.19

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: 076a740cbbeceed3d42f5a97aaded1d79e3c3cf5
4
- data.tar.gz: 45f412aac527ee657b4a5275403276c48c2d0131
3
+ metadata.gz: 6c48cc7bd8d51aa2b31f2bac8cb4469bde5874ed
4
+ data.tar.gz: eaf3b0f77a1a4372aebbf3335d9ee1109ff42e62
5
5
  SHA512:
6
- metadata.gz: 92026e5fd7464c56f0c543a35ba43afa8cbe662141de0cce623879312e7645286952651f0bbc1c1533ba38e60e7a272221b1666dcc8ebe162d307c5a86f9b570
7
- data.tar.gz: 0456d1af306614d22cc0ca6b4f23ecf5aed14f514ee4a226557a31da4c5936d31ba030c51386caedac657dfa8835365ab01c0dd40b6d5154e3029ead50a16370
6
+ metadata.gz: ff9b9ebdaf521b43a9c3da93ff6788c81d561dd8e205e38f99ca1366b979c833c7a58d3ac469069e74f22ac11d7dcb5bade6bcf8c7a8254cde45b91070f033bd
7
+ data.tar.gz: 462bde7386a76c363f42a524af88e796e4246f9b6ea81d21730db14534cb5cad7c62afebdc77f67f4529ec2425a54bf00e278046d78a6853453a8027765f6437
@@ -30,8 +30,8 @@ module Usman
30
30
  @user.approve!
31
31
  @current_registration.user = @user
32
32
 
33
- @current_registration.country = @country if @country
34
- @current_registration.city = @city if @city
33
+ @user.country = @country if @country
34
+ @user.city = @city if @city
35
35
 
36
36
  @current_registration.save
37
37
 
@@ -111,8 +111,8 @@ module Usman
111
111
  @user.dummy = false
112
112
  @user.save
113
113
 
114
- @current_registration.country = @country if @country
115
- @current_registration.city = @city if @city
114
+ @user.country = @country if @country
115
+ @user.city = @city if @city
116
116
 
117
117
  @current_registration.save
118
118
 
data/app/models/user.rb CHANGED
@@ -63,6 +63,8 @@ class User < Usman::ApplicationRecord
63
63
  has_many :devices
64
64
  has_one :registration
65
65
  has_and_belongs_to_many :roles
66
+ belongs_to :country, optional: true
67
+ belongs_to :city, optional: true
66
68
 
67
69
 
68
70
  # ------------------
@@ -1,6 +1,6 @@
1
1
  class ProfileSerializer < ActiveModel::Serializer
2
2
  include NullAttributeReplacer
3
- attributes :id, :name, :gender, :date_of_birth, :username, :email, :phone, :dummy
3
+ attributes :id, :name, :gender, :date_of_birth, :username, :email, :phone, :dummy, :country_id, :city_id
4
4
 
5
5
  has_one :profile_picture, class_name: "Image::ProfilePicture", serializer: ProfilePictureSerializer do
6
6
  if object.profile_picture
@@ -120,7 +120,7 @@
120
120
 
121
121
  <tr>
122
122
  <th>Name</th><td><%= @user.name %></td>
123
- <th>Username</th><td><%= @user.username %></td>
123
+ <th>Username</th><td><%= @user.username %></td>
124
124
  </tr>
125
125
 
126
126
  <tr>
@@ -128,6 +128,11 @@
128
128
  <th>Phone</th><td><%= @user.phone %></td>
129
129
  </tr>
130
130
 
131
+ <tr>
132
+ <th>City</th><td><%= @user.city.try(:display_name) %></td>
133
+ <th>Country</th><td><%= @user.country.try(:display_name) %></td>
134
+ </tr>
135
+
131
136
  <tr>
132
137
  <th>Gender</th><td><%= @user.gender %></td>
133
138
  <th>Date of Birth</th><td><%= @user.date_of_birth.strftime("%m/%d/%Y") if @user.date_of_birth %></td>
@@ -0,0 +1,14 @@
1
+ class AddCountryCityToUsers < ActiveRecord::Migration[5.1]
2
+ def change
3
+ add_column :users, :country_id, :integer
4
+ add_column :users, :city_id, :integer
5
+ Registration.in_batches.each do |relation|
6
+ relation.all.each do |reg|
7
+ user = reg.user
8
+ user.country_id = reg.country_id
9
+ user.city_id = reg.city_id
10
+ user.save
11
+ end
12
+ end
13
+ end
14
+ end
data/lib/usman/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Usman
2
- VERSION = '0.3.18'
2
+ VERSION = '0.3.19'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.18
4
+ version: 0.3.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - kpvarma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-14 00:00:00.000000000 Z
11
+ date: 2017-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -576,6 +576,7 @@ files:
576
576
  - db/migrate/20170929083233_add_dummy_to_users.rb
577
577
  - db/migrate/20170929083234_add_categorisable_to_features.rb
578
578
  - db/migrate/20170929083235_change_disabled_to_removed_features.rb
579
+ - db/migrate/20170929083236_add_country_city_to_users.rb
579
580
  - lib/tasks/usman/data.rake
580
581
  - lib/tasks/usman/master_data.rake
581
582
  - lib/temp/features.rake