Skip to content

Commit

Permalink
Merge pull request #1006 from PlanoramaEvents/staging
Browse files Browse the repository at this point in the history
3.4.1
  • Loading branch information
balen authored Mar 15, 2024
2 parents dd5abfb + 18d2bc9 commit a424a6e
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 20 deletions.
2 changes: 1 addition & 1 deletion app/controllers/reports/people_reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def record_stream_permissions
end

send_data workbook.read_string,
filename: "PeopleRecordStream-#{Time.now.strftime('%m-%d-%Y')}.xlsx",
filename: "PeopleSessionPermissions-#{Time.now.strftime('%m-%d-%Y')}.xlsx",
disposition: 'attachment'
end
end
2 changes: 1 addition & 1 deletion app/controllers/survey/submissions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def collection_to_xls
header = ['Created At', 'Updated At', 'Email']
response_columns = {}
posn = 3
survey.questions.each do |question|
survey.questions.sorted.each do |question|
next if [:hr, :textonly].include? question.question_type
next unless can_access_question?(question, current_person)

Expand Down
2 changes: 1 addition & 1 deletion app/javascript/people/people_sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<person-email-tab></person-email-tab>
</b-tab>
<b-tab title="Surveys" lazy v-if="currentUserIsAdmin || currentUserIsStaff">
<person-surveys></person-surveys>
<person-surveys :person="selected"></person-surveys>
</b-tab>
<b-tab title="Admin" v-if="currentUserIsAdmin || currentUserIsStaff">
<people-admin-tab></people-admin-tab>
Expand Down
13 changes: 5 additions & 8 deletions app/javascript/profile/person_surveys.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,16 @@ export default {
}),
watch: {
person: {
handler(person) {
if(person?.id) {
handler(newVal, oldVal) {
if(newVal?.id && (newVal?.id != oldVal?.id)) {
console.debug("Get surveys for ", newVal.id)
this.loading = true;
this.getPersonSurveys({person}).then(data => {
this.getPersonSurveys({person: newVal}).then(data => {
const {_jv, ...surveys} = data;
this.surveys = Object.values(data).map(s => ({name: s.name, id: s.id}))
this.loading = false;
})
// this.getSurveysForPerson(newVal).then(data => {
// // I expect this to come back in [{name: "foo", id: "abc123"}]
// this.surveys = data;
// this.loading = false;
// })
}
},
immediate: true
Expand Down
10 changes: 5 additions & 5 deletions app/javascript/sessions/datetime_picker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,18 @@ export default {
}),
computed: {
day() {
return this.value ? DateTime.fromISO(this.value, {zone: 'utc'}).setZone(this.conventionTimezone).toFormat('D', {locale: "en-US"}) : null;
return this.value ? DateTime.fromISO(this.value).setZone(this.conventionTimezone).toFormat('D', {locale: "en-US"}) : null;
},
time() {
return this.value ? DateTime.fromISO(this.value, {zone: 'utc'}).setZone(this.conventionTimezone).toFormat('HH:mm:ss', {locale: "en-US"}) : null;
return this.value ? DateTime.fromISO(this.value).setZone(this.conventionTimezone).toFormat('HH:mm:ss', {locale: "en-US"}) : null;
},
dayOptionsWithNull() {
return [{text: "No day selected", value: null}, ...this.dayOptions];
}
},
methods: {
changeDay(newDay) {
let retDate = this.value ? DateTime.fromISO(this.value, {zone: 'utc'}).setZone(this.conventionTimezone) : DateTime.fromObject({hour: 0, minute: 0}, {zone: this.conventionTimezone});
let retDate = this.value ? DateTime.fromISO(this.value).setZone(this.conventionTimezone) : DateTime.fromObject({hour: 0, minute: 0}, {zone: this.conventionTimezone});
if (newDay) {
let date = DateTime.fromFormat(newDay, 'D', {locale: "en-US" }); //, {zone: this.conventionTimezone});
retDate = retDate.set({
Expand All @@ -50,12 +50,12 @@ export default {
day: date.day,
})
retDate = retDate.toUTC();
console.log('***** retDate', retDate.toISO());
// console.log('***** retDate', retDate.toISO());
this.$emit('input', retDate.toISO());
}
},
changeTime(newTime) {
let retDate = this.value ? DateTime.fromISO(this.value, {zone: 'utc'}) : DateTime.fromISO(this.conventionStart, {zone: 'utc'});
let retDate = this.value ? DateTime.fromISO(this.value).setZone(this.conventionTimezone) : DateTime.fromISO(this.conventionStart).setZone(this.conventionTimezone);
if (newTime) {
console.log('val', newTime, DateTime.fromFormat(newTime, 'HH:mm:ss'))
let time = DateTime.fromFormat(newTime, 'HH:mm:ss', {zone: this.conventionTimezone}).toUTC();
Expand Down
6 changes: 4 additions & 2 deletions app/javascript/surveys/manage-survey.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<edit-survey :survey-id="id"></edit-survey>
</b-tab>
<b-tab v-if="survey" title="Responses" :active="!!responses" lazy>
<view-responses :survey-id="id"></view-responses>
<view-responses :survey-id="id" :person_id="person_id"></view-responses>
</b-tab>
<survey-settings-tab v-if="survey" lazy></survey-settings-tab>
<b-tab v-if="survey" title="Audit Log" disabled lazy>
Expand Down Expand Up @@ -59,7 +59,8 @@ export default {
EditSurvey
},
data: () => ({
SURVEY_PUBLIC_NO_EDIT
SURVEY_PUBLIC_NO_EDIT,
person_id: null
}),
computed: {
questionsTitle() {
Expand All @@ -68,6 +69,7 @@ export default {
},
methods: {
init() {
this.person_id = this.$route.query.person_id
this.selectSurvey(this.id);
this.fetchSelectedSurvey();
},
Expand Down
20 changes: 20 additions & 0 deletions app/javascript/surveys/view-responses.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
ref="responses-table"
model="submission_flat"
:defaultUrl="defaultUrl"
:defaultFilter="defaultFilter"
:show-add="false"
:show-settings="false"
:columns="question_columns"
Expand Down Expand Up @@ -49,6 +50,10 @@ export default {
surveyId: {
type: String,
default: null
},
person_id: {
type: String,
default: null
}
},
components: {
Expand All @@ -65,6 +70,21 @@ export default {
defaultUrl() {
return `/survey/${this.surveyId}/submissions/flat`
},
defaultFilter() {
if (this.person_id) {
let filter = {
"op": "all",
"queries":[
["person_id", "=", this.person_id]
]
}
return JSON.stringify(filter)
} else {
return null;
}
},
downloadLink() {
return `/survey/${this.surveyId}/submissions.xlsx`
},
Expand Down
3 changes: 1 addition & 2 deletions app/models/survey/question.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ class Survey::Question < ApplicationRecord
# Scopes to deal with the soft deletes
scope :not_deleted, -> { where(deleted_at: nil) }
scope :deleted, -> { where('survey_questions.deleted_at is not null') }
scope :sorted, -> {includes(:page).order(['survey_pages.sort_order asc', 'survey_questions.sort_order asc'])}

has_paper_trail versions: { class_name: 'Audit::SurveyVersion' }, ignore: [:updated_at, :created_at, :lock_version, :sort_order]

# default_scope {includes(:page).order(['survey_pages.sort_order asc', 'survey_questions.sort_order asc'])}

belongs_to :page,
class_name: 'Survey::Page',
foreign_key: 'page_id',
Expand Down

0 comments on commit a424a6e

Please sign in to comment.