Skip to content

Commit

Permalink
Merge pull request #510 from ChicagoWorldcon/staging
Browse files Browse the repository at this point in the history
1.6.2
  • Loading branch information
balen authored Jul 28, 2022
2 parents df0df08 + 6997d56 commit cdf4f55
Show file tree
Hide file tree
Showing 32 changed files with 767 additions and 255 deletions.
13 changes: 13 additions & 0 deletions app/controllers/concerns/resource_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@ def query_part(filter:)
if array_col?(col_name: col)
col_table = array_table(col_name: col)
end
if derived_col?(col_name: col)
col_table = derived_table(col_name: col)
end
part = get_query_part(table: col_table, column: col, operation: operation, value: value, top: true, key: key)

if (key.include?('responses.'))
Expand Down Expand Up @@ -450,6 +453,8 @@ def translate_operator(operation:)
:not_in
when 'equals'
:eq
when 'equal'
:eq
when '='
:eq
when 'does not equal'
Expand All @@ -459,12 +464,20 @@ def translate_operator(operation:)
:not_eq
when '!='
:not_eq
when 'is less than'
:lt
when '<'
:lt
when 'is greater than'
:gt
when '>'
:gt
when 'is less than or equal to'
:lteq
when '<='
:lteq
when 'is greater than or equal to'
:gteq
when '>='
:gteq
when 'is'
Expand Down
52 changes: 31 additions & 21 deletions app/controllers/people_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -453,28 +453,38 @@ def approval_query(table:, column:, operation:, value:, label:)
end
end

def derived_col?(col_name:)
return true if col_name == 'session_count'
false
end

# TODO: on create must have at least one email_addresses_attributes
# def join_tables
# joins = nil
#
# # TODO: check if the filter references to session_assignments.person_id
# if @filters
# people = Arel::Table.new(Person.table_name)
# assignments = Arel::Table.new(SessionAssignment.table_name)
# joins = [
# people.create_join(
# assignments,
# people.create_on(
# people[:id].eq(assignments[:person_id])
# ),
# Arel::Nodes::OuterJoin
# )
# ]
# end
#
# joins
# end
def derived_table(col_name:)
return Arel::Table.new('session_counts') if col_name == 'session_count'
false
end

def select_fields
Person.select(
::Person.arel_table[Arel.star],
'session_counts.session_count'
)
end

def join_tables
people = Person.arel_table #Arel::Table.new(Session.table_name)

session_counts = Person.session_counts.as('session_counts')
joins = [
people.create_join(
session_counts,
people.create_on(
session_counts[:person_id].eq(people[:id])
)
)
]

joins
end

