Skip to content

Commit

Permalink
Merge pull request #1636 from Princeton-CDH/bugfix/person-list-date
Browse files Browse the repository at this point in the history
Use new property names for range stats on people list
  • Loading branch information
blms authored Aug 19, 2024
2 parents c1269df + a1851e4 commit 703a700
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions geniza/entities/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,8 +708,8 @@ def index_data(self):
{
"date_dr": solr_date_range,
"date_str_s": self.date_str,
"start_date_i": (dates[0].numeric_format()),
"end_date_i": (
"start_dating_i": (dates[0].numeric_format()),
"end_dating_i": (
(dates[1] if len(dates) > 1 else dates[0]).numeric_format(
mode="max"
)
Expand Down
2 changes: 1 addition & 1 deletion geniza/entities/templates/entities/person_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ <h1>{{ page_title }}</h1>
<span class="fieldname">{{ form.gender.label }}</span>
{% render_field form.gender data-action="search#update" %}
</label>
<label for="{{ form.date_range.auto_id }}">
<label for="{{ form.date_range.auto_id }}" class="date-range-label">
<span class="fieldname">{{ form.date_range.label }}</span>
{% render_field form.date_range data-action="search#update keypress->search#handleDate" %}
</label>
Expand Down
4 changes: 2 additions & 2 deletions geniza/entities/tests/test_entities_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,8 @@ def test_index_data(self, person, document):
assert index_data["document_relation_ss"] == [str(pdrtype)]
assert index_data["date_dr"] == person.solr_date_range()
assert index_data["date_str_s"] == person.date_str
assert index_data["start_date_i"] == PartialDate("1200").numeric_format()
assert index_data["end_date_i"] == PartialDate("1300").numeric_format(
assert index_data["start_dating_i"] == PartialDate("1200").numeric_format()
assert index_data["end_dating_i"] == PartialDate("1300").numeric_format(
mode="max"
)

Expand Down
4 changes: 2 additions & 2 deletions geniza/entities/tests/test_entities_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,13 +400,13 @@ def test_get_queryset__filters(
"sort_dir": "desc",
}
personlist_view.get_queryset()
mock_order_by.assert_called_with("-end_date_i")
mock_order_by.assert_called_with("-end_dating_i")
mock_get_form.return_value.cleaned_data = {
"sort": "date",
"sort_dir": "asc",
}
personlist_view.get_queryset()
mock_order_by.assert_called_with("start_date_i")
mock_order_by.assert_called_with("start_dating_i")

def test_get_context_data(self, client, person):
with patch.object(PersonListForm, "set_choices_from_facets") as mock_setchoices:
Expand Down
4 changes: 2 additions & 2 deletions geniza/entities/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,8 @@ class PersonListView(ListView, FormMixin, SolrDateRangeMixin):
"documents": "documents_i",
"people": "people_i",
"places": "places_i",
"date_asc": "start_date_i",
"date_desc": "-end_date_i",
"date_asc": "start_dating_i",
"date_desc": "-end_dating_i",
}
initial = {"sort": "name", "sort_dir": "asc"}

Expand Down
2 changes: 1 addition & 1 deletion sitemedia/scss/components/_peopleform.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ main.search {
@include breakpoints.for-tablet-landscape-up {
// desktop view: grid
display: grid;
grid-template-columns: 1fr 1fr 1fr;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 2rem;
padding: 1.5rem 0;
// desktop: in flow
Expand Down

0 comments on commit 703a700

Please sign in to comment.