Adds duration and number of participants in conferences lists.

main
Yasen Pramatarov 2024-06-17 13:30:47 +03:00
parent 76384d2216
commit 3db637ab65
3 changed files with 43 additions and 3 deletions

View File

@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file.
### Added ### Added
- Initial changelog following the keepachangelog.com format - Initial changelog following the keepachangelog.com format
- Added "silent" option to jilo-cli, suitable for scripting - Added "silent" option to jilo-cli, suitable for scripting
- Added time duration and number of participants in conferences listings
### Changed ### Changed
- Updated the way jilo-cli handles multiple options, added filtering conferences by time period - Updated the way jilo-cli handles multiple options, added filtering conferences by time period

View File

@ -12,6 +12,7 @@
- issues - issues
- errors - errors
- ~~info about JVBs used~~ - ~~info about JVBs used~~
- ~~add to conference listings: duration, number of participants~~
* Web interface * Web interface
- initial version - initial version
--- ---
@ -20,3 +21,4 @@
- ~~finish SQL refactoring, move to separate tables for conferences and participants, linked by id~~ - ~~finish SQL refactoring, move to separate tables for conferences and participants, linked by id~~
- ~~update jilo-cli to work with new SQL~~ - ~~update jilo-cli to work with new SQL~~
- ~~fix sqlite and mysql schemas differences with the new SQL~~ - ~~fix sqlite and mysql schemas differences with the new SQL~~
- there is a bug in '-c CONFERENCE_ID' - it doesn't always show the first participant

View File

@ -53,8 +53,28 @@ IMPORTANT_TEXT=${IMPORTANT_TEXT:-$DEFAULT_IMPORTANT_TEXT}
db_conferences_all_formatted_template=" db_conferences_all_formatted_template="
SELECT DISTINCT SELECT DISTINCT
c.jitsi_component, c.jitsi_component,
(SELECT ce.time
FROM conference_events ce
WHERE
ce.conference_id = c.conference_id
AND
ce.conference_event = 'conference expired')
AS start,
(SELECT ce.time
FROM conference_events ce
WHERE
ce.conference_id = c.conference_id
AND
ce.conference_event = 'conference created')
AS end,
c.conference_id, c.conference_id,
c.conference_name, c.conference_name,
(SELECT COUNT(pe.participant_id) AS participants
FROM participant_events pe
WHERE
pe.event_type = 'participant joining'
AND
pe.event_param = c.conference_id),
name_counts.name_count, name_counts.name_count,
c.conference_host c.conference_host
FROM FROM
@ -574,6 +594,22 @@ parse_time_range() {
time_range_specified=true time_range_specified=true
} }
# we have two timestamps in format YYYY-MM-DD HH:MM:SS.sss
# calculate and return the durtion in format HH:MM:SS
calculate_duration() {
start=$(date -d "$1" +"%s")
end=$(date -d "$2" +"%s")
duration_seconds=$((end - start))
hours=$((duration_seconds / 3600))
duration_seconds_remain=$((duration_seconds % 3600))
minutes=$((duration_seconds_remain / 60))
seconds=$((duration_seconds_remain % 60))
# add leading zeroes
duration=$(printf "%02d:%02d:%02d" $hours $minutes $seconds)
}
### commandline options ### commandline options
conference_arg="" conference_arg=""
@ -730,12 +766,13 @@ if [[ "$conference_option" == true ]]; then
fi fi
header+="\n" header+="\n"
echo -e "$header" echo -e "$header"
output="component\tconference ID\tconference name\tname count\tconference host\n" output="component\tduration\tconference ID\tconference name\tparticipants\tname count\tconference host\n"
fi fi
# prepare the formatted rows # prepare the formatted rows
for row in "${conference_array[@]}"; do for row in "${conference_array[@]}"; do
IFS='|' read -r jitsi_component conference_id conference_name name_count conference_host <<< "$row" IFS='|' read -r jitsi_component end start conference_id conference_name participants name_count conference_host <<< "$row"
output+="$jitsi_component\t$conference_id\t$conference_name\t$name_count\t$conference_host\n" calculate_duration "$start" "$end"
output+="$jitsi_component\t$duration\t$conference_id\t$conference_name\t$participants\t$name_count\t$conference_host\n"
done done
# output # output
echo -e "$output" | column -t -s $'\t' echo -e "$output" | column -t -s $'\t'