Skip to content

Commit

Permalink
Merge branch 'development' into PLAN-450-email-tab-v1
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry committed Aug 3, 2022
2 parents 504a221 + 0392cf4 commit 1f052a4
Show file tree
Hide file tree
Showing 47 changed files with 623 additions and 127 deletions.
4 changes: 4 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ def check_up
if ScheduleSnapshot.where("status = 'in_progress'").count > 0
redirect_to '/maintenance.html', status: 503
end
# Stop people from making changes if we are publishing
if PublicationStatus.where("status = 'inprogress'").count > 0
redirect_to '/maintenance.html', status: 503
end
end

def prevent_cache
Expand Down
67 changes: 67 additions & 0 deletions app/controllers/reports/people_reports_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
class Reports::PeopleReportsController < ApplicationController
around_action :set_timezone

def record_stream_permissions
authorize Person, policy_class: ReportPolicy

# People: moderators, participants.  NO INVIS, NO RESEVER

active_roles = SessionAssignmentRoleType.where("role_type = 'participant' and (name != 'Invisible' and name != 'Reserve')")
people = Person
.includes({sessions: :room}, :primary_email)
.references(:sessions)
.where("session_assignments.session_assignment_role_type_id not in (select id from session_assignment_role_type where session_assignment_role_type.name = 'Invisible')")
.where("session_assignments.session_assignment_role_type_id not in (select id from session_assignment_role_type where session_assignment_role_type.name = 'Reserve')")
.order('people.published_name asc')


# Person published  names, primary email, attendance type,
# participant status, permission to stream,
# exclusions for streaming, permission to record, exclusions to recording,
# their schedule (in one cell with session title time duration room.  If not possible one line per session will have to do)

workbook = FastExcel.open(constant_memory: true)
worksheet = workbook.add_worksheet("Record and Stream Permissions")

worksheet.append_row(
[
'Name',
'Published Name',
'Primary Email',
'Attendance Type',
'Participant Status',
'Permission to Stream',
'Streaming Exceptions',
'Permission to Record',
'Recording Exceptions',
'Schedule'
]
)

people.each do |person|
worksheet.append_row(
[
person.name,
person.published_name,
person.primary_email&.email,
person.attendance_type,
person.con_state,
person.can_stream,
person.can_stream_exceptions,
person.can_record,
person.can_record_exceptions,
person.sessions.scheduled.collect{|s| "'#{s.title}' - #{s.start_time.strftime('%Y-%m-%d %H:%M %Z')} - #{s.duration} mins - #{s.room.name}" }.join(";\n")
]
)
end

send_data workbook.read_string,
filename: "PeopleRecordStream-#{Time.now.strftime('%m-%d-%Y')}.xlsx",
disposition: 'attachment'
end

def set_timezone(&block)
timezone = ConfigService.value('convention_timezone')
Time.use_zone(timezone, &block)
end
end
37 changes: 24 additions & 13 deletions app/controllers/schedule_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,35 @@ class ScheduleController < ApplicationController

# 1. If prod always use the published schedule
# 2. If staging or dev use published - if no published then use the live for testing
# 3. Put in a cache mechanism (cache can be popultaed as part of the publish)
# 3. cache mechanism (cache can be popultaed as part of the publish)
def index
sessions = SessionService.scheduled_sessions
snapshot = PublicationDate.order('created_at desc').first&.publish_snapshots&.schedules&.first

render json: ActiveModel::Serializer::CollectionSerializer.new(
sessions,
serializer: Conclar::SessionSerializer
),
content_type: 'application/json'
if snapshot
render json: snapshot, content_type: 'application/json'
else
sessions = SessionService.scheduled_sessions
render json: ActiveModel::Serializer::CollectionSerializer.new(
sessions,
serializer: Conclar::SessionSerializer
),
content_type: 'application/json'
end
end

def participants
participants = SessionService.scheduled_people
snapshot = PublicationDate.order('created_at desc').first&.publish_snapshots&.participants&.first

render json: ActiveModel::Serializer::CollectionSerializer.new(
participants,
serializer: Conclar::ParticipantSerializer
),
content_type: 'application/json'
if snapshot
render json: snapshot, content_type: 'application/json'
else
participants = SessionService.scheduled_people

render json: ActiveModel::Serializer::CollectionSerializer.new(
participants,
serializer: Conclar::ParticipantSerializer
),
content_type: 'application/json'
end
end
end
10 changes: 10 additions & 0 deletions app/controllers/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ class SessionsController < ResourceController
POLICY_SCOPE_CLASS = 'SessionPolicy::Scope'.freeze
# DEFAULT_SORTBY = 'name_sort_by'

def schedule_publish
authorize current_person, policy_class: policy_class

PublicationService.start_publish_job

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

