Skip to content

Commit

Permalink
Merge pull request #355 from ChicagoWorldcon/staging
Browse files Browse the repository at this point in the history
1.4.2
  • Loading branch information
balen authored Jul 6, 2022
2 parents bd2e0a3 + 1da3156 commit 17c5828
Show file tree
Hide file tree
Showing 42 changed files with 772 additions and 196 deletions.
Binary file added app/assets/images/p_for_plano.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 11 additions & 28 deletions app/controllers/conflicts/session_conflicts_controller.rb
Original file line number Diff line number Diff line change
@@ -1,36 +1,17 @@
class Conflicts::SessionConflictsController < ApplicationController
respond_to :json

def index
# Add the requested conflict id to the ignored conflicts
def ignore
authorize Conflicts::SessionConflict, policy_class: Conflicts::SessionConflictPolicy

per_page = params[:perPage]&.to_i || Conflicts::SessionConflict.default_per_page
current_page = params[:current_page]&.to_i
IgnoredConflict.transaction do
permitted = params.permit(:conflict_id, :conflict_type)

collection = Conflicts::SessionConflict
.includes([:session,:person,:session_assignment,:room])
.where("session_assignment_name is null or session_assignment_name in ('Moderator', 'Participant', 'Invisible')")
.where("conflict_session_assignment_name is null or conflict_session_assignment_name in ('Moderator', 'Participant', 'Invisible')")
.distinct.page(current_page).per(per_page)

collection_total = collection.total_count
full_collection_total = Conflicts::SessionConflict.distinct.count
ignored = IgnoredConflict.create(permitted)
end

meta = {}
meta[:total] = collection_total
meta[:full_total] = full_collection_total ? full_collection_total : collection_total
meta[:current_page] = current_page if current_page.present?
meta[:perPage] = per_page if per_page.present?

options = {
meta: meta,
params: {
domain: "#{request.base_url}",
current_person: current_person
}
}
render json: Conflicts::SessionConflictSerializer.new(collection,options).serializable_hash(),
content_type: 'application/json'
render status: :ok, json: {}.to_json, content_type: 'application/json'
end

def conflicts_with
Expand All @@ -42,6 +23,7 @@ def conflicts_with
.where("conflict_session_id = ?", session_id)
.where("session_assignment_name is null or session_assignment_name in ('Moderator', 'Participant', 'Invisible')")
.where("conflict_session_assignment_name is null or conflict_session_assignment_name in ('Moderator', 'Participant', 'Invisible')")
.where("session_conflicts.conflict_id not in (select conflict_id from ignored_conflicts)")
.distinct

