Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: 3.12
architecture: x64
- run: pip install -r requirements_dev.txt
- run: flake8
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
env:
DATA_SUBMISSION_ENABLED: "true"
REGISTRY_PUBLISHERS_URL: ${{secrets.REGISTRY_PUBLISHERS_URL}}
Expand All @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
# Python 3.8 is used by the live cove and datastore servers
python-version: [ '3.8']
python-version: [ '3.12']
steps:
- uses: actions/checkout@v2
- name: Setup python
Expand Down
2 changes: 1 addition & 1 deletion cove/cove_360/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class ResultsApiView(View):
def get(self, *args, **kwargs):
results = get_object_or_404(SuppliedDataStatus, supplied_data=kwargs["id"])
results = get_object_or_404(SuppliedDataStatus, supplied_data=kwargs["pk"])

return JsonResponse(
{
Expand Down
1 change: 1 addition & 0 deletions cove/cove_360/templates/additional_codelist_values.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% load i18n %}
{% load cove_tags %}
{% load cove_360_tags %}

<table class="table">
<thead>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% load i18n %}
{% load cove_tags %}
{% load cove_360_tags %}

<table class="table">
<thead>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% load i18n %}
{% load cove_tags %}
{% load cove_360_tags %}

<table class="table">
<thead><tr> <th class="col-md-4">{% trans 'Field' %}</th> <th>{% trans 'Path to Field' %}</th> <th class="col-md-2">{% trans 'Usage Count' %}</th> </tr></thead>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% load i18n %}
{% load cove_tags %}
{% load cove_360_tags %}

<table class="table">
<thead>
Expand Down
2 changes: 1 addition & 1 deletion cove/cove_360/templates/cove_360/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<path fill-rule="evenodd" clip-rule="evenodd" d="M7 5.83333C6.70833 5.83333 6.41667 6.06667 6.41667 6.41667V9.91667C6.41667 10.2667 6.65 10.5 7 10.5C7.29167 10.5 7.58333 10.2667 7.58333 9.91667V6.41667C7.58333 6.125 7.29167 5.83333 7 5.83333ZM7 3.5C6.70833 3.5 6.41667 3.73333 6.41667 4.08333C6.41667 4.375 6.65 4.66667 7 4.66667C7.29167 4.66667 7.58333 4.43333 7.58333 4.08333C7.58333 3.79167 7.29167 3.5 7 3.5ZM7 0C3.15 0 0 3.15 0 7C0 10.85 3.15 14 7 14C10.85 14 14 10.85 14 7C14 3.15 10.85 0 7 0ZM7 12.8333C3.79167 12.8333 1.16667 10.2083 1.16667 7C1.16667 3.79167 3.79167 1.16667 7 1.16667C10.2083 1.16667 12.8333 3.79167 12.8333 7C12.8333 10.2083 10.2083 12.8333 7 12.8333Z" fill="#1D1536"/>
</svg>
</span>
<span class="alert-tag__content">Noticed the new look? <a href="#TODO">Read our blog to learn more about what's changed</a> TODO link</span>
<span class="alert-tag__content">Noticed the new look? <a href="https://www.360giving.org/2025/03/25/upgraded-data-quality-tool/">Read our blog to learn more about what's changed</a></span>
</div>
{# End temp for launch #}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% load i18n %}
{% load humanize %}
{% load cove_tags %}
{% load cove_360_tags %}

<h2>Accuracy</h2>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% load i18n %}
{% load humanize %}
{% load cove_tags %}
{% load cove_360_tags %}
<h2>
{% blocktrans count n_additional_fields=additional_fields_count %} Additional fields{% plural %} Additional fields{% endblocktrans %}
</h2>
Expand All @@ -21,4 +22,4 @@ <h2>
{% cove_360_modal_errors className="additional-checks-"|concat:forloop.counter modalTitle=msg errorList=spreadsheet_location file_type=file_type full_table=False %}
{% endif %}
{% endwith %}
{% endfor %}
{% endfor %}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% load i18n %}
{% load humanize %}
{% load cove_tags %}
{% load cove_360_tags %}


<h2>{% trans "Summary" %}</h2>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% load i18n %}
{% load humanize %}
{% load cove_tags %}
{% load cove_360_tags %}

<h2>Usefulness Opportunities</h2>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% load i18n %}
{% load humanize %}
{% load cove_tags %}
{% load cove_360_tags %}

