Skip to content

Commit ed3fabc

Browse files
committed
fix: look for country code IT in publiccode data
Following italia/publiccode-crawler#468, the publiccode data returned by the API use the key `IT` rather than `it` for the country specific part.
1 parent 1ad043d commit ed3fabc

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

_includes/home-listing-sw.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ <h2 class="h1">{{title}}</h2>
3030
<div class="col-md {% if withimages!=true %}px-3{%endif%}">
3131
{% if withimages == true %}
3232

33-
{% if item.publiccode.it.riuso.codiceIPA != nil %}
33+
{% if item.publiccode.IT.riuso.codiceIPA != nil %}
3434
{% assign category = "software_reuse" %}
3535
{% assign icon = "it-software" %}
3636
{% assign fallback = "/assets/images/cover_softwareriuso.png" %}

_includes/software-listing.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
{% assign sw_name = description.localisedName | default: software.publiccode.name %}
1010

1111
{% assign sw_url = '/' | append: active_lang | append: '/software/' | append: software.slug | downcase %}
12-
{% if software.publiccode.it.riuso.codiceIPA != nil %}
12+
{% if software.publiccode.IT.riuso.codiceIPA != nil %}
1313
{% assign category = "software_reuse" %}
1414
{% assign icon = "it-software" %}
1515
{% assign fallback = "/assets/images/cover_softwareriuso.png" %}

_layouts/brand-pa.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
{% include linklist.html items=subnav dynamic=true %}
1414
{% endcomment %}
1515

16-
{% assign generic_sw = site.data.crawler.software | where_exp: "item", "item.publiccode.it.riuso.codiceIPA == page.ipa" | nested_sort_natural: "publiccode.name" | slice: 0, 60 %}
16+
{% assign generic_sw = site.data.crawler.software | where_exp: "item", "item.publiccode.IT.riuso.codiceIPA == page.ipa" | nested_sort_natural: "publiccode.name" | slice: 0, 60 %}
1717

1818
{% assign root = '/' | append: active_lang %}
1919

_layouts/software-details.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ <h3 class="color-content font-serif my-2 my-md-4">
8383
{% if page.publiccode.legal.repoOwner %}
8484
<div class="col-sm">
8585
<p><span class="label">Gestito da</span>
86-
{% if page.publiccode.it.riuso.codiceIPA %}
87-
<a href="/{{ active_lang }}/pa/{{ page.publiccode.it.riuso.codiceIPA | downcase }}">
86+
{% if page.publiccode.IT.riuso.codiceIPA %}
87+
<a href="/{{ active_lang }}/pa/{{ page.publiccode.IT.riuso.codiceIPA | downcase }}">
8888
{{ page.publiccode.legal.repoOwner }}
8989
</a>
9090
{% else %}
@@ -548,7 +548,7 @@ <h2>
548548
<div class="col-6 col-md">
549549
<p>
550550
<span class="label">{{ t.software.enabling_platforms }}</span>
551-
{% assign p = page.publiccode.it.piattaforme %}
551+
{% assign p = page.publiccode.IT.piattaforme %}
552552
{% assign all_false = true %}
553553
{% for key in p %}
554554
{% if key.last == true %}
@@ -590,7 +590,7 @@ <h2>
590590
<div class="col-6 col-md">
591591
<p>
592592
<span class="label">{{ t.software.compliance }}</span>
593-
{% assign p = page.publiccode.it.conforme %}
593+
{% assign p = page.publiccode.IT.conforme %}
594594
{% assign all_false = true %}
595595
{% for key in p %}
596596
{% if key.last == true %}
@@ -754,7 +754,7 @@ <h2> {{ t.software.interest_related_softwares }} </h2>
754754
{% assign relsw_name = relsw_description.localisedName | default: relsw.publiccode.name %}
755755
{% assign relsw_url = '/' | append: active_lang | append: '/software/' | append: relsw.slug | downcase %}
756756

757-
{% if relsw.publiccode.it.riuso.codiceIPA != nil %}
757+
{% if relsw.publiccode.IT.riuso.codiceIPA != nil %}
758758
{% assign category = "software_reuse" %}
759759
{% assign icon = "it-software" %}
760760
{% assign fallback = "/assets/images/cover_softwareriuso.png" %}

_layouts/software.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
{% endcomment %}
1313

1414
{% assign recent_sw = site.data.crawler.software | sort: "publiccode.releaseDate" | reverse | slice: 0, 4 %}
15-
{% assign efficient_pas = site.data.crawler.software | where_exp: "item", "item.publiccode.it.riuso.codiceIPA != nil" | group_by: "publiccode.it.riuso.codiceIPA" | sort: "size" | reverse | slice: 0, 3 %}
15+
{% assign efficient_pas = site.data.crawler.software | where_exp: "item", "item.publiccode.IT.riuso.codiceIPA != nil" | group_by: "publiccode.IT.riuso.codiceIPA" | sort: "size" | reverse | slice: 0, 3 %}
1616

1717
<div class="container">
1818
<div class="intro mt-5">

assets/js/api/elasticSearch.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ export const querySoftware = async ({ type, searchValue, filters, sortBy, from,
2626
}
2727

2828
if (type === SOFTWARE_REUSE) {
29-
must.push({ exists: { field: 'publiccode.it.riuso.codiceIPA' } });
29+
must.push({ exists: { field: 'publiccode.IT.riuso.codiceIPA' } });
3030
}
3131

3232
const must_not = [];
3333

3434
if (type === SOFTWARE_OPEN) {
3535
must_not.push(
36-
{ exists: { field: 'publiccode.it.riuso.codiceIPA' } },
37-
{ match: { 'publiccode.indendedAudience.unsupportedCountries': 'it' } }
36+
{ exists: { field: 'publiccode.IT.riuso.codiceIPA' } },
37+
{ match: { 'publiccode.indendedAudience.unsupportedCountries': 'IT' } }
3838
);
3939
}
4040

assets/js/services/searchEngine.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ const softwareItem = (source) => {
126126
const name = descriptionField?.localisedName ?? source.publiccode.name;
127127

128128
// Create a default empty object for 'it' if it doesn't exist
129-
// This ensures source.publiccode.it will never be undefined
130-
if (source.publiccode && !source.publiccode.it) {
131-
source.publiccode.it = {};
129+
// This ensures source.publiccode.IT will never be undefined
130+
if (source.publiccode && !source.publiccode.IT) {
131+
source.publiccode.IT = {};
132132
}
133133

134134
// Handle safely accessing nested properties that might not exist

0 commit comments

Comments
 (0)