Skip to content

Commit

Permalink
Merge pull request #1137 from PlanoramaEvents/staging
Browse files Browse the repository at this point in the history
v3.7.1
  • Loading branch information
balen authored Jul 19, 2024
2 parents 609bb3c + 58fae01 commit 3c1c769
Show file tree
Hide file tree
Showing 56 changed files with 1,181 additions and 177 deletions.
4 changes: 2 additions & 2 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ def application_time_zone(&block)

def check_up
if ScheduleSnapshot.where("status = 'in_progress'").count > 0
redirect_to '/maintenance.html', status: 503
redirect_to '/maintenance.html', status: 307
end
# Stop people from making changes if we are running any long job
if JobStatus.where("status = 'inprogress'").count > 0
redirect_to '/maintenance.html', status: 503
redirect_to '/maintenance.html', status: 307
end
end

Expand Down
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
36 changes: 26 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,8 @@ 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)')
# exclude people with no registration_sync_data and/or matched
query.where('people.reg_id is null and people.id in (select pid from filtered_registration_sync_matches)')
end

def select_fields
Expand All @@ -88,14 +99,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
16 changes: 13 additions & 3 deletions app/javascript/administration/help_link.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<template>
<div>
<b-button variant="link" class="text-light" v-b-modal.help-modal>Help</b-button>
<b-modal id="help-modal" title="Help" modal-class="help-modal" ok-only>
<b-button v-if="!mobile" variant="link" class="text-light" v-b-modal="modalId">Help</b-button>
<b-nav-item v-if="mobile" v-b-modal="modalId"><b-icon-question-circle class="mr-2"></b-icon-question-circle>Help</b-nav-item>
<b-modal :id="modalId" title="Help" modal-class="help-modal" ok-only>
<p>If you need help, you can email <br />
<a :href="mailto" target="_blank">{{email}}</a>
<a :href="mailto" target="_blank">{{email}}</a>.
<!-- <span v-if="phone"><br />or call {{phone}}</span>.-->
</p>
</b-modal>
Expand All @@ -12,10 +13,19 @@

<script>
import settingsMixin from "@/store/settings.mixin";
import {v4 as uuidv4 } from 'uuid';
export default {
name: "HelpLink",
props: {
mobile: {
default: false
}
},
mixins: [settingsMixin],
data: () => ({
modalId: uuidv4()
}),
computed: {
email() {
return this.configByName('email_reply_to_address')
Expand Down
5 changes: 4 additions & 1 deletion app/javascript/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<div class="container-fluid">
<sign-agreements ref="agreement-signer"></sign-agreements>
<div class="row">
<mobile-navbar></mobile-navbar>
<top-navbar></top-navbar>
<side-navbar v-if="loggedIn && hasPassword"></side-navbar>
<div :class="['col-12 pr-0', { 'col-sm-10': (loggedIn && hasPassword), 'col-xl-10': (loggedIn && hasPassword )}]">
Expand All @@ -18,6 +19,7 @@
import 'vue-cal/dist/drag-and-drop.js'
import TopNavbar from "./navbar/top-navbar.vue";
import MobileNavbar from "./navbar/mobile-navbar.vue";
import SideNavbar from "./navbar/side-navbar.vue";
import BottomNavbar from "./navbar/bottom-navbar.vue";
import personSessionMixin from "./auth/person_session.mixin";
Expand All @@ -38,7 +40,8 @@ export default {
TopNavbar,
SideNavbar,
BottomNavbar,
SignAgreements
SignAgreements,
MobileNavbar,
},
mixins: [personSessionMixin, settingsMixin],
data() {
Expand Down
6 changes: 3 additions & 3 deletions app/javascript/auth/person_session.mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ export const personSessionMixin = {
return !!this.currentUser.has_password
},
currentUserIsAdmin() {
return !!Object.values(this.currentUser.convention_roles).find(r => r.role === "admin")
return !!Object.values(this.currentUser?.convention_roles ?? {}).find(r => r.role === "admin")
},
currentUserIsStaff() {
return !!Object.values(this.currentUser.convention_roles).find(r => r.role === "staff")
return !!Object.values(this.currentUser?.convention_roles ?? {}).find(r => r.role === "staff")
},
currentUserIsParticipant() {
return !!Object.values(this.currentUser.convention_roles).find(r => r.role === "participant")
return !!Object.values(this.currentUser?.convention_roles ?? {}).find(r => r.role === "participant")
},
currentUserEmail() {
return this.currentUser.primary_email?.email || '';
Expand Down
21 changes: 16 additions & 5 deletions app/javascript/components/combo_box.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
<b-form-select
v-model="selectedOption"
@change="onChange"
v-bind:options="filtered_options"
v-bind:select-size="selectSize"
:options="filtered_options"
:select-size="selectSize"
class="mt-1"
></b-form-select>
</b-overlay>
Expand All @@ -30,18 +30,29 @@ export default {
loading: {
type: Boolean,
default: false
}
},
value: {}
},
data: () => ({
selectedOption: null,
selectedOptionInternal: null,
term: null
}),
methods: {
onChange(arg) {
this.$emit('change', arg)
this.$emit('change', arg);
}
},
computed: {
selectedOption: {
get() {
return this.value ?? this.selectedOptionInternal;
},
set(val) {
this.selectedOptionInternal = val;
this.$emit('input', val);
}
},
filtered_options() {
return this.options.filter(
obj => ((this.term == null) || (this.term === "") || obj.text.toLowerCase().includes(this.term.toLowerCase()))
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
Loading

0 comments on commit 3c1c769

Please sign in to comment.