def allowed_params
%i[
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,8 @@ def participant_availabilities
person.published_name,
person.con_state,
person.attendance_type,
person.availabilities.order('start_time').collect{|av| "#{av.start_time} to #{av.end_time}" }.join(";\n"),
# TODO: format time ....
person.availabilities.order('start_time').collect{|av| "#{av.start_time.strftime('%Y-%m-%d %H:%M %Z')} to #{av.end_time.strftime('%Y-%m-%d %H:%M %Z')}" }.join(";\n"),
person.session_limits.order('day').collect{|l| "#{l.day ? l.day : 'Global'}: #{l.max_sessions}" }.join(";\n"),
person.exclusions.collect{|e| "#{e.title}"}.join(";\n"),
person.availability_notes
Expand Down
24 changes: 24 additions & 0 deletions app/controllers/schedule_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Produce a schedule suitable for Conclar
class ScheduleController < ApplicationController
skip_before_action :check_up, :authenticate_person!, only: [:index, :participants]

def index
sessions = ReportsService.scheduled_sessions

render json: ActiveModel::Serializer::CollectionSerializer.new(
sessions,
serializer: Conclar::SessionSerializer
),
content_type: 'application/json'
end

def participants
participants = ReportsService.scheduled_people

render json: ActiveModel::Serializer::CollectionSerializer.new(
participants,
serializer: Conclar::ParticipantSerializer
),
content_type: 'application/json'
end
end
3 changes: 2 additions & 1 deletion app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ def before_update
# if time or room have changed removed ignored conflicts
p = _permitted_params(model: object_name, instance: @object)
if (@object.start_time || @object.room_id)
if p[:start_time] != @object.start_time || p[:room_id] != @object.room_id
if (p.has_key?('start_time') && p['start_time'] != @object.start_time) ||
(p.has_key?('room_id') && p['room_id'] != @object.room_id)
# so we remove any ignore conflicts for this session
cids = @object.ignored_session_conflicts.pluck(:conflict_id)
cids += @object.ignored_conflict_sessions.pluck(:conflict_id)
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/settings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ def index
end

settings = {
#
env: Rails.env,
# 1. model information
enums: enums,
# 2. con wide role types for assignments
Expand Down
39 changes: 32 additions & 7 deletions app/javascript/components/email_addresses_editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
<b-button ref="add_email_button" @click="onNew" variant="primary" title="New" class="mt-2" size="sm">
<b-icon-plus></b-icon-plus>
</b-button>
<plano-modal id="primaryEmailConfirm" title="Primary Email Confirmation" @ok="onConfirmOk()" @cancel="onConfirmCancel()" @close="onConfirmCancel()">
<p>You are about to change the primary email address associated with this profile. <strong>This will change the login email used for this account.</strong></p>
<p>Are you sure you wish to make this change?</p>
</plano-modal>
</div>
</template>

Expand All @@ -42,11 +46,13 @@ import EmailAddressEditor from './email_address_editor.vue'
import emailAddressMixin from '../store/email_address.mixin'
import {personSessionMixin} from '@/mixins';
import modelUtilsMixin from "@/store/model_utils.mixin";
import PlanoModal from './plano_modal.vue';
export default {
name: 'EmailAddressesEditor',
components: {
EmailAddressEditor
EmailAddressEditor,
PlanoModal
},
mixins: [
modelUtilsMixin,
Expand All @@ -68,12 +74,11 @@ export default {
default: 'email-addresses-editor'
}
},
data() {
return {
emails: [],
additional: []
}
},
data: () => ({
emails: [],
additional: [],
pendingPrimaryChange: null
}),
computed: {
primary: {
get: function() {
Expand Down Expand Up @@ -102,7 +107,27 @@ export default {
)
}
},
onConfirmCancel() {
this.setLists()
this.pendingPrimaryChange = null;
},
onConfirmOk() {
this.saveEmail(this.pendingPrimaryChange).then(
() => {
this.setLists()
}
).catch((err) => {
console.log("i caught an error", err)
this.setLists()
});
this.pendingPrimaryChange = null;
},
onInput(arg) {
if(arg.isdefault) {
this.$bvModal.show('primaryEmailConfirm')
this.pendingPrimaryChange = arg;
return;
}
if (arg.id) {
this.saveEmail(arg).then(
() => {
Expand Down
17 changes: 15 additions & 2 deletions app/javascript/constants/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,23 @@ module.exports = {
can_record_exceptions: "Recordings excluded topics",
name: "Name",
pseudonym: "Pseudonym",
languages_fluent_in: "Languages spoken"
languages_fluent_in: "Languages spoken",
can_share: "Permission to share email with other Participants"
},
PERSON_SAVE_SUCCESS: "Profile record saved successfully",
PERSON_NEVER_LOGGED_IN: "Never logged in",
PERSON_CON_STATE: {
not_set: "Not Set",
applied: "Applied",
vetted: "Vetted",
wait_list: "Wait List",
invite_pending: "Invite Pending",
invited: "Invited",
probable: "Probable",
accepted: "Accepted",
declined: "Declined",
rejected: "Rejected"
},

SURVEY_REDIRECT: "Unfortunately due to the browser refreshing we have lost any answers you filled in. Please fill the survey out again.",
SURVEY_PUBLIC_NO_EDIT: "You cannot edit a published survey. Close the survey to enable editing.",
Expand Down Expand Up @@ -269,7 +282,7 @@ module.exports = {
SCHEDULE_DRAFT_CONFIRM_MESSAGE: "This will publish a Draft Schedule to all participants, who will see their own sessions. This action is irreversible and will bring the server down for a short time. Please double check that you wish to perform this action.",
SCHEDULE_FIRM_CONFIRM_MESSAGE: "This will publish a Firm Schedule to all participants, who will see their own sessions - live. This action is irreversible. Please double check that you wish to perform this action.",
SCHEDULE_DRAFT_SUCCESS_MESSAGE: "Draft schedule has been published successfully",
SCHEDULE_FIRM_SUCCESS_MESSAGE: "Firm schedule has been published successfully",
SCHEDULE_FIRM_SUCCESS_MESSAGE: "Firm schedule has been published successfully",
SCHEDULE_APPROVAL_FAIL_TO_LOAD: "Couldn't load the approval form. Try again soon.",
// The below is intended to become a way to override defaults in the model mixin easily. Hasn't happened yet though.
SPECIFIC_MODEL_SAVE_SUCCESS: {
Expand Down
Loading

0 comments on commit cdf4f55

Please sign in to comment.