# Mass update for the sessions (given ids and params)
def update_all
authorize current_person, policy_class: policy_class
Expand Down Expand Up @@ -314,6 +322,8 @@ def allowed_params
require_signup
age_restriction_id
room_notes
recorded
streamed
]
# Tags
# format
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mailings/mailings_table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div>
<table-vue
defaultSortBy='updated_at'
defaultSortDesc="true"
:defaultSortDesc="true"
:model="model"
:columns="columns"
:defaultFilter="defaultFilter"
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/people/person_tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export default {
'session-ranking',
]
if (this.displayDraftSchedule) {
baseTabs.push('draft_schedule');
baseTabs.splice(5, 0, 'draft-schedule')
}
if (this.currentUserIsAdmin || this.currentUserIsStaff || this.firmSchedule) {
baseTabs.splice(5, 0, 'schedule');
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/profile/person_schedule_display.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div class="col-8" :style="heightHelper">
<b-overlay :show="loading" spinner-variant="primary" variant="white" opacity="1">
<schedule-collapse v-for="(session) in orderedSessions" :key="session.id" :id="session.id" v-model="open[session.id]">
<template #title><span class="larger-text"><strong class="larger-text">{{session.title}}</strong>, {{session.room}}, {{formatStartTime(session)}}</span></template>
<template #title><span class="larger-text"><strong class="larger-text">{{session.title}}</strong>, {{formatStartTime(session)}}, {{session.room}}</span></template>
<dl class="indented-dl">
<dt>Title</dt>
<dd>{{session.title}}</dd>
Expand Down
16 changes: 12 additions & 4 deletions app/javascript/reports/reports_screen.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<strong><em>Description</em></strong>: List of surveys taken, including day/time submitted, one line per person<br />
<strong><em>Fields</em></strong>: Person name, published name, primary email, attendance type, participant status, surveys taken<br />
<strong><em>Person data included</em></strong>: participant status of applied, probable, vetted, invite_pending, invited, accepted
</p>
</p>
</li>
<li>
<span v-if="currentUserIsStaff" class="text-muted font-italic" title="You do not have the right set of permissions to run this report." v-b-tooltip>Participants and Do Not Assign With</span>
Expand All @@ -51,7 +51,7 @@
<strong><em>Fields</em></strong>: Person name, published name, session title, area(s) of session, names of other people assigned to the session, names of people not to assign to the same session<br />
<strong><em>Session data included</em></strong>: all scheduled sessions<br />
<strong><em>Person data included</em></strong>: moderators, participants, invisible participants who listed information about who not to assign with
</p>
</p>
</li>
<li>
<a href="/report/session_reports/participants_over_session_limits" target="_blank">Participants over Daily Limits</a>
Expand Down Expand Up @@ -87,7 +87,15 @@
<strong><em>Fields</em></strong>: Person name, published name, participant status, attendance type (in-person, virtual, hybrid), person’s bio<br />
<strong><em>Session data included</em></strong>: all scheduled sessions<br />
<strong><em>Person data included</em></strong>: people with a participant status of accepted, invited, or invite_pending who are assigned to no sessions, or who are assigned as invisible participants or reserved on one or more sessions
</p>
</p>
</li>
<li>
<a href="/report/people_reports/record_stream_permissions" target="_blank">Participant Recording and Streaming Permissions</a>
<p class="ml-2">
<strong><em>Description</em></strong>: List of participants with their recording and streaming permissions and exclusions.<br />
<strong><em>Fields</em></strong>: Person published names, primary email, attendance type, participant status, permission to stream, exclusions for streaming, permission to record, exclusions to recording, and their schedule.<br />
<strong><em>Person data included</em></strong>: Moderators and participants on scheduled sessions.
</p>
</li>
</ul>

Expand Down Expand Up @@ -126,7 +134,7 @@
<strong><em>Description</em></strong>: Scheduled sessions with no assigned moderators or participants, one line per session<br />
<strong><em>Fields</em></strong>: Session title, area(s) of session, session start time, room<br />
<strong><em>Session data included</em></strong>: all scheduled sessions
</p>
</p>
</li>
<li>
<a href="/report/session_reports/assigned_sessions_not_scheduled" target="_blank">Sessions with Participants not Scheduled</a>
Expand Down
58 changes: 54 additions & 4 deletions app/javascript/schedule/schedule_settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<div class="container-fluid">
<div class="row">
<div class="col-12">
<h5>Release schedule to participants</h5>
<b-form-group label-cols="auto" class="align-items-center">
<template #label>Release <strong>Draft</strong> Schedule to Participants</template>
<b-form-checkbox switch v-model="localDraftSchedule" :disabled="localDraftSchedule" @change="openDraftConfirm" id="draft-schedule-checkbox" aria-describedby="draft-schedule-date"></b-form-checkbox>
Expand All @@ -14,10 +15,41 @@
<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
reflect reality if you reload. There's some TODOs in here. If you try to snapshot and get an error, reset first.
</div>
</div>
<hr />
</div>
</div>
<div class="row">
<div class="col-12">
<h5>Publish schedule to public</h5>
<b-table-simple borderless fixed small>
<b-thead>
<b-tr>
<b-td class="text-center">
<b-button variant="primary" size="sm" :disabled="!canDiff">Show difference</b-button>
</b-td>
<b-td colspan="3">
<b-button variant="primary" size="sm" @click="publishdSchedule()">Create a publish snapshot</b-button>
</b-td>
</b-tr>
</b-thead>
</b-table-simple>
<b-table-simple bordered fixed small>
<b-thead class="text-center">
<b-tr>
<b-td class="text-center">Select 2</b-td>
<b-td colspan="3">Timestamp</b-td>
</b-tr>
</b-thead>
<b-tbody>
<b-tr v-for="(snap, i) in pubSnapshots" :key="snap.id">
<b-td class="text-center">
<b-form-checkbox name="pubs-diff" v-model="pubsDiff[i]" :disabled="pubsDiffCount >= 2 && !pubsDiff[i]"></b-form-checkbox>
</b-td>
<b-td colspan="3">{{snap.timestamp}}</b-td>
</b-tr>
</b-tbody>
</b-table-simple>
</div>
</div>
<plano-modal id="confirm-draft-modal" @cancel="cancelDraft()" @close="cancelDraft()" no-close-on-backdrop @ok="confirmDraft()">
Expand All @@ -42,6 +74,7 @@ import {
import { scheduleWorkflowMixin } from '@/store/schedule_workflow';
import settingsMixin from "@/store/settings.mixin";
import { DateTime } from 'luxon';
export default {
name: "ScheduleSettings",
Expand All @@ -60,9 +93,23 @@ export default {
firmScheduleConfirmed: false,
SCHEDULE_DRAFT_CONFIRM_MESSAGE,
SCHEDULE_FIRM_CONFIRM_MESSAGE,
NODE_ENV
NODE_ENV,
mockSnapshots: [
// {timestamp: '2022-08-01T09:58:00Z', id: '12345'},
// {timestamp: '2022-08-04T00:24:00Z', id:'67890'}
],
pubsDiff: [false, false, false],
}),
computed: {
pubSnapshots() {
return [{timestamp: "Current state", id: null}, ...this.mockSnapshots.map(snap => ({...snap, timestamp: DateTime.fromISO(snap.timestamp).toFormat("DDDD, t ZZZZ")}))]
},
pubsDiffCount() {
return this.pubsDiff.filter(pd => pd).length
},
canDiff() {
return this.pubsDiffCount === 2;
},
draftScheduledAtText() {
return this.draftScheduleConfirmed ? this.draftScheduledAt : "Pending";
},
Expand Down Expand Up @@ -101,6 +148,9 @@ export default {
this.draftSchedule = false;
this.firmSchedule = false;
this.toastPromise(http.get('/schedule_workflow/reset'), "succesfully reset workflows")
},
publishdSchedule() {
this.toastPromise(http.get('/session/schedule_publish'), "Succesfully requested publish")
}
},
watch: {
Expand Down
19 changes: 18 additions & 1 deletion app/javascript/sessions/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,24 @@ export const session_columns = [
label: 'Copy Edited/Proofed',
type: "select",
choices: [{label: "Yes", value: true}, {label: "No", value: false}],
formatter: (value) => value ? "Yes" : "No"
formatter: (value) => value ? "Yes" : "No",
sortable: true,
},
{
key: 'recorded',
label: 'Recorded',
type: "select",
choices: [{label: "Yes", value: true}, {label: "No", value: false}],
formatter: (value) => value ? "Yes" : "No",
sortable: true
},
{
key: 'streamed',
label: 'Livestreamed',
type: "select",
choices: [{label: "Yes", value: true}, {label: "No", value: false}],
formatter: (value) => value ? "Yes" : "No",
sortable: true
},
{
key: 'environment',
Expand Down
24 changes: 22 additions & 2 deletions app/javascript/sessions/session_sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
</div>
</b-row>
<div class="row">
<div class="col-12">
<div class="col-12 col-md-6 col-lg-4">
<b-form-group label="Public Schedule Visibility">
<span class="text-muted ml-2">Not Visible</span>
<b-form-checkbox
Expand All @@ -57,7 +57,27 @@
:checked="selected.visibility === 'is_public'"
class="d-inline-block"
>Visible</b-form-checkbox>
</b-form-group>
</b-form-group>
</div>
<div class="col-12 col-md-6 col-lg-4">
<b-form-group>
<b-form-checkbox
id="session-recorded"
switch
v-model="selected.recorded"
disabled
>Will be recorded</b-form-checkbox>
</b-form-group>
</div>
<div class="col-12 col-md-6 col-lg-4">
<b-form-group>
<b-form-checkbox
id="session-streamed"
switch
v-model="selected.streamed"
disabled
>Will be live-streamed</b-form-checkbox>
</b-form-group>
</div>
</div>
<div class="float-right d-flex justify-content-end">
Expand Down
Loading

0 comments on commit 1f052a4

Please sign in to comment.