Skip to content

Commit 293fc22

Browse files
committed
Update Top Speakers section to display speaker frequency instead of recent events
1 parent 9f38a59 commit 293fc22

File tree

1 file changed

+33
-84
lines changed

1 file changed

+33
-84
lines changed

_pages/statistics.md

Lines changed: 33 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,18 @@ Here you can find insights about our Cloud Native Computing Linz meetups includi
4949
</div>
5050
</div>
5151

52-
### Recent Speakers (Last 15 Events)
52+
### Top 15 Speakers
5353
<div class="chart-container">
5454
<canvas id="topSpeakersChart"></canvas>
5555
<div id="topSpeakersFallback" style="display: none;">
56-
<div class="chart-title">🎤 Recent Speakers</div>
56+
<div class="chart-title">🎤 Top Speakers</div>
5757
<table class="stats-table">
5858
<thead>
59-
<tr><th>Speaker</th><th>Most Recent Event</th><th>Presentations</th><th>Visual</th></tr>
59+
<tr><th>Speaker</th><th>Presentations</th><th>Visual</th></tr>
6060
</thead>
6161
<tbody>
62-
{% comment %} Get the last 15 events (most recent) {% endcomment %}
63-
{% assign recent_events = site.data.events | reverse | slice: 0, 15 %}
6462
{% assign speakers = "" | split: "|" %}
65-
{% assign speaker_events = "" | split: "|" %}
66-
{% for event in recent_events %}
63+
{% for event in site.data.events %}
6764
{% if event.talks %}
6865
{% for talk in event.talks %}
6966
{% if talk.speaker and talk.speaker != '' %}
@@ -79,7 +76,6 @@ Here you can find insights about our Cloud Native Computing Linz meetups includi
7976
{% assign single_speaker = part | strip %}
8077
{% if single_speaker != '' %}
8178
{% assign speakers = speakers | push: single_speaker %}
82-
{% assign speaker_events = speaker_events | push: single_speaker | append: '###' | append: event.date | append: '###' | append: event.title %}
8379
{% endif %}
8480
{% endfor %}
8581
{% endif %}
@@ -90,47 +86,27 @@ Here you can find insights about our Cloud Native Computing Linz meetups includi
9086
{% assign speaker_rows = "" | split: "|" %}
9187
{% for speaker in unique_speakers %}
9288
{% assign count = 0 %}
93-
{% assign most_recent_date = '' %}
94-
{% assign most_recent_title = '' %}
9589
{% for s in speakers %}
9690
{% if s == speaker %}
9791
{% assign count = count | plus: 1 %}
9892
{% endif %}
9993
{% endfor %}
100-
{% comment %} Find the most recent event for this speaker {% endcomment %}
101-
{% for entry in speaker_events %}
102-
{% assign parts = entry | split: '###' %}
103-
{% if parts[0] == speaker %}
104-
{% if most_recent_date == '' or parts[1] > most_recent_date %}
105-
{% assign most_recent_date = parts[1] %}
106-
{% assign most_recent_title = parts[2] %}
107-
{% endif %}
108-
{% endif %}
109-
{% endfor %}
110-
{% assign speaker_rows = speaker_rows | push: speaker | append: '|||' | append: count | append: '|||' | append: most_recent_date | append: '|||' | append: most_recent_title %}
111-
{% endfor %}
112-
{% comment %} Sort by most recent date (descending) {% endcomment %}
113-
{% assign sorted_speaker_rows = speaker_rows | sort %}
114-
{% assign final_sorted_rows = "" | split: "|" %}
115-
{% for row in sorted_speaker_rows %}
116-
{% assign final_sorted_rows = final_sorted_rows | unshift: row %}
94+
{% assign speaker_rows = speaker_rows | push: speaker | append: '|||' | append: count %}
11795
{% endfor %}
118-
{% for entry in final_sorted_rows %}
96+
{% assign sorted_speaker_rows = speaker_rows | sort_natural %}
97+
{% for entry in sorted_speaker_rows %}
11998
{% assign parts = entry | split: '|||' %}
12099
{% assign speaker = parts[0] %}
121100
{% assign count = parts[1] %}
122-
{% assign event_date = parts[2] %}
123-
{% assign event_title = parts[3] %}
124101
<tr>
125102
<td>{{ speaker }}</td>
126-
<td><strong>{{ event_date }}</strong><br><small>{{ event_title }}</small></td>
127103
<td class="number-cell">{{ count }}</td>
128104
<td><span class="host-bar" style="width: {{ count | times: 10 }}px;"></span> {{ count }}</td>
129105
</tr>
130106
{% endfor %}
131107
</tbody>
132108
</table>
133-
<div class="fallback-note">🎤 This shows speakers from our 15 most recent events, sorted by their latest presentation date.</div>
109+
<div class="fallback-note">🎤 This data shows which speakers have presented most often at our events.</div>
134110
</div>
135111
</div>
136112

