Mostly enriching supplier's user info with number of lists finished at the restaurant

This commit is contained in:
2020-03-06 19:27:44 -05:00
parent f1ef618dae
commit eda3fc280b
7 changed files with 66 additions and 8 deletions
+3 -1
View File
@@ -1,6 +1,7 @@
class User
include SimplyStored::Couch
include ActiveModel::SerializerSupport
attr_accessor :number_of_lists_at_supplier
property :name
property :active_list_id
@@ -93,7 +94,8 @@ class User
# This is the user name as it is shown to the supplier
def supplier_name
auth_data['info']['name'] rescue I18n.t('supplier.user.unknown_name')
name = auth_data.try(:[], 'info').try(:[], 'name')
name || email.to_s.sub(/@.*/, '')
end
# This is the user name as it is shown to other users