-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1057 from PlanoramaEvents/development
3.6.0-rc1
- Loading branch information
Showing
60 changed files
with
1,807 additions
and
196 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
class PersonSyncDataController < ResourceController | ||
SERIALIZER_CLASS = 'PersonSyncDatumSerializer'.freeze | ||
POLICY_CLASS = 'PersonSyncDatumPolicy'.freeze | ||
POLICY_SCOPE_CLASS = 'PersonSyncDatumPolicy::Scope'.freeze | ||
DEFAULT_SORTBY = 'name_sort_by' | ||
DEFAULT_ORDER = 'asc'.freeze | ||
|
||
# | ||
# | ||
# | ||
def match | ||
model_class.transaction do | ||
authorize model_class, policy_class: policy_class | ||
|
||
reg_id = params[:reg_id] if params[:reg_id] | ||
person_id = params[:person_id] if params[:person_id] | ||
|
||
# one of 'assisted' or 'manual' | ||
reg_match = params[:reg_match] if params[:reg_match] | ||
|
||
raise "Type of match should be 'assisted' or 'manual' you gave '#{reg_match}'" unless ['assisted', 'manual'].include? reg_match | ||
raise "No reg id, person id, or match type specified" unless reg_id && person_id && reg_match | ||
|
||
# Get the reg sync data | ||
datum = RegistrationSyncDatum.find_by reg_id: reg_id | ||
|
||
# Get the person | ||
person = Person.find person_id | ||
|
||
# Update the person with the reg data | ||
IdentityService.clear_person_reg_info(person: person); | ||
IdentityService.update_reg_info(person: person, details: datum.raw_info, reg_match: reg_match) | ||
|
||
render status: :ok, | ||
json: { message: "Matched" }.to_json, | ||
content_type: 'application/json' | ||
end | ||
end | ||
|
||
# | ||
# Method to dismiss a match | ||
# POST request, parameters are reg_id and person_id | ||
# | ||
def dismiss_match | ||
model_class.transaction do | ||
authorize model_class, policy_class: policy_class | ||
|
||
reg_id = params[:reg_id] if params[:reg_id] | ||
person_id = params[:person_id] if params[:person_id] | ||
|
||
raise "No reg id or person id specified" unless reg_id && person_id | ||
|
||
existing = DismissedRegSyncMatch.find_by reg_id: reg_id, person_id: person_id | ||
|
||
if !existing | ||
DismissedRegSyncMatch.create!({ | ||
reg_id: reg_id, | ||
person_id: person_id | ||
}) | ||
end | ||
|
||
render status: :ok, | ||
json: { message: "Dismissed Match" }.to_json, | ||
content_type: 'application/json' | ||
end | ||
end | ||
|
||
# by default get the data that is not already mapped to a person | ||
def default_scope(query: nil) | ||
return nil unless query | ||
|
||
# People that have a potential mapping and not already mapped | ||
query.joins(:registration_sync_data) | ||
.where('people.reg_id is null') | ||
.where('registration_sync_data.reg_id in (select reg_id from registration_map_counts)') | ||
end | ||
|
||
def select_fields | ||
PersonSyncDatum.select( | ||
::PersonSyncDatum.arel_table[Arel.star], | ||
'name_sort_by' | ||
) | ||
end | ||
|
||
def serializer_includes | ||
[ | ||
:registration_sync_data | ||
] | ||
end | ||
|
||
def make_distinct? | ||
true | ||
end | ||
|
||
def includes | ||
[ | ||
:email_addresses, | ||
:registration_sync_data | ||
] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
class RegistrationSyncDataController < ResourceController | ||
SERIALIZER_CLASS = 'RegistrationSyncDatumSerializer'.freeze | ||
POLICY_CLASS = 'RegistrationSyncDatumPolicy'.freeze | ||
POLICY_SCOPE_CLASS = 'RegistrationSyncDatumPolicy::Scope'.freeze | ||
DEFAULT_SORTBY = 'registration_sync_data.name' | ||
DEFAULT_ORDER = 'asc'.freeze | ||
|
||
def sync_statistics | ||
authorize current_person, policy_class: policy_class | ||
status = RegistrationSyncStatus.order('created_at desc').first | ||
|
||
result = status ? status.result : {} | ||
|
||
render status: :ok, json: result.to_json, content_type: 'application/json' | ||
end | ||
|
||
def synchronize | ||
authorize current_person, policy_class: policy_class | ||
|
||
status = RegistrationSyncStatus.order('created_at desc').first | ||
status = RegistrationSyncStatus.new if status == nil | ||
if status.status != 'inprogress' | ||
status.status = 'inprogress' | ||
status.save! | ||
|
||
RegistrationSyncWorker.perform_async | ||
end | ||
|
||
render status: :ok, json: {}.to_json, content_type: 'application/json' | ||
end | ||
|
||
def people | ||
authorize model_class, policy_class: policy_class | ||
datum = RegistrationSyncDatum.find params[:registration_sync_datum_id] | ||
|
||
people = datum.people | ||
options = { | ||
params: { | ||
domain: "#{request.base_url}", | ||
current_person: current_person | ||
} | ||
} | ||
|
||
# return the list of people associated with this datum | ||
render json: PersonSerializer.new(people,options).serializable_hash(), | ||
content_type: 'application/json' | ||
end | ||
|
||
def serializer_includes | ||
[ | ||
:matched_person | ||
] | ||
end | ||
|
||
# # by default get the data that is not already mapped to a person | ||
# def default_scope(query: nil) | ||
# return nil unless query | ||
|
||
# # People that have a potential mapping and not already mapped | ||
# query.where('reg_id not in (select reg_id from people where reg_id is not null)') | ||
# .where('reg_id in (select reg_id from registration_map_counts)') | ||
# end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<template> | ||
<div class="container-fluid scrollable"> | ||
<h1>Registration Sync Management</h1> | ||
<b-button variant="primary" size="sm" v-b-modal.confirm-reg-sync>Registration Synchronize</b-button> | ||
<!-- --> | ||
<!-- <h2>Registration Info (from Reg/clyde)</h2> --> | ||
<person-sync-table></person-sync-table> | ||
|
||
<!-- --> | ||
<plano-modal id="confirm-reg-sync" @ok="synchronizeSchedule()"> | ||
<template #modal-title>Synchonize Registration Info</template> | ||
</plano-modal> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import PlanoModal from '@/components/plano_modal.vue'; | ||
import { toastMixin } from '@/mixins'; | ||
import { http } from '@/http'; | ||
import PersonSyncTable from "@/registrations/person_sync_table.vue" | ||
export default { | ||
name: "AdminRegistrations", | ||
components: { | ||
PlanoModal, | ||
PersonSyncTable | ||
}, | ||
mixins: [ | ||
toastMixin | ||
], | ||
methods: { | ||
synchronizeSchedule() { | ||
this.toastPromise(http.get('/registration_sync_data/synchronize'), "Succesfully requested registration sync") | ||
}, | ||
}, | ||
} | ||
</script> | ||
|
||
<style> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.