Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwood committed Dec 10, 2024
1 parent 4e76afe commit de33d58
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 11 deletions.
6 changes: 3 additions & 3 deletions cove/cove_360/templates/cove_360/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<meta name="description"
content="360Giving Data Quality tool helps publishers to check their data conforms to the 360Giving Data Standard and submit the data for publishing." />

<title>{% block header_title %}360Giving Data Quality Tool{% endblock %}</title>
<title>360Giving Data {% if submission_tool %}Submission{% else %}Quality{% endif %} Tool</title>

<link rel="shortcut icon" href="{% static 'dataexplore/images/favicon/favicon.ico' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'dataexplore/css/main.css' %}?v={{request.tag}}">
Expand Down Expand Up @@ -62,8 +62,8 @@
<a href="/"><img src="{% static 'dataexplore/images/360-giving-logo.svg' %}" alt="360 Giving"></a>
</div>
<div class="hero__column hero__lead">
<h2 class="hero__title">{% block hero_title %}Data Quality Tool{% endblock %}</h2>
<p class="hero__blurb">{% block hero_blurb %}Convert, Validate, Explore 360 Giving Data.{% endblock %}</p>
<h2 class="hero__title">Data {% if submission_tool %}Submission{% else %}Quality{% endif %} Tool</h2>
<p class="hero__blurb">{% if submission_tool %}Submit your 360Giving data file to be included in the 360Giving Data Registry and tools{% else %}Convert, Validate, Explore 360 Giving Data.{% endif %}</p>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
{# Translators: JSON probably does not need a transalation: http://www.json.org/ #}
{% trans 'JSON' as JSON %}
{% trans 'XML' as XML %}

<h3>{% trans "Submit your data" %}</h3>

{% if validation_and_closed_codelist_errors_count > 0 %}
<div class="base-card base-card--red margin-bottom:2">
<div class="base-card__content">
<h2 class="base-card__title">
Expand All @@ -22,14 +22,16 @@ <h2 class="base-card__title">
</div>
</div>

{% endif %}

{% if data_status.can_publish %}
<p>{% trans "Submitting for: " %}<strong>{{publisher.name}}</strong></p>
<p>{% trans "The data was checked and can now be submitted to the 360Giving Data Registry." %}</p>
<p>
{% trans "Click the 'Submit your file' to fill out the 360Giving data file submission form. " %}
<a href="https://standard.threesixtygiving.org/en/latest/guidance/submit-data/" >{% trans "Guidance about using the submission form." %}</a>
</p>
<a class="button button--teal button--solid" style="opacity: 0.5" id="sf-form-link" href="https://d24000000jfkieay.my.site.com/dda/s/?id={{data_status.supplied_data.id}}" disabled>
<a class="button button--teal button--solid" id="sf-form-link" href="https://d24000000jfkieay.my.site.com/dda/s/?id={{data_status.supplied_data.id}}">
Submit your file
</a>
{% endif %} {# Data passed, Domain not recognised/approved #}
Expand All @@ -45,22 +47,27 @@ <h2 class="base-card__title">
with the link to the file you want to submit to the Data Registry.
{% endblocktrans %}
</p>
{% endif %} {# Validation failed #} {% if not data_status.passed %}
{% endif %}
{# Validation failed #} {% if not data_status.passed %}
<p>
{% blocktrans %}Sorry you aren't able to submit this file because it is not
valid 360Giving data.{% endblocktrans %}
</p>
<p>
{% blocktrans %} Follow the feedback below to make the amendments needed to
{% blocktrans %} Follow the feedback in the Data Quality Tool to make the amendments needed to
your data. Once your data passes the Data Quality tool checks, upload the
updated file to your website and then restart the 360Giving data file
submission process. The data did not pass the checks and cannot be published.
See results below. {% endblocktrans %}
</p>

<p><a href="{% url "results" data_uuid %}?new-mode=checks">Open the file in Data Quality Tool to see validation errors.</a></p>
{% endif %}

<div class="spacer-3"></div>

{% comment %} TODO no longer needed?

<style scoped>
table {
width: 100%;
Expand All @@ -72,6 +79,8 @@ <h2 class="base-card__title">
}
</style>



<h1 id="report">Report</h1>
{% include "cove_360/components/explore/summary.html" %}
<hr />
Expand All @@ -80,6 +89,8 @@ <h1 id="report">Report</h1>
{% include "cove_360/components/explore/accuracy.html" %}
<hr />
{% include "cove_360/components/explore/usefulness.html" %}
#}
{% endcomment %}

<script>
window.addEventListener('load', function () {
Expand Down
3 changes: 1 addition & 2 deletions cove/cove_360/templates/cove_360/explore.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{% extends 'explore.html' %}

{% block content %}

{% if "self_publishing" in data_status.supplied_data.parameters %}
{% if submission_tool %}
{% include "cove_360/components/explore_publishing.html" %}
{% else %}
{% include "cove_360/components/explore_checking.html" %}
Expand Down
2 changes: 1 addition & 1 deletion cove/cove_360/templates/cove_360/publishing.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends request.current_app_base_template %}

{% block header_title %}360Giving Data Submission Tool{% endblock %}
{% block header_title %}360Giving Data Submission 11Tool{% endblock %}
{% block hero_title %}Data Submission Tool{% endblock %}
{% block hero_blurb %}Submit your 360Giving data file to be included in the 360Giving Data Registry and tools{% endblock %}

Expand Down
21 changes: 20 additions & 1 deletion cove/cove_360/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,23 @@ def explore_360(request, pk, template='cove_360/explore.html'):
cached_context = cache.get(pk)

if cached_context and not request.POST.get("flatten"):

if request.GET.get("new-mode"):
try:
db_data = SuppliedData.objects.get(pk=pk)
data_params = json.loads(db_data.parameters)
del data_params["self_publishing"]
db_data.parameters = json.dumps(data_params)
db_data.save()
data_status, dsc = SuppliedDataStatus.objects.get_or_create(
supplied_data=db_data,
)
cached_context["data_status"] = data_status
cache.set(pk, cached_context)

except KeyError:
pass

print("Cache hit")
return render(request, template, cached_context)

Expand All @@ -82,6 +99,7 @@ def explore_360(request, pk, template='cove_360/explore.html'):
# bail out early so user doesn't have to wait for validation to complete
return render(request, "cove_360/publisher_not_found.html", context)
data_status._publisher = json.dumps(publisher)
context["submission_tool"] = True
context["publisher"] = publisher

lib_cove_config = LibCoveConfig()
Expand Down Expand Up @@ -163,7 +181,7 @@ def explore_360(request, pk, template='cove_360/explore.html'):
re.sub(r'([A-Z])', r'-\1', codelist_info['codelist'].split('.')[0]).lower()
)

if settings.get("GRANTS_TABLE", False) and hasattr(json_data, 'get') and hasattr(json_data.get('grants'), '__iter__'):
if settings.GRANTS_TABLE and hasattr(json_data, 'get') and hasattr(json_data.get('grants'), '__iter__'):
context['grants'] = json_data['grants']

context['metadata'] = {}
Expand All @@ -175,6 +193,7 @@ def explore_360(request, pk, template='cove_360/explore.html'):
else:
context['grants'] = []
context['metadata'] = {}
context["json_data"] = {}

context['first_render'] = not db_data.rendered
if not db_data.rendered:
Expand Down

0 comments on commit de33d58

Please sign in to comment.