Skip to content

Commit

Permalink
Merge pull request #491 from ChicagoWorldcon/development
Browse files Browse the repository at this point in the history
1.6.2-rc1
  • Loading branch information
Gailbear authored Jul 27, 2022
2 parents b788816 + 6d53f9c commit 504c6fa
Show file tree
Hide file tree
Showing 20 changed files with 328 additions and 57 deletions.
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
14 changes: 13 additions & 1 deletion app/javascript/constants/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,18 @@ module.exports = {
},
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 +281,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
17 changes: 5 additions & 12 deletions app/javascript/people/people.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {PERSON_CON_STATE, SESSION_STATUS} from "@/constants/strings";
import { personScheduleApprovalStateOptionsForSearch } from "@/store/person_schedule_approval";

export const people_columns = [
Expand Down Expand Up @@ -34,19 +35,11 @@ export const people_columns = [
search_key: 'con_state',
label: 'Status',
type: "select",
// TODO: needs to be driven by settings enums
formatter: (value) => PERSON_CON_STATE[value] || value,
choices: [
{label: "not_set", value: "not_set"},
{label: "applied", value: "applied"},
{label: "vetted", value: "vetted"},
{label: "wait_list", value: "wait_list"},
{label: "invite_pending", value: "invite_pending"},
{label: "invited", value: "invited"},
{label: "probable", value: "probable"},
{label: "accepted", value: "accepted"},
{label: "declined", value: "declined"},
{label: "rejected", value: "rejected"}
],
"not_set", "applied", "vetted", "wait_list", "invite_pending",
"invited", "probable", "accepted", "declined", "rejected"
].map(value => ({label: PERSON_CON_STATE[value], value})),
operators: ["equal", "does not equal"],
sortable: false
},
Expand Down
39 changes: 24 additions & 15 deletions app/javascript/people/people_admin_tab.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
<template>
<div class="container-fluid">
<dl class="row">
<dt class="col-sm-4">Convention Class:</dt>
<dd class="col-sm-8">
<span v-for="role of selected.convention_roles" :key="role.id">
{{ role.role }}
</span>
</dd>
<dt class="col-sm-12">Comments:</dt>
<dd class="col-sm-12">
<b-form-textarea v-model="comments"></b-form-textarea>
<b-button class="float-right mt-1" @click="patchSelected({comments})" variant="primary">Save Comments</b-button>
</dd>
</dl>
<dl class="row">
<div class="col-12 col-sm-6 col-lg-4">
<dt>Status</dt>
<dd class="font-italic ml-2">{{PERSON_CON_STATE[selected.con_state || 'not_set']}}</dd>
</div>
<div class="col-12 col-sm-6 col-lg-4">
<dt>Convention Class</dt>
<dd class="font-italic ml-2">{{conventionClasses}}</dd>
</div>
<dt class="col-12 mt-2">Comments</dt>
<dd class="col-12">
<b-form-textarea v-model="comments"></b-form-textarea>
<b-button class="float-right mt-1" @click="patchSelected({comments})" variant="primary">Save Comments</b-button>
</dd>
</dl>
</div>
</template>

<script>
import { makeSelectedFieldMixin } from '@/mixins'
import { modelMixinNoProp } from '@/store/model.mixin';
import { personModel as model } from '@/store/person.store';
import { PERSON_CON_STATE } from '@/constants/strings';
const commentsMixin = makeSelectedFieldMixin('comments');
export default {
Expand All @@ -29,8 +32,14 @@ export default {
commentsMixin
],
data: () => ({
model
})
model,
PERSON_CON_STATE
}),
computed: {
conventionClasses() {
return (Object.values(this.selected.convention_roles) || []).map(r => r.role[0].toUpperCase() + r.role.substring(1)).join(', ')
}
}
}
</script>

