Skip to content

Commit

Permalink
highlight if a dataset was automatically converted
Browse files Browse the repository at this point in the history
  • Loading branch information
struan committed Jan 11, 2024
1 parent e22c045 commit 9d9ae83
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions hub/templates/hub/area.html
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,9 @@ <h3 class="h5">{{ dataset.label }}</h3>
</div>
<div class="card-footer">
<p class="card-text">{{ dataset.source }}</p>
{% if dataset.auto_converted %}
<p class="card-text">This data was automatically converted.</p>
{% endif %}
</div>
</div>
{% endfor %}
Expand Down Expand Up @@ -380,6 +383,9 @@ <h3 class="h5">{{ dataset.label }}</h3>
</div>
<div class="card-footer">
<p class="card-text">{{ dataset.source }}</p>
{% if dataset.auto_converted %}
<p class="card-text">This data was automatically converted.</p>
{% endif %}
</div>
</div>
{% endfor %}
Expand Down Expand Up @@ -472,6 +478,9 @@ <h3 class="h5">{{ dataset.label }}</h3>
</div>
<div class="card-footer">
<p class="card-text">{{ dataset.source }}</p>
{% if dataset.auto_converted %}
<p class="card-text">This data was automatically converted.</p>
{% endif %}
</div>
</div>
{% endfor %}
Expand Down
9 changes: 9 additions & 0 deletions hub/views/area.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
AreaData,
AreaType,
DataSet,
DataType,
Person,
PersonData,
UserDataSets,
Expand Down Expand Up @@ -56,6 +57,13 @@ def process_dataset(self, data_set):
.annotate(is_favourite=Count("id"))
.values("is_favourite")
)
data_type = DataType.objects.filter(
data_set=data_set, area_type=self.object.area_type
).first()
auto_converted = False
if data_type is not None:
auto_converted = data_type.auto_converted

base_qs = AreaData.objects.filter(
area=self.object,
data_type__data_set=data_set,
Expand All @@ -73,6 +81,7 @@ def process_dataset(self, data_set):
"data_type": data_set.data_type,
"featured": data_set.featured,
"excluded_countries": data_set.exclude_countries,
"auto_converted": auto_converted,
}
if data_set.is_range:
data["is_range"] = True
Expand Down

0 comments on commit 9d9ae83

Please sign in to comment.