Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Episode.objects.serialised_active #1613

Merged
merged 1 commit into from Oct 26, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions changelog.md
Expand Up @@ -11,7 +11,6 @@ We no longer include a value for "active_episode_id" as part of the Patient to_d
This is effectively meaningless since we moved to an episode model that allows for multiple
concurrent episodes.


#### Removes CopyToCategory

Removes the entire CopyToCategory flow from Opal Core. If applications continue to rely on it,
Expand All @@ -25,13 +24,18 @@ This includes the API endpoint at `episode/$id/actions/copyto/$category/`, the t
`copy_to_category.html`, the Angular controller `CopyToCategoryCtrl` and service
`CopyToCategory` and Subrecord property `_clonable`.


#### Lookuplist data format

Lookuplist entries in data files are no longer required to have an empty synonyms list
if the entry doesn't have a synonym. This reduces the file size and makes it easier to
hand craft data files for new applications.

#### TaggedPatientList Episode serialisation

Alters the default serialisation of TaggedPatientList serialisation to no longer filter out
'inactive' episodes. Given that 'active' was always true when an episode had a tag, this
was effectivly a no-op anyway unless applications were altering the `get_queryset` for
these patient lists somehow.

#### Removes the deprecated Model._title property

Expand Down
5 changes: 0 additions & 5 deletions opal/core/patient_lists.py
Expand Up @@ -233,11 +233,6 @@ def get_template_prefixes(self):
possible.append("{0}.{1}".format(self.tag, self.subtag))
return possible

def to_dict(self, user):
# As opposed to general lists, we only ever want active episodes
# for tagged lists
return self.get_queryset(user=user).serialised_active(user)


"""
Sometimes we group lists for display purposes.
Expand Down
12 changes: 0 additions & 12 deletions opal/managers.py
Expand Up @@ -138,15 +138,3 @@ def serialised(self, user, episodes, historic_tags=False):
d['tagging'][0]['id'] = e.id
serialised.append(d)
return serialised

def serialised_active(self, user, **kw):
"""
Return a set of serialised active episodes.

KWARGS will be passed to the episode filter.
"""
filters = kw.copy()
filters['active'] = True
episodes = self.filter(**filters)
as_dict = self.serialised(user, episodes)
return as_dict
4 changes: 3 additions & 1 deletion opal/tests/test_patient_lists.py
Expand Up @@ -384,12 +384,14 @@ def test_get_tag_names(self):
self.assertEqual(set(taglist), expected)

def test_to_dict_inactive_episodes(self):
# Older vesions of Opal only serialised active episodes here
# Explicitly test to prevent a reversion
p, e = self.new_patient_and_episode_please()
e.set_tag_names(['carnivore'], self.user)
self.assertEqual(e.pk, TaggingTestNotSubTag().to_dict(self.user)[0]['id'])
e.active = False
e.save()
self.assertEqual(0, len(TaggingTestNotSubTag().to_dict(self.user)))
self.assertEqual(1, len(TaggingTestNotSubTag().to_dict(self.user)))


class TabbedPatientListGroupTestCase(OpalTestCase):
Expand Down