Expand Down
8 changes: 3 additions & 5 deletions app/javascript/people/people_table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,9 @@
</tooltip-overflow>
</template>
<template #cell(current_sign_in_at)="{ item }">
<span v-if="item.public">
<tooltip-overflow :title="item.current_sign_in_at">
{{new Date(item.current_sign_in_at).toLocaleString()}}
</tooltip-overflow>
</span>
<tooltip-overflow :title="item.current_sign_in_at">
{{new Date(item.current_sign_in_at).toLocaleString()}}
</tooltip-overflow>
</template>
<template #cell(draft_approval)="{ item }">
<div v-if="draftSchedule">
Expand Down
30 changes: 18 additions & 12 deletions app/javascript/people/person_tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,6 @@ import VueRouter from 'vue-router';
import { mapActions } from 'vuex';
const { isNavigationFailure, NavigationFailureType } = VueRouter;
// This needs to be kept in sync with the tab order above
const tabsArray = [
'edit',
'other',
'availability',
'session-selection',
'session-ranking',
'schedule',
'draft-schedule',
'admin'
]
export default {
name: "PeopleTabs",
Expand Down Expand Up @@ -124,6 +113,23 @@ export default {
sessionAssignmentModel,
}),
computed: {
tabsArray() {
const baseTabs = [
'edit',
'other',
'availability',
'session-selection',
'session-ranking',
'admin'
]
if (this.displayDraftSchedule) {
baseTabs.splice(5, 0, 'draft_schedule')
}
if (this.currentUserIsAdmin || this.currentUserIsStaff || this.firmSchedule) {
baseTabs.splice(5, 0, 'schedule')
}
return baseTabs;
},
person() {
return this.selected_model(personModel);
},
Expand Down Expand Up @@ -162,7 +168,7 @@ export default {
// change the router path to match the current tab
// so that reloads work right
// IF YOU ADD A TAB make sure you update the tabsArray or badness will happen
let path = tabsArray[newTab];
let path = this.tabsArray[newTab];
const pathStart = this.$route.path.split('/')[1];
if (newTab === '0' && pathStart !== 'people') {
path = '';
Expand Down
5 changes: 3 additions & 2 deletions app/javascript/schedule/schedule_settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
<b-form-checkbox id="firm-schedule-checkbox" switch v-model="localFirmSchedule" @change="openFirmConfirm" :disabled="!localDraftSchedule || localFirmSchedule" inline aria-describedby="firm-schedule-date"></b-form-checkbox>
<span class="small text-muted" id="firm-schedule-date" v-if="localFirmSchedule">{{firmScheduledAtText}}</span>
</b-form-group>
<div v-if="NODE_ENV && NODE_ENV !== 'production'">
<h2>REMOVE ME BEFORE PRODUCTION</h2>
<div v-if="currentSettings.env !== 'production'">
<b-button variant="primary" @click="reset()">Reset for Testing</b-button>
<span>THIS DELETES THE SNAPSHOT AND YOU CAN'T EVER GET IT BACK</span>
<div class="mt-3">Note: this minecart isn't actually hooked up to any status yet. So while it does actually produce a snapshot, the toggle won't
Expand Down Expand Up @@ -42,12 +41,14 @@ import {
} from '@/constants/strings';
import { scheduleWorkflowMixin } from '@/store/schedule_workflow';
import settingsMixin from "@/store/settings.mixin";
export default {
name: "ScheduleSettings",
mixins: [
toastMixin,
scheduleWorkflowMixin,
settingsMixin
],
components: {
PlanoModal
Expand Down
22 changes: 22 additions & 0 deletions app/javascript/sessions/format_select_for_search.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<template>
<v-select :options="formatNames" @input="$emit('input', $event)" :value="value" class="w-100"></v-select>
</template>

<script>
import { formatModel as model } from "@/store/format.store"
import { FETCH } from "@/store/model.store";
export default {
name: "FormatSelectForSearch",
props: ['value'],
computed: {
formatNames() {
let vals = this.$store.getters['jv/get']({_jv: { type: model }})
return Object.values(vals).map(a => a.name).sort((a, b)=> a < b ? -1 : 1 )
}
},
mounted() {
this.$store.dispatch(FETCH, {model});
}
}
</script>
21 changes: 21 additions & 0 deletions app/javascript/sessions/room_select_for_search.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<template>
<v-select :options="roomNames" @input="$emit('input', $event)" :value="value" class="w-100"></v-select>
</template>

<script>
import { roomModel as model } from "@/store/room.store"
import { FETCH } from "@/store/model.store";
export default {
name: "RoomSelectForSearch",
props: ['value'],
computed: {
roomNames() {
return Object.values(this.$store.getters['jv/get']({_jv: { type: model }})).map(a => a.name).sort((a, b)=> a < b ? -1 : 1 )
}
},
mounted() {
this.$store.dispatch(FETCH, {model});
}
}
</script>
34 changes: 30 additions & 4 deletions app/javascript/sessions/session.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { SESSION_STATUS } from '@/constants/strings';
import { SESSION_STATUS, SESSION_ENVIRONMENT } from '@/constants/strings';
import AreaSelectForSearch from './area_select_for_search'
import FormatSelectForSearch from './format_select_for_search'
import RoomSelectForSearch from './room_select_for_search'

export const session_columns = [
// {
Expand Down Expand Up @@ -35,7 +37,10 @@ export const session_columns = [
key: 'format.name',
label: 'Format',
sortKey: 'formats.name',
sortable: true
sortable: true,
component: FormatSelectForSearch,
type: 'custom-component',
operators: ['is','is not', 'is empty','is not empty'],
},
{
key: 'start_time',
Expand All @@ -53,17 +58,38 @@ export const session_columns = [
key: 'room.name',
label: 'Room',
sortKey: 'rooms.name',
sortable: true
sortable: true,
// type: "text"
component: RoomSelectForSearch,
type: 'custom-component',
operators: ['is','is not', 'is empty','is not empty'],
// TODO: how would we create a select drop down for room to be fetched from server????
// type: "select",
// choices: roomOptionsForSearch,
},
{
key: 'status',
label: 'Status',
formatter: (value) => SESSION_STATUS[value] || value,
sortable: true,
sortKey: 'status',
choices: ['draft', 'reviewed', 'revised', 'dropped'].map(value => ({label: SESSION_STATUS[value], value})),
choices: Object.entries(SESSION_STATUS).map(([value, label]) => ({label, value})),
type: "select"
},
{
key: 'proofed',
label: 'Copy Edited/Proofed',
type: "select",
choices: [{label: "Yes", value: true}, {label: "No", value: false}],
formatter: (value) => value ? "Yes" : "No"
},
{
key: 'environment',
label: 'Environment',
type: "select",
choices: Object.entries(SESSION_ENVIRONMENT).map(([value, label]) => ({label, value})),
formatter: (value) => SESSION_ENVIRONMENT[value] || value,
},
{
key: 'open_for_interest',
label: 'Open for Interest',
Expand Down
3 changes: 2 additions & 1 deletion app/lib/migration_helpers/plano_views.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def self.create_person_schedules
join
session_assignment_role_type sart on
sart.id = sa.session_assignment_role_type_id
and sart.role_type = 'participant'
and sart.role_type = 'participant' AND sart.name != 'Reserve'
join
people p on
p.id = sa.person_id
Expand Down Expand Up @@ -325,6 +325,7 @@ def self.create_person_back_to_back_to_back
person_back_to_back psc1
inner join person_back_to_back psc2 on
psc2.session_id = psc1.conflict_session_id
and psc2.person_id = psc1.person_id
SQL
ActiveRecord::Base.connection.execute(query)
end
Expand Down
Loading

0 comments on commit 504c6fa

Please sign in to comment.