meta = {}
Expand All @@ -50,7 +32,7 @@ def conflicts_with
options = {
meta: meta,
include: [
# :session
:session
],
params: {
domain: "#{request.base_url}",
Expand All @@ -70,6 +52,7 @@ def conflicts_for
.where("session_id = ?", session_id)
.where("session_assignment_name is null or session_assignment_name in ('Moderator', 'Participant', 'Invisible')")
.where("conflict_session_assignment_name is null or conflict_session_assignment_name in ('Moderator', 'Participant', 'Invisible')")
.where("session_conflicts.conflict_id not in (select conflict_id from ignored_conflicts)")
.distinct

meta = {}
Expand All @@ -78,7 +61,7 @@ def conflicts_for
options = {
meta: meta,
include: [
# :conflict_session
:conflict_session
],
params: {
domain: "#{request.base_url}",
Expand Down
12 changes: 6 additions & 6 deletions app/controllers/reports/conflict_reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def multiple_sessions_in_room
room_conflicts = Conflicts::RoomConflict
.includes(:room)
.references(:room)
.where("room_conflicts.back_to_back = false")
.order('rooms.name, start_time')

workbook = FastExcel.open(constant_memory: true)
Expand Down Expand Up @@ -68,6 +69,7 @@ def person_exclusion_conflicts
:person, :session, :exclusion, :excluded_session
)
.where("session_assignment_name in ('Moderator', 'Participant', 'Invisible')")
.order('people.published_name asc')

workbook = FastExcel.open(constant_memory: true)
worksheet = workbook.add_worksheet("Person vs Exclusion")
Expand Down Expand Up @@ -232,7 +234,7 @@ def back_to_back_to_back
def back_to_back
authorize SessionAssignment, policy_class: Reports::ConflictReportPolicy

conflicts_table = ::Conflicts::PersonScheduleConflict.arel_table
conflicts_table = ::Conflicts::PersonBackToBack.arel_table
subquery = Session.area_list.as('areas_list')
conflict_subquery = Session.area_list.as('conflict_areas_list')
joins = [
Expand All @@ -252,8 +254,8 @@ def back_to_back
)
]

conflicts = Conflicts::PersonScheduleConflict.select(
Conflicts::PersonScheduleConflict.arel_table[Arel.star],
conflicts = Conflicts::PersonBackToBack.select(
Conflicts::PersonBackToBack.arel_table[Arel.star],
'areas_list.area_list as area_list',
'conflict_areas_list.area_list as conflict_area_list'
)
Expand All @@ -262,7 +264,6 @@ def back_to_back
.joins(joins)
.where("session_assignment_name is null or session_assignment_name in ('Moderator', 'Participant', 'Invisible')")
.where("conflict_session_assignment_name is null or conflict_session_assignment_name in ('Moderator', 'Participant', 'Invisible')")
.where(back_to_back: true)
.order('published_name asc, conflict_start_time asc')

workbook = FastExcel.open(constant_memory: true)
Expand Down Expand Up @@ -347,8 +348,7 @@ def people_double_booked
.joins(joins)
.where("session_assignment_name is null or session_assignment_name in ('Moderator', 'Participant', 'Invisible')")
.where("conflict_session_assignment_name is null or conflict_session_assignment_name in ('Moderator', 'Participant', 'Invisible')")
.where(back_to_back: false)
.order('people.published_name asc, conflict_start_time asc')
.order('people.published_name asc, start_time asc')

workbook = FastExcel.open(constant_memory: true)
worksheet = workbook.add_worksheet("People Double Booked")
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ def allowed_params
status
environment
minors_participation
require_signup
age_restriction_id
room_notes
]
# Tags
# format
Expand Down
6 changes: 4 additions & 2 deletions app/javascript/components/icon_button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
v-b-tooltip.bottom
v-bind="$attrs"
>
<b-icon v-if="icon" :icon="icon" :variant="iconVariant"></b-icon>
<slot v-bind="{variant: iconVariant}">
<b-icon v-if="icon" :icon="icon" :variant="iconVariant"></b-icon>
</slot>
</b-button>
</span>
<b-tooltip :target="spanId" v-if="disabled" placement="bottom">{{disabledTooltip}}</b-tooltip>
Expand Down Expand Up @@ -77,7 +79,7 @@ export default {
styles.pointerEvents = 'none';
}
return styles;
}
},
},
}
</script>
Expand Down
31 changes: 27 additions & 4 deletions app/javascript/components/table_vue.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ export default {
data () {
return {
selected_items: [],
editable_ids: []
editable_ids: [],
keep: false, // semaphore to catch "false" unselect
selecedRowNbr: -1 // keep track of selected row to keep display
}
},
computed: {
Expand Down Expand Up @@ -266,9 +268,21 @@ export default {
onRowSelected(items) {
this.selected_items = items
if (items[0] && (items.length == 1)) {
// keep the index of the row that was selected
this.selecedRowNbr = this.sortedCollection.indexOf(items[0])
this.select(items[0]);
} else {
this.select(null);
if (this.keep) { // semaphore to keep selected from getting unselected ...
// This is ugly but it works !!!!
this.keep = false
if (this.selecedRowNbr > -1) {
this.$refs.table.selectRow(this.selecedRowNbr)
}
} else {
// standard unselect
this.select(null);
this.selecedRowNbr = -1;
}
}
},
onSortChanged(ctx) {
Expand All @@ -288,21 +302,30 @@ export default {
}
},
watch: {
sortedCollection(nv, ov) {
if (ov.length == 0 && nv.length > 0) {
this.keep = false
} else {
// If the length has not changed ...
this.keep = true
}
},
selected(val) {
if (!val && this.selected_items.length == 1) {
this.$refs.table.clearSelected()
}
},
currentPage(ov,nv) {
currentPage(nv,ov) {
if (ov != nv) {
// page was changed so we clear our selected
this.selected_items = []
this.editable_ids = []
this.keep = false
this.selecedRowNbr = -1
}
}
},
mounted() {
// ensure that there is no model selected when the table is loaded
this.editable_ids = []
this.unselect();
}
Expand Down
31 changes: 31 additions & 0 deletions app/javascript/conflicts/ignore_button.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<template>
<icon-button
title="Ignore Conflict"
v-on="$listeners"
v-bind="$attrs"
>
<template #default="{variant}">
<b-iconstack :variant="variant">
<b-icon-bell stacked></b-icon-bell>
<b-icon-slash stacked variant="primary" scale="2" shift-h="2"></b-icon-slash>
<b-icon-slash stacked variant="primary" scale="2" shift-h="-2"></b-icon-slash>
<b-icon-slash stacked scale="2"></b-icon-slash>
</b-iconstack>
</template>
</icon-button>
</template>

<script>
import IconButton from '@/components/icon_button.vue';
export default {
name: "IgnoreButton",
components: {
IconButton
}
}
</script>

<style>
</style>
13 changes: 13 additions & 0 deletions app/javascript/conflicts/session_conflicts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
v-for="conflict in conflicts" :key="conflict.id"
>
<div v-html="conflict_type_string(conflict)"></div>
<ignore-button @click="ignore(conflict)"></ignore-button>
</div>
<div
class="session-conflict mb-1"
v-for="conflict in conflicts_with" :key="conflict.id"
>
<div v-html="conflict_type_string(conflict, true)"></div>
<ignore-button @click="ignore(conflict)"></ignore-button>
</div>
</div>
<div class="ml-2 text-muted font-italic" v-else-if="sessionId && conflicts.length === 0 && conflicts_with.length === 0">
Expand All @@ -32,6 +34,7 @@ import modelMixin from '../store/model.mixin';
import modelUtilsMixin from "@/store/model_utils.mixin"
import { sessionModel } from '@/store/session.store'
import dateTimeMixin from '../components/date_time.mixin'
import IgnoreButton from './ignore_button.vue';
export default {
name: "SessionConflicts",
Expand All @@ -52,6 +55,9 @@ export default {
conflicts: [],
conflicts_with: []
}),
components: {
IgnoreButton
},
computed: {
selectedSession() {
return this.get_model(sessionModel, this.sessionId)
Expand Down Expand Up @@ -80,6 +86,13 @@ export default {
}
},
methods: {
ignore(conflict) {
this.ignore_conflict({conflict_id: conflict.id, conflict_type: conflict.conflict_type}).then(
() => {
this.getConflicts(this.sessionId)
}
)
},
getConflicts(sessionId) {
this.conflicts = []
this.conflicts_with = []
Expand Down
24 changes: 24 additions & 0 deletions app/javascript/constants/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ module.exports = {
ERROR_GENERIC_UNRECOVERABLE: (email) => twoLines("The server has encountered an internal error and was unable to complete your request.",
`Please contact the server administrator at ${email} and let them know the time and date the error occurred.`),

ADD_CONFLICT_IGNORE_SUCCESS: "Ignore Conflict Added",
ADD_CONFLICT_IGNORE_ERROR: "Ignore Conflict Failed",

// Social Links Errors
TWITTER_ID_INVALID_MSG: "Twitter ID is not in a valid format",
FACEBOOK_ID_INVALID_MSG: "Facebook ID is not in a valid format",
Expand Down Expand Up @@ -241,4 +244,25 @@ module.exports = {
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.",
SURVEY_PUBLIC_NO_DELETE: "You cannot delete a published survey. Close the survey to enable deletion.",
SESSION_ENVIRONMENT: {
unknown: "Unknown",
in_person: "In Person",
hybrid: "Hybrid",
virtual: "Virtual"
},
SESSION_STATUS: {
draft: "Draft",
reviewed: "Reviewed",
revised: "Revised",
dropped: "Dropped",
},
SESSION_MUST_UNSCHEDULE: "You must unschedule a session before dropping it",
SESSION_MUST_UNDROP: "You must un-drop the session to be able to schedule it.",
SESSION_MINORS_PARTICIPATION: {
kids_observe: "Kids welcome to observe",
kids_supervision: "Kids welcome to participate with supervision",
kids_participate: "Kids welcome to participate",
geared_families: "Geared towards families",
geared_kids: "Geared towards kids",
},
}
4 changes: 3 additions & 1 deletion app/javascript/packs/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ Vue.config.errorHandler = (err, vm, info) => {
}
}

Vue.use(BootstrapVue);
Vue.use(BootstrapVue, {
BSkeleton: { animation: 'fade' }
});
Vue.use(BootstrapVueIcons);
Vue.use(CustomIconsPlugin);
Vue.use(AsyncComputed);
Expand Down
8 changes: 4 additions & 4 deletions app/javascript/reports/reports_screen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
<li>
<a href="/report/session_reports/participants_over_con_session_limits" target="_blank">Participants over Con Limit</a>
</li>
<!--<li>
<li>
<a href="/report/conflict_reports/person_exclusion_conflicts" target="_blank">Person scheduled against a conflict item</a>
</li>-->
</li>
<li>
<a href="/report/session_reports/non_accepted_on_schedule" target="_blank">Non-Accepted Participants on Scheduled Sessions</a>
</li>
Expand All @@ -51,9 +51,9 @@
<li>
<a href="/report/session_reports/session_with_no_moderator" target="_blank">Sessions with no Moderator</a>
</li>
<!--<li>
<li>
<a href="/report/session_reports/scheduled_session_no_people" target="_blank">Scheduled Sessions with no Participants</a>
</li>-->
</li>
<li>
<a href="/report/session_reports/assigned_sessions_not_scheduled" target="_blank">Sessions with Participants not Scheduled</a>
</li>
Expand Down
3 changes: 2 additions & 1 deletion app/javascript/schedule/schedule_screen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ export default {
["room_id", "is null"]
]
},
["duration", ">", "0"]
["duration", ">", "0"],
["status", "!=", "dropped"]
]
}
Expand Down
Loading

0 comments on commit 17c5828

Please sign in to comment.