Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add organizations and contact points per country to statistics table #489

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions jargon.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ contactPage
countryID
countryLabel
countryURI
cp
cron
crowdsourced
csv
Expand Down
43 changes: 40 additions & 3 deletions templates/statistics.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,49 @@ <h2>Coverage overview</h2>
<p>In the table below we have listed the types of organizations that are covered for each country. The amount of information about those organizations and contact points for them varies and is also improved over time.</p>

<table>
{{- range . -}}
<tr>
Ainali marked this conversation as resolved.
Show resolved Hide resolved
<th class="js-sort-none"><a href="../{{ .safeName }}/">{{ .name }}</a></th>
<th class="js-sort-none">Country</th>
<th class="js-sort-none">Contains</th>
<th class="js-sort-none">Organizations</th>
<th class="js-sort-none">Contact points</th>
<tr>
{{- range . -}}
{{- $social_cp_count := 0 -}}
{{- $other_cp := 0 -}}
{{- $country_org_count := 0 -}}
{{- $country := .safeName.String -}}
{{- $orgs := query (join "" "generators/" $country ".rq") -}}
{{- $country_org_count = add (len $orgs) $country_org_count -}}
{{- range $orgs -}}
{{ $social_cp_count = add (len (query "account-data.rq" .qid.String)) $social_cp_count }}
{{- $org_details := index (query "organization-optional.rq" .qid.String) 0 -}}

{{- if $org_details.email -}}
{{- $other_cp = add1 $other_cp -}}
{{- end -}}

{{- if $org_details.website -}}
{{- $other_cp = add1 $other_cp -}}
{{- end -}}

{{- if $org_details.phone -}}
{{- $other_cp = add1 $other_cp -}}
{{- end -}}

{{- if $org_details.contactPage -}}
{{- $other_cp = add1 $other_cp -}}
{{- end -}}

{{- if $org_details.citizensInitiatives -}}
{{- $other_cp = add1 $other_cp -}}
{{- end -}}
{{- end -}}
<td lang="{{ .description.Lang }}"><a href="../{{ .safeName }}/">{{ .name }}</a></td>
<td lang="{{ .description.Lang }}">{{ .description }}</td>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be nice with a max-width of ~500px to ensure that the contact points title doesn't break on large screens.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I liked that it broke on my screen to make the column narrower.

</tr>
<td>{{ $country_org_count }}</td>
<td>{{ add $social_cp_count $other_cp }}</td>
{{- end -}}
</tr>
</table>

</main>
Expand Down
Loading