Skip to content

Commit

Permalink
Merge pull request #1125 from PlanoramaEvents/development
Browse files Browse the repository at this point in the history
3.7.1-rc1
  • Loading branch information
balen authored Jul 15, 2024
2 parents acf6787 + 486ed7f commit 7510f7a
Show file tree
Hide file tree
Showing 43 changed files with 866 additions and 104 deletions.
34 changes: 22 additions & 12 deletions app/controllers/concerns/resource_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -261,19 +261,8 @@ def collection
# Rails.logger.debug "****************************"
# Rails.logger.debug "****************************"

# TODO we need the size without the query
if paginated
fq = policy_scope(base, policy_scope_class: policy_scope_class)
if default_scope(query: fq)
fq = default_scope(query: fq)
end
@full_collection_total = fq.where(exclude_deleted_clause)
.includes(includes)
.references(references)
.eager_load(eager_load)
.joins(join_tables)
.distinct
.count
@full_collection_total = collection_total
instance_variable_set("@#{controller_name}", @full_collection_total)
end

Expand All @@ -284,6 +273,27 @@ def collection
end
end

def collection_total
base = if belong_to_class && belongs_to_param_id
parent = belong_to_class.find belongs_to_param_id
parent.send(belongs_to_relationship)
else
model_class
end

fq = policy_scope(base, policy_scope_class: policy_scope_class)
if default_scope(query: fq)
fq = default_scope(query: fq)
end
fq.where(exclude_deleted_clause)
.includes(includes)
.references(references)
.eager_load(eager_load)
.joins(join_tables)
.distinct
.count
end

def query(filters = nil)
# Go through the filter and construct the where clause
deleted_clause = exclude_deleted_clause
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/people_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,8 @@ def serializer_includes
[
:email_addresses,
:convention_roles,
:person_schedule_approvals
:person_schedule_approvals,
:session_limits
]
end

Expand Down
37 changes: 27 additions & 10 deletions app/controllers/person_sync_data_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,18 @@ class PersonSyncDataController < ResourceController
SERIALIZER_CLASS = 'PersonSyncDatumSerializer'.freeze
POLICY_CLASS = 'PersonSyncDatumPolicy'.freeze
POLICY_SCOPE_CLASS = 'PersonSyncDatumPolicy::Scope'.freeze
DEFAULT_SORTBY = 'name_sort_by'
DEFAULT_SORTBY = 'people.name_sort_by'
DEFAULT_ORDER = 'asc'.freeze

#
def possible_match_count
authorize model_class, policy_class: policy_class

render status: :ok,
json: { total: collection_total }.to_json,
content_type: 'application/json'
end

#
#
#
Expand All @@ -30,7 +39,7 @@ def match
# 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'
Expand All @@ -57,6 +66,10 @@ def dismiss_match
reg_id: reg_id,
person_id: person_id
})

# We need to refresh the view on match
# this can take a few seconds
MigrationHelpers::PlanoViews.refresh_registration_sync_matches
end

render status: :ok,
Expand All @@ -69,10 +82,9 @@ def dismiss_match
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)')
# TODO: exclude people with no registration_sync_data

query.where('people.reg_id is null and people.id in (select pid from registration_sync_matches)')
end

def select_fields
Expand All @@ -88,14 +100,19 @@ def serializer_includes
]
end

def make_distinct?
true
# def make_distinct?
# true
# end

def references
[
:primary_email
]
end

def includes
[
:email_addresses,
:registration_sync_data
:primary_email
]
end
end
1 change: 1 addition & 0 deletions app/controllers/registration_sync_data_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def sync_statistics
status = RegistrationSyncStatus.order('created_at desc').first

result = status ? status.result : {}
result[:updated_at] = status&.updated_at;

render status: :ok, json: result.to_json, content_type: 'application/json'
end
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/reports/people_reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def mis_matched_envs
.joins(:person)
.where(
%q(case
when (person_schedules.environment = 'in_person') then (people.attendance_type != 'in person' and people.attendance_type != 'hybrid')
when (person_schedules.environment = 'hybrid') then (people.attendance_type != 'in person' and people.attendance_type != 'hybrid')
when (person_schedules.environment = 'in_person') then (people.attendance_type != 'in_person' and people.attendance_type != 'hybrid')
when (person_schedules.environment = 'hybrid') then (people.attendance_type != 'in_person' and people.attendance_type != 'hybrid')
when (person_schedules.environment = 'virtual') then (people.attendance_type != 'virtual' and people.attendance_type != 'hybrid')
end
)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/reports/program_ops_reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def back_of_badge
grouped.each do |assignment|
title = assignment.session.short_title || assignment.session.title
row.concat [
title,
assignment.session.title,
title.truncate(30),
assignment.session.start_time ? FastExcel.date_num(assignment.session.start_time, assignment.session.start_time.in_time_zone.utc_offset) : nil,
"#{assignment.session.duration}m",
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/reports/session_reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def non_accepted_on_schedule

people_sessions = SessionService.person_schedule
.where("session_assignment_name in ('Moderator', 'Participant', 'Invisible')")
.where("con_state not in ('not_set', 'accepted')")
.where("con_state not in ('accepted')")
.where("start_time is not null and room_id is not null")
.order('name', 'start_time', 'title')

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/settings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def index
],
attendance_type: [
{
value: 'in person',
value: 'in_person',
label: "In-person only: I am planning to attend #{convention_name} in-person"
}, {
value: 'virtual',
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/components/icon_button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
v-b-modal="modal"
>
<slot v-bind="{variant: iconVariant, disabled}">
<b-icon v-if="icon" :icon="icon" :variant="iconVariant" :class="{'text-muted': disabled}"></b-icon>
<b-icon v-if="icon" :icon="icon" :variant="iconVariant" :class="{'text-muted': disabled && computedVariant === 'link'}"></b-icon>
</slot>
</b-button>
</span>
Expand Down
14 changes: 11 additions & 3 deletions app/javascript/components/magical_reload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,23 @@ export default {
label: {
type: String,
default: "Last reloaded at"
}
},
reloadAction: { }
},
computed: {
...mapState(['reloadedAt'])
},
methods: {
...mapMutations({
reload: MAGICAL_RELOAD
})
magicalReload: MAGICAL_RELOAD
}),
reload() {
if (this.reloadAction) {
this.reloadAction();
} else {
this.magicalReload();
}
}
}
}
</script>
Expand Down
15 changes: 12 additions & 3 deletions app/javascript/components/table_vue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
</div>

