Skip to content

Commit

Permalink
Showing 7 changed files with 39 additions and 26 deletions.
3 changes: 1 addition & 2 deletions app/javascript/people/people_admin_tab.vue
Original file line number Diff line number Diff line change
@@ -8,8 +8,7 @@
<dd class="font-italic ml-2">{{selected.registered ? 'Yes' : 'No'}}</dd>
<dt>Registration ID</dt>
<dd class="font-italic ml-2">{{selected.registration_number || 'Unknown'}}</dd>
<!-- TODO: resyn button removed until verify process PLAN-975 -->
<!-- <b-button @click="resyncPerson" variant="primary" :disabled="selected.reg_id == null">Resync Registration</b-button> -->
<b-button @click="resyncPerson" variant="primary" :disabled="selected.reg_id == null">Resync Registration</b-button>
</div>
<div class="col-12 col-sm-6 col-lg-4">
<dt>Convention Class</dt>
1 change: 1 addition & 0 deletions app/models/person.rb
Original file line number Diff line number Diff line change
@@ -66,6 +66,7 @@
# published_name :string
# published_name_sort_by :string
# reddit :string
# reg_attending_status :string
# registered :boolean default(FALSE), not null
# registration_number :string
# registration_type :string
5 changes: 4 additions & 1 deletion app/serializers/person_serializer.rb
Original file line number Diff line number Diff line change
@@ -66,6 +66,7 @@
# published_name :string
# published_name_sort_by :string
# reddit :string
# reg_attending_status :string
# registered :boolean default(FALSE), not null
# registration_number :string
# registration_type :string
@@ -148,7 +149,9 @@ class PersonSerializer #< ActiveModel::Serializer
:excluded_demographic_categories,
:global_diaspora,
:non_anglophone,
:reg_id
:reg_id,
:reg_attending_status,
:date_reg_synced

# status and comments hidden except for staff
protected_attributes :con_state, :comments
44 changes: 23 additions & 21 deletions app/services/identity_service.rb
Original file line number Diff line number Diff line change
@@ -105,22 +105,32 @@ def self.clear_person_reg_info(person:)
person.registration_type = nil
person.registered = false
person.registration_number = nil
person.reg_attending_status = nil
person.date_reg_synced = Time.now
end

def self.update_reg_info(person:, details:)
person.registration_number = details['ticket_number']
# Based on the products that they have
person.registration_type = details['product']
person.reg_id = details['id']
person.registered = true
# Need to store time of last sync
person.date_reg_synced = Time.now
# Attendance type in Plano is one of
# in_person, hybrid, virtual
# Clyde does not map to these well. Recommend that we get this from survey and Person profile
# in Plano instead.
# person.attendance_type =
# If the Ticket Numbers do not match then we reset cause there may be an issue
if person.registration_number && person.registration_number != details['ticket_number']
clear_person_reg_info(person: person)
# If the Reg numbers do not match then we reset cause there may be an issue
elsif person.reg_id && person.reg_id != details['id']
clear_person_reg_info(person: person)
else
person.reg_id = details['id'] unless person.reg_id
person.registration_number = details['ticket_number'] unless person.registration_number
# Based on the products that they have
person.registration_type = details['product']
person.registered = details['attending_status'] != 'Not Attending'
person.reg_attending_status = details['attending_status']
# Need to store time of last sync
person.date_reg_synced = Time.now
# Attendance type in Plano is one of
# in_person, hybrid, virtual
# Clyde does not map to these well. Recommend that we get this from survey and Person profile
# in Plano instead.
# person.attendance_type =
end
person.save!
end

@@ -154,15 +164,7 @@ def self.create_identity_from_clyde(details:)
identity.save!
end

# Attending status does not map well - we will need Plano to ask
# person.attendance_type = details[:attending_status]

person.registration_number = details['ticket_number']
# TODO: we need to base this on the products that they have
# which requires a change to the Clyde API to get the products for the person
# person.registration_type = details[:product]
# person.registered = true
person.save!
update_reg_info(person: person, details: details)

identity
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddRegAttendingStatusToPerson < ActiveRecord::Migration[6.1]
def change
add_column :people, :reg_attending_status, :string, default: nil
end
end
6 changes: 4 additions & 2 deletions db/structure.sql
Original file line number Diff line number Diff line change
@@ -666,7 +666,8 @@ END) STORED,
global_diaspora character varying,
non_anglophone character varying,
fediverse character varying,
bsky character varying
bsky character varying,
reg_attending_status character varying
);


@@ -3849,6 +3850,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20240223134703'),
('20240226191153'),
('20240303213410'),
('20240423130325');
('20240423130325'),
('20240429160250');


1 change: 1 addition & 0 deletions spec/models/person_spec.rb
Original file line number Diff line number Diff line change
@@ -66,6 +66,7 @@
# published_name :string
# published_name_sort_by :string
# reddit :string
# reg_attending_status :string
# registered :boolean default(FALSE), not null
# registration_number :string
# registration_type :string

0 comments on commit bf30f6c

Please sign in to comment.