@@ -144,7 +120,7 @@ Here you can find insights about our Cloud Native Computing Linz meetups includi
144120
<tr><th>Date</th><th>Event</th><th>Participants</th><th>Popularity</th></tr>
145121
</thead>
146122
<tbody>
147-
{% for event in site.data.events reversed %}
123+
{% for event in site.data.events %}
148124
{% assign part_str = event.participants | strip %}
149125
{% assign part_num = part_str | plus: 0 %}
150126
{% if part_str != '' and part_num > 0 %}
@@ -339,6 +315,10 @@ function initializeChartsWithoutTime() {
339315
// Process data for charts
340316
const processEventsData = (events) => {
341317
// Host frequency data (exclude 'online' and sort desc)
318+
// Reverse events for chronological order (oldest to newest)
319+
const reversedEvents = [...events].reverse();
320+
events = reversedEvents;
321+
342322
const hostCount = {};
343323
events.forEach(event => {
344324
if (event.host && event.host !== '' && event.host.toLowerCase() !== 'online') {
@@ -352,12 +332,9 @@ function initializeChartsWithoutTime() {
352332
const hostLabels = sortedHosts.map(([host]) => host);
353333
const hostData = sortedHosts.map(([, count]) => count);
354334

355-
// Recent speakers data (from last 15 events)
356-
const recentEvents = events.slice(-15); // Get last 15 events
335+
// Top speakers data
357336
const speakerCount = {};
358-
const speakerLastEvent = {};
359-
360-
recentEvents.forEach(event => {
337+
events.forEach(event => {
361338
if (event.talks && event.talks.length > 0) {
362339
event.talks.forEach(talk => {
363340
if (talk.speaker) {
@@ -382,34 +359,27 @@ function initializeChartsWithoutTime() {
382359
.map(s => s.trim()) // Trim whitespace
383360
.filter(s => s); // Remove empty strings
384361

385-
// Count each speaker and track their most recent event
362+
// Count each speaker
386363
speakers.forEach(speaker => {
387364
if (speaker) {
388365
speakerCount[speaker] = (speakerCount[speaker] || 0) + 1;
389-
// Update last event if this event is more recent
390-
if (!speakerLastEvent[speaker] || event.date > speakerLastEvent[speaker]) {
391-
speakerLastEvent[speaker] = event.date;
392-
}
393366
}
394367
});
395368
}
396369
});
397370
}
398371
});
399372

400-
// Sort speakers by most recent event date (descending)
373+
// Sort speakers by count desc
401374
const sortedSpeakers = Object.entries(speakerCount)
402-
.sort((a, b) => {
403-
const dateA = speakerLastEvent[a[0]];
404-
const dateB = speakerLastEvent[b[0]];
405-
return dateB.localeCompare(dateA); // Most recent first
406-
})
407-
.slice(0, 15); // Get top 15 most recent speakers
375+
.sort((a, b) => b[1] - a[1])
376+
.slice(0, 15); // Get top 20 speakers for better visualization
408377
const speakerLabels = sortedSpeakers.map(([speaker]) => speaker);
409378
const speakerData = sortedSpeakers.map(([, count]) => count);
410379

411380
// Participants trends (strict numeric filtering)
412-
const participantsData = events
381+
382+
const participantsData = events.reverse()
413383
.filter(event => {
414384
// Only include events where participants is a valid number
415385
if (!event.participants) return false;
@@ -549,7 +519,7 @@ function initializeChartsWithoutTime() {
549519
}
550520
});
551521

552-
// Recent Speakers Chart
522+
// Top Speakers Chart
553523
const speakersCtx = document.getElementById('topSpeakersChart').getContext('2d');
554524
new Chart(speakersCtx, {
555525
type: 'bar',
@@ -565,13 +535,6 @@ function initializeChartsWithoutTime() {
565535
},
566536
options: {
567537
...commonOptions,
568-
plugins: {
569-
...commonOptions.plugins,
570-
title: {
571-
display: true,
572-
text: 'Recent Speakers (Last 15 Events)'
573-
}
574-
},
575538
scales: {
576539
y: {
577540
beginAtZero: true,
@@ -688,6 +651,10 @@ function initializeCharts() {
688651
try {
689652
// Process data for charts
690653
const processEventsData = (events) => {
654+
// Reverse events for chronological order (oldest to newest)
655+
const reversedEvents = [...events].reverse();
656+
events = reversedEvents;
657+
691658
// Host frequency data (exclude 'online' and sort desc)
692659
const hostCount = {};
693660
events.forEach(event => {
@@ -701,12 +668,9 @@ function initializeCharts() {
701668
const hostLabels = sortedHosts.map(([host]) => host);
702669
const hostData = sortedHosts.map(([, count]) => count);
703670

704-
// Recent speakers data (from last 15 events)
705-
const recentEvents = events.slice(-15); // Get last 15 events
671+
// Top speakers data
706672
const speakerCount = {};
707-
const speakerLastEvent = {};
708-
709-
recentEvents.forEach(event => {
673+
events.forEach(event => {
710674
if (event.talks && event.talks.length > 0) {
711675
event.talks.forEach(talk => {
712676
if (talk.speaker) {
@@ -726,29 +690,21 @@ function initializeCharts() {
726690
.map(s => s.trim())
727691
.filter(s => s && s.length > 0);
728692

729-
// Count each speaker and track their most recent event
693+
// Count each speaker
730694
speakers.forEach(speaker => {
731695
if (speaker) {
732696
speakerCount[speaker] = (speakerCount[speaker] || 0) + 1;
733-
// Update last event if this event is more recent
734-
if (!speakerLastEvent[speaker] || event.date > speakerLastEvent[speaker]) {
735-
speakerLastEvent[speaker] = event.date;
736-
}
737697
}
738698
});
739699
}
740700
});
741701
}
742702
});
743703

744-
// Sort speakers by most recent event date (descending)
704+
// Sort speakers by count desc
745705
const sortedSpeakers = Object.entries(speakerCount)
746-
.sort((a, b) => {
747-
const dateA = speakerLastEvent[a[0]];
748-
const dateB = speakerLastEvent[b[0]];
749-
return dateB.localeCompare(dateA); // Most recent first
750-
})
751-
.slice(0, 15); // Get top 15 most recent speakers
706+
.sort((a, b) => b[1] - a[1])
707+
.slice(0, 20); // Get top 20 speakers for better visualization
752708
const speakerLabels = sortedSpeakers.map(([speaker]) => speaker);
753709
const speakerData = sortedSpeakers.map(([, count]) => count);
754710

@@ -892,7 +848,7 @@ function initializeCharts() {
892848
}
893849
});
894850

895-
// Recent Speakers Chart
851+
// Top Speakers Chart
896852
const speakersCtx = document.getElementById('topSpeakersChart').getContext('2d');
897853
new Chart(speakersCtx, {
898854
type: 'bar',
@@ -908,13 +864,6 @@ function initializeCharts() {
908864
},
909865
options: {
910866
...commonOptions,
911-
plugins: {
912-
...commonOptions.plugins,
913-
title: {
914-
display: true,
915-
text: 'Recent Speakers (Last 15 Events)'
916-
}
917-
},
918867
scales: {
919868
y: {
920869
beginAtZero: true,

0 commit comments

Comments
 (0)