<div class="d-flex align-items-center">
<slot name="left-controls" v-bind:editableIds="editableIds"></slot>
<slot name="left-controls" v-bind:editableIds="editableIds" v-bind:total="fullTotalRows"></slot>
<b-pagination
class="mb-0 mr-3 ml-auto"
v-model="currentPage"
Expand All @@ -79,6 +79,7 @@
</div>
<b-table
hover bordered responsive selectable small striped
:sticky-header="stickyHeader"
:fields="tableColumns"
selected-variant="primary"
:select-mode="useSelectMode"
Expand Down Expand Up @@ -129,11 +130,12 @@
</template>
</b-table>

<div class="d-flex mb-1">
<div class="d-flex mb-1" v-if="showBottomControls">
<span v-if="totalRows != fullTotalRows">Search Results: {{totalRows}}</span>
<span class="ml-auto">{{countCaption}}</span>
</div>
<b-pagination class="d-flex justify-content-end"
v-if="showBottomControls"
v-model="currentPage"
:total-rows="totalRows"
:per-page="perPage"
Expand All @@ -142,7 +144,7 @@
prev-text="Prev"
next-text="Next"
></b-pagination>
<div class="d-flex justify-content-end">
<div class="d-flex justify-content-end" v-if="showBottomControls">
<b-form-group label="Number of Records" label-cols="auto" class="mb-0">
<b-form-select :options="[10, 20, 50]" v-model="perPage"></b-form-select>
</b-form-group>
Expand Down Expand Up @@ -201,6 +203,13 @@ export default {
stateName: {
type: String,
default: null
},
stickyHeader: {
default: false
},
showBottomControls: {
type: Boolean,
default: true
}
},
data () {
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/constants/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ module.exports = {
rejected: "Rejected"
},
PERSON_ATTENDANCE_TYPE: {
'in person': "In Person",
in_person: "In Person",
hybrid: "In Person AND Online",
virtual: "Online",
},
Expand Down
32 changes: 25 additions & 7 deletions app/javascript/integrations/clyde_settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,21 @@
<div class="container-fluid">
<div class="row">
<div class="column flex-grow-1">
<h4 class="mt-3 mb-2">Registration Sync Management</h4>
<div class="d-flex justify-content-between m-2">
<b-button variant="primary" size="sm" v-b-modal.confirm-reg-sync>Run Registration Data Sync</b-button>
<reg-sync-modal></reg-sync-modal>
</div>
<ul class="list-unstyled ml-2 mb-2">
<li>Last completed full sync: {{ lastSync }}</li>
<li>Records matched: {{ stats.matched }}</li>
<li>Records updated: {{ stats.updated }}</li>
<li>Records not found: {{ stats.not_found }}</li>
</ul>
<h4 class="mt-3">Configuration</h4>
<b-form-group label-cols="auto" label="Enable Clyde" class="configuration enable">
<b-form-group label-cols="auto" label="Enable Clyde" class="configuration enable ml-2">
<b-form-checkbox switch v-model="clydeEnabled" @change="patchClydeConfig()"></b-form-checkbox>
</b-form-group>
<b-button variant="primary" size="sm" v-b-modal.confirm-reg-sync class="ml-2">Registration Synchronize</b-button>
<b-form-group label-cols="auto" label="Use Clyde as Registration Integration" class="configuration enable ml-2">
<b-form-checkbox switch v-model="clydeRegistration" @change="patchClydeConfig()" :disabled="!clydeEnabled"></b-form-checkbox>
</b-form-group>
Expand All @@ -24,8 +34,8 @@
</div>
</div>
<plano-modal id="confirm-reg-sync" @ok="synchronizeSchedule()">
<template #modal-title>Synchonize Registration Info</template>
This will sync with the Registration system. This will bring the server down for a short time.
<template #modal-title>Run Registration Data Sync</template>
This will sync with the Registration system's data. It will bring the server down for a short time.
Please double check that you wish to perform this action.
</plano-modal>
</div>
Expand All @@ -36,18 +46,26 @@ import { clydeMixin } from './clyde.mixin'
import PlanoModal from '@/components/plano_modal.vue';
import { toastMixin } from '@/mixins';
import { http } from '@/http';
import { registrationSyncStatsMixin} from '@/store/registration_sync_stats.mixin';
import RegSyncModal from './reg-sync-modal.vue';
export default {
name: "ClydeSettings",
mixins: [clydeMixin, toastMixin],
mixins: [clydeMixin, toastMixin, registrationSyncStatsMixin],
components: {
PlanoModal
PlanoModal,
RegSyncModal
},
methods: {
synchronizeSchedule() {
this.toastPromise(http.get('/registration_sync_data/synchronize'), "Succesfully requested registration sync")
this.toastPromise(http.get('/registration_sync_data/synchronize'), "Succesfully requested registration sync").then(() => {
this.fetchStats();
})
},
},
mounted() {
this.fetchStats();
}
}
</script>
Expand Down
Loading

0 comments on commit 7510f7a

Please sign in to comment.