From 725547faa83c524d7ae5eb604b09e6115e74c1f9 Mon Sep 17 00:00:00 2001 From: Peter Howell Date: Fri, 26 Sep 2025 22:06:26 +0000 Subject: [PATCH] bug fix --- dir_api.php | 13 +++++++++++++ js/dir_app.js | 22 +++++++++++++--------- nav-mobile.php | 2 +- nav.php | 2 +- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/dir_api.php b/dir_api.php index 831c1af..53075a2 100644 --- a/dir_api.php +++ b/dir_api.php @@ -620,6 +620,11 @@ if (isset($_REQUEST['a']) && $_REQUEST['a']=='add/letter') { update_welcome_lett // GET LIST OF ALL SESSIONS / WORKSHOPS / EVENTS // function get_sessions() { global $c, $AY; + // If a specific session id is requested, return it regardless of date range + if (isset($_REQUEST['id']) && preg_match('/^\d+$/', $_REQUEST['id'])) { + $ID = ok($_REQUEST['id']); + return multi_row_select("SELECT c.id,c.title,c.desc,c.length,c.starttime,c.track,c.location,c.location_irl,c.mode,c.gets_survey,c.category,c.parent,c.recording,c.instructions,c.image_url,c.is_flex_approved,c.cal_uid,sst.type AS typeStr, sst.id AS type, GROUP_CONCAT(ctg.tag) AS tags FROM conf_sessions c LEFT JOIN conf_sessiontypes sst ON c.type=sst.id LEFT JOIN conf_tagmember ct ON c.id=ct.session LEFT JOIN conf_tags ctg ON ctg.id=ct.tag WHERE c.id='{$ID}' GROUP BY c.id ORDER BY c.track, c.starttime;",0); + } $date_clause = api_date_clause('c.starttime'); return multi_row_select("SELECT c.id,c.title,c.desc,c.length,c.starttime,c.track,c.location,c.location_irl,c.mode,c.gets_survey,c.category,c.parent,c.recording,c.instructions,c.image_url,c.is_flex_approved,c.cal_uid,sst.type AS typeStr, sst.id AS type, GROUP_CONCAT(ctg.tag) AS tags FROM conf_sessions c LEFT JOIN conf_sessiontypes sst ON c.type=sst.id LEFT JOIN conf_tagmember ct ON c.id=ct.session LEFT JOIN conf_tags ctg ON ctg.id=ct.tag WHERE $date_clause GROUP BY c.id ORDER BY c.track, c.starttime;",0); } @@ -640,6 +645,10 @@ function multi_row_1d($qry) { global $c; // GET LIST OF ALL SESSIONS + HOSTS // function get_ses_hosts() { global $c, $AY; + if (isset($_REQUEST['id']) && preg_match('/^\d+$/', $_REQUEST['id'])) { + $ID = ok($_REQUEST['id']); + return multi_row_select("select s.id, s.title, s.starttime, u.name, u.email, u.id AS hostid from conf_sessions as s LEFT OUTER JOIN conf_hosts as h ON h.session=s.id LEFT OUTER JOIN conf_users AS u ON h.host=u.id WHERE s.id='{$ID}' ORDER BY u.name;",1); + } $date_clause = api_date_clause('s.starttime'); return multi_row_select("select s.id, s.title, s.starttime, u.name, u.email, u.id AS hostid from conf_sessions as s LEFT OUTER JOIN conf_hosts as h ON h.session=s.id LEFT OUTER JOIN conf_users AS u ON h.host=u.id WHERE $date_clause ORDER BY u.name;",1); } @@ -765,6 +774,10 @@ if (isset($_GET['a'])&& preg_match('/get\/questions\/(\d+)$/', $_GET['a'], $matc // ALL Survey ANSWERS function get_answers_all() { global $c; + if (isset($_REQUEST['id']) && preg_match('/^\d+$/', $_REQUEST['id'])) { + $ID = ok($_REQUEST['id']); + return multi_row_select( "SELECT ses.id AS ses_id, ses.title as s_title, ses.starttime, qq.id as q_id, qq.question as question, qq.type as type, ans.answer AS answer FROM conf_sessions AS ses JOIN conf_signups as sup on ses.id = sup.session JOIN conf_users as cus on cus.id = sup.user JOIN conf_q_set as qset on ses.gets_survey = qset.q_set RIGHT JOIN conf_questions as qq on qset.question = qq.id LEFT OUTER JOIN conf_answers as ans on ans.user = sup.user AND ans.question = qq.id AND ans.session = ses.id WHERE ses.id='{$ID}' AND ans.answer is not null ORDER BY ses.starttime, ses.track asc, qset.order", 0); + } $date_clause = api_date_clause('ses.starttime'); return multi_row_select( "SELECT ses.id AS ses_id, ses.title as s_title, ses.starttime, qq.id as q_id, qq.question as question, qq.type as type, ans.answer AS answer FROM conf_sessions AS ses JOIN conf_signups as sup on ses.id = sup.session JOIN conf_users as cus on cus.id = sup.user JOIN conf_q_set as qset on ses.gets_survey = qset.q_set RIGHT JOIN conf_questions as qq on qset.question = qq.id LEFT OUTER JOIN conf_answers as ans on ans.user = sup.user AND ans.question = qq.id AND ans.session = ses.id WHERE $date_clause AND ans.answer is not null ORDER BY ses.starttime, ses.track asc, qset.order", 0); } diff --git a/js/dir_app.js b/js/dir_app.js index 76a7fa3..f439bf1 100644 --- a/js/dir_app.js +++ b/js/dir_app.js @@ -2285,7 +2285,7 @@ const WorkshopHistory = Vue.component('workshophistory', {
Host
-
Attendees: {{ rosterCount(s.id) }}
+
Signups: {{ rosterCount(s.id) }}
Avg Rating: {{ avgRating(s.id) }}
@@ -2316,10 +2316,11 @@ const ActivityReport = Vue.component('activityreport', { props: [ 'which' ], data: function () { return { activities:[],hosts:[], hosts_by_sesid:[], everyone:[], questions:[], answers:{}, answers2:{}, rosters:[], - semesters:[], selectedSemesterKey:'', q:'' } }, + semesters:[], selectedSemesterKey:'', q:'', single:false } }, mounted: function() { var self = this self.buildSemesters() + self.single = (self.which && String(self.which).match(/^\d+$/)) ? true : false self.fetchRange() basic_get('dir_api.php?a=get/names', function(r2) { self.everyone = [] @@ -2362,7 +2363,9 @@ const ActivityReport = Vue.component('activityreport', { fetchRange: function() { const sem = this.selectedSemester let q = 'all=1' - if (sem) { + if (this.single) { + q = `id=${this.which}` + } else if (sem) { q = `begin=${sem.start.format('YYYY-MM-DD')}&end=${sem.end.format('YYYY-MM-DD')}` } var self = this @@ -2377,13 +2380,13 @@ const ActivityReport = Vue.component('activityreport', { x.searchable = ((x.title||'') + ' ' + (x.desc||'')).toLowerCase() } ) self.$forceUpdate(); }) - basic_get(`dir_api.php?a=get/hosts&${q}`, function(r2) { + basic_get(`dir_api.php?a=get/hosts&${this.single ? ('id=' + this.which) : q}`, function(r2) { self.hosts_by_sesid = _.groupBy(r2,function(x) { return x.id } ) }) - basic_get(`dir_api.php?a=get/rosters&${q}`, function(r2) { + basic_get(`dir_api.php?a=get/rosters&${this.single ? ('id=' + this.which) : q}`, function(r2) { self.rosters = _.groupBy(r2,function(x) { return x.sesid } ) }) - basic_get(`dir_api.php?a=get/answers/all&${q}`, function(r2) { + basic_get(`dir_api.php?a=get/answers/all&${this.single ? ('id=' + this.which) : q}`, function(r2) { var organized = _.groupBy(r2, function(x) { return x.ses_id; } ) self.answers = {} self.answers2 = {} @@ -2464,7 +2467,7 @@ const ActivityReport = Vue.component('activityreport', { return this.activities.filter(a => { // semester filter let ok = true - if (sem) { + if (!this.single && sem) { const t = dayjs(a.starttime) ok = t.isAfter(sem.start) && t.isBefore(sem.end) } @@ -2474,6 +2477,7 @@ const ActivityReport = Vue.component('activityreport', { return false } // text filter against title/desc/hosts + if (this.single) return true if (!q) return true const hay = (a.title + ' ' + (a.desc||'') + ' ' + (this.hoststr(a.id)||'')).toLowerCase() return hay.indexOf(q) !== -1 @@ -2481,11 +2485,11 @@ const ActivityReport = Vue.component('activityreport', { } }, watch: { - selectedSemesterKey() { this.fetchRange() } + selectedSemesterKey() { if (!this.single) this.fetchRange() } }, template: `
-
+