Skip to content

Commit

Permalink
fix missing f/o
Browse files Browse the repository at this point in the history
  • Loading branch information
hexylena committed Dec 19, 2024
1 parent b63abad commit 9e6f1f1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
15 changes: 9 additions & 6 deletions _layouts/community.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ <h1>{{ topic.title }} — Community Home</h1>
<div class="col-md-6">
<figure>
<canvas id="workflows-over-time" height="250"></canvas>
<figcaption>workflows Over Time</figcaption>
<figcaption>Workflows Over Time</figcaption>
</figure>
</div>
<div class="col-md-6">
Expand Down Expand Up @@ -118,6 +118,9 @@ <h2>Cumulative Data as CSV</h2>
padding: 0.5em;
background: var(--stat-box-color);
}
.col-md-8 .row .col-md-12 h3:first-child {
margin-top: 0;
}

body[data-brightness="dark"] .stat-box {
background: none;
Expand Down Expand Up @@ -250,32 +253,32 @@ <h2>Cumulative Data as CSV</h2>
datasets: [
{
data: totals.news,
label: 'news',
label: 'News',
borderColor: getStyleDarker("news", true, true),
backgroundColor: getStyleDarker("news", true, false),
backgroundColor: getStyleDarker("news", false),
},
{
data: totals.events,
label: 'events',
label: 'Events',
borderColor: getStyleDarker("events", true),
backgroundColor: getStyleDarker("events", false),
},
{
data: totals['learning-pathways'],
label: 'learning-pathways',
label: 'Learning Pathways',
borderColor: getStyleDarker("learning-pathways", true),
backgroundColor: getStyleDarker("learning-pathways", false),
},
{
data: totals.recordings,
label: 'recordings',
label: 'Recordings',
borderColor: getStyleDarker("recordings", true),
backgroundColor: getStyleDarker("recordings", false),
},
{
data: totals.faqs,
label: 'faqs',
label: 'Faqs',
borderColor: getStyleDarker("faqs", true),
backgroundColor: getStyleDarker("faqs", false),
},
Expand Down
12 changes: 8 additions & 4 deletions _plugins/jekyll-topic-filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1552,10 +1552,12 @@ def list_materials_flat(site, topic_name)
def list_topic_materials_yearly(site, topic_name)
flat_mats = list_materials_flat(site, topic_name)
years = flat_mats.map{|x| x['pub_date'].year} + flat_mats.map{|x| x['mod_date'].year}
topic_contribs = identify_contributors({'topic' => {'materials' => flat_mats}}, site)
# doesn't use identify_contributors because that excludes grants/orgs.
topic_contribs = flat_mats.map{|x| x['contributions'] || {"all" => x['contributors']}}.map{|x| x.values.flatten}.flatten.uniq.sort
pfo = ['contributors', 'grants', 'organisations']

Gtn::TopicFilter.all_date_sorted_resources(site)
.select{|x| (x[3].include? topic_name) || (x[1] == 'contributors' && topic_contribs.include?(x[2].title[1..]))}
.select{|x| (x[3].include? topic_name) || (pfo.include?(x[1]) && topic_contribs.include?(x[2].title[1..]))}
.group_by{|x| x[0].year}
.map{|k, v| [k, v.group_by{|z| z[1]}]}
.to_h
Expand All @@ -1564,10 +1566,12 @@ def list_topic_materials_yearly(site, topic_name)
def count_topic_materials_yearly(site, topic_name)
flat_mats = list_materials_flat(site, topic_name)
years = flat_mats.map{|x| x['pub_date'].year} + flat_mats.map{|x| x['mod_date'].year}
topic_contribs = identify_contributors({'topic' => {'materials' => flat_mats}}, site)
# doesn't use identify_contributors because that excludes grants/orgs.
topic_contribs = flat_mats.map{|x| x['contributions'] || {"all" => x['contributors']}}.map{|x| x.values.flatten}.flatten.uniq.sort
pfo = ['contributors', 'grants', 'organisations']

r = Gtn::TopicFilter.all_date_sorted_resources(site)
.select{|x| (x[3].include? topic_name) || (x[1] == 'contributors' && topic_contribs.include?(x[2].title[1..]))}
.select{|x| (x[3].include? topic_name) || (pfo.include?(x[1]) && topic_contribs.include?(x[2].title[1..]))}
.map{|x| [x[0].year, x[1]]} # Only need year + type
.group_by{|x| x[1]} # Group by type.
.map{|k, v| [k, v.map{|vv| vv[0]}.tally]}
Expand Down

0 comments on commit 9e6f1f1

Please sign in to comment.