lstrip punctuation when sorting members
Showing 2 of 3 files from the diff.
mep/people/models.py
changed.
mep/people/tests/test_models.py
changed.
Other files ignored by Codecov
DEPLOYNOTES.rst
has changed.
@@ -1,5 +1,6 @@
Loading
1 | 1 | import datetime |
|
2 | 2 | import logging |
|
3 | + | from string import punctuation |
|
3 | 4 | ||
4 | 5 | from django.apps import apps |
|
5 | 6 | from django.contrib.contenttypes.fields import GenericRelation |
@@ -670,7 +671,7 @@
Loading
670 | 671 | # text version of sort name for search and display |
|
671 | 672 | 'sort_name_t': self.sort_name, |
|
672 | 673 | # sort version of sort name |
|
673 | - | 'sort_name_isort': self.sort_name, |
|
674 | + | 'sort_name_isort': self.sort_name.lstrip(punctuation), |
|
674 | 675 | 'birth_year_i': self.birth_year, |
|
675 | 676 | 'death_year_i': self.death_year, |
|
676 | 677 | 'has_card_b': self.has_card(), |
@@ -436,6 +436,15 @@
Loading
436 | 436 | assert uk.name in index_data['nationality'] |
|
437 | 437 | assert denmark.name in index_data['nationality'] |
|
438 | 438 | ||
439 | + | # ensure that punctuation is stripped during sort |
|
440 | + | pers = Person.objects.create( |
|
441 | + | name='"Friend of John Smith"', birth_year=1855, death_year=1876, |
|
442 | + | sort_name='"Friend of John Smith"' |
|
443 | + | ) |
|
444 | + | acct = Account.objects.create() |
|
445 | + | acct.persons.add(pers) |
|
446 | + | index_data = pers.index_data() |
|
447 | + | assert index_data['sort_name_isort'] == 'Friend of John Smith"' |
|
439 | 448 | ||
440 | 449 | class TestPersonQuerySet(TestCase): |
|
441 | 450 |
Files | Coverage |
---|---|
mep | 98.44% |
srcmedia/ts | 86.55% |
Project Totals (223 files) | 98.01% |
2520.1
TRAVIS_PYTHON_VERSION=3.5 TRAVIS_OS_NAME=linux
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.