<h2>Validity checks
{% if validation_and_closed_codelist_errors_count > 0 %}
Expand Down Expand Up @@ -72,4 +73,4 @@ <h3>Other</h3>
<p >Other validation errors.</p>
{% include "cove_360/validation_table.html" %}
{% endif %}
{% endwith %}
{% endwith %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{% load i18n %} {% load humanize %} {% load cove_tags %}
{% load i18n %}
{% load humanize %}
{% load cove_tags %}
{% load cove_360_tags %}

{% trans 'Converted from Original' as converted %}
{% trans 'Original' as original %}
Expand Down Expand Up @@ -182,4 +185,4 @@ <h2 class="base-card__title">
<div class="spacer-4"></div>

<script>
</script>
</script>
1 change: 1 addition & 0 deletions cove/cove_360/templates/cove_360/explore_advanced.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% extends 'cove_360/base.html' %}
{% load humanize %}
{% load cove_tags %}
{% load cove_360_tags %}

{% block content %}

Expand Down
1 change: 1 addition & 0 deletions cove/cove_360/templates/cove_360/modal_errors.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% load i18n %}
{% load cove_tags %}
{% load cove_360_tags %}
<div class="modal {{className}}" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal__overlay modal__trigger"></div>
<div class="modal__window">
Expand Down
1 change: 1 addition & 0 deletions cove/cove_360/templates/cove_360/validation_table.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% load i18n %}
{% load cove_tags %}
{% load cove_360_tags %}

{% for error_json, error_extra in validation_errors %}
{% with error=error_json|json_decode %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ def multiply(a, b):
res = a*b

if res < 1:
return f"{(a*b):.1f}"
return f"{(a*b): .1f}"

return int(round(res))
30 changes: 12 additions & 18 deletions cove/cove_360/tests/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ def wait_for_results_page(browser):
def browser(request):
if BROWSER == 'Chrome':
chrome_options = Options()
browser = webdriver.Chrome(chrome_options=chrome_options)
browser = webdriver.Chrome(options=chrome_options)
elif BROWSER == 'ChromeHeadless':
chrome_options = Options()
chrome_options.add_argument("--headless")
# uncomment this if "DevToolsActivePort" error
# chrome_options.add_argument("--remote-debugging-port=9222")
browser = webdriver.Chrome(chrome_options=chrome_options)
browser = webdriver.Chrome(options=chrome_options)
else:
browser = getattr(webdriver, BROWSER)()

Expand Down Expand Up @@ -130,7 +130,7 @@ def server_url(request, live_server):
'0 is not a JSON object',
'amountAwarded is not a number. Check that the value is not null, and doesn’t contain any characters other than 0-9 and dot (.). Number values should not be in quotes.',
'plannedDates is not a JSON array',
'title is not a string. Check that the value is not null, and has quotes at the start and end. Escape any quotes in the value with \ (more info about this error)',
'title is not a string. Check that the value is not null, and has quotes at the start and end. Escape any quotes in the value with \\ (more info about this error)',
'Invalid \'uri\' found (more info about this error)',
'Invalid code found in currency (more info about this error)',
'[] is too short. You must supply at least one value, or remove the item entirely (unless it’s required).',
Expand Down Expand Up @@ -406,19 +406,9 @@ def test_error_modal(server_url, browser, httpserver, source_filename):
assert len(table_rows) == 4


@pytest.mark.parametrize(('data_url'), [
reverse_lazy('results', args=['0']),
reverse_lazy('results', args=['324ea8eb-f080-43ce-a8c1-9f47b28162f3']),
])
def test_url_invalid_dataset_request(server_url, browser, data_url):
# Test a badly formed hexadecimal UUID string
# Trim the / off reverse_lazy result as server_url has trailing slash to avoid
# e.g. //results/0

browser.get("%s%s" % (server_url, data_url[1:]))
assert "We don't seem to be able to find the data you requested." in browser.find_element(By.TAG_NAME, 'body').text
def test_url_invalid_dataset_request(server_url, browser):
# Test for well formed UUID that doesn't identify any dataset that exists
browser.get("%s%s" % (server_url, reverse_lazy('results', args=['38e267ce-d395-46ba-acbf-2540cdd0c810'])[1:]))
browser.get("%s%s" % (server_url, reverse_lazy('results', args=['38e267ce-d395-46ba-acbf-2540cdd0c810'])))
assert "We don't seem to be able to find the data you requested." in browser.find_element(By.TAG_NAME, 'body').text
assert '360Giving' in browser.find_element(By.TAG_NAME, 'body').text

Expand All @@ -430,9 +420,13 @@ def test_500_error(server_url, browser):


def test_common_errors_page(server_url, browser):
browser.get(server_url + 'common_errors/')
assert "Common Errors" in browser.find_element(By.TAG_NAME, 'body').text
assert '360Giving' in browser.find_element(By.TAG_NAME, 'body').text
path = reverse_lazy("common_errors")
browser.get(f"{server_url}/{path}")
content = browser.find_element(By.CLASS_NAME, "layout__content").text
# Make sure the expected page has loaded
assert "Common Errors" in content
# Make sure it is the 360Giving version
assert "360Giving" in content


def test_favicon(server_url, browser):
Expand Down
2 changes: 1 addition & 1 deletion cove/cove_360/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from django.http import HttpResponse, JsonResponse
from django.shortcuts import redirect, render
from django.utils.html import format_html
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.core.cache import cache

from libcove.config import LibCoveConfig
Expand Down
19 changes: 9 additions & 10 deletions cove/cove_project/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from django.conf.urls import url
from django.conf.urls.static import static
from django.conf import settings
from django.urls import path
Expand All @@ -10,15 +9,15 @@
import cove_360.api

urlpatterns += [
url(r'^results/(.+)/advanced$', cove_360.views.explore_360, name='results', kwargs=dict(template='cove_360/explore_advanced.html')),
url(r'^results/(.+)$', cove_360.views.explore_360, name='results'),
url(r'^data/(.+)$', cove_360.views.data_loading, name='explore'),
path("api/results/<uuid:id>", cove_360.api.ResultsApiView.as_view(), name="api-results"),
url(r'^xhr_results_ready/(.+)$', cove_360.views.results_ready, name='xhr_results_ready'),
url(r'^common_errors', cove_360.views.common_errors, name='common_errors'),
url(r'^additional_checks', cove_360.views.additional_checks, name='additional_checks'),
path("submit/", TemplateView.as_view(template_name="cove_360/publishing.html", extra_context={"submission_tool": True}), name="publishing"),
path("terms-conditions/", TemplateView.as_view(template_name="cove_360/terms.html"), name="terms-conditions"),
path("results/<uuid:pk>/advanced", cove_360.views.explore_360, name='results', kwargs=dict(template='cove_360/explore_advanced.html')),
path("results/<uuid:pk>", cove_360.views.explore_360, name='results'),
path("data/<uuid:pk>", cove_360.views.data_loading, name='explore'),
path("api/results/<uuid:pk>", cove_360.api.ResultsApiView.as_view(), name="api-results"),
path("xhr_results_ready/<uuid:pk>", cove_360.views.results_ready, name='xhr_results_ready'),
path("common_errors", cove_360.views.common_errors, name='common_errors'),
path("additional_checks", cove_360.views.additional_checks, name='additional_checks'),
path("submit", TemplateView.as_view(template_name="cove_360/publishing.html", extra_context={"submission_tool": True}), name="publishing"),
path("terms-conditions", TemplateView.as_view(template_name="cove_360/terms.html"), name="terms-conditions"),
]

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
6 changes: 3 additions & 3 deletions lib360dataquality/cove/threesixtygiving.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ def check_charity_number(charity_number):
return False


company_pattern_re = re.compile("^\w{8}$")
company_pattern_re = re.compile(r"^\w{8}$")


def check_company_number(company_number):
Expand Down Expand Up @@ -977,7 +977,7 @@ def process(self, grant, path_prefix):
self.message = mark_safe(self.check_text["message"][self.grants_percentage])


compiled_email_re = re.compile("[\w.-]+@[\w.-]+\.[\w.-]+")
compiled_email_re = re.compile(r"[\w.-]+@[\w.-]+\.[\w.-]+")


class LooksLikeEmail(AdditionalTest):
Expand Down Expand Up @@ -1713,7 +1713,7 @@ def process(self, grant, path_prefix):
# This is a simple regex, for something that "looks roughly like a postcode",
# which is all we need here.
# Modified to match when there are accidental leading and trailing spaces.
postcode_re = re.compile("^\s*[a-z]{1,2}\d[a-z\d]?\s*\d[a-z]{2}\s*$", re.IGNORECASE)
postcode_re = re.compile(r"^\s*[a-z]{1,2}\d[a-z\d]?\s*\d[a-z]{2}\s*$", re.IGNORECASE)


# Note that we ignore Geographic Code Type here because people putting in
Expand Down
2 changes: 1 addition & 1 deletion requirements_cove.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-e file:./
Django>3.2,<3.3
Django<5
flattentool>=0.17.0
libcove>=0.30.0
libcoveweb==0.31.1
Expand Down
Loading