Total Complexity | 2 |
Total Lines | 16 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | # -*- coding: utf-8 -*- |
||
2 | |||
3 | from bika.lims import api |
||
4 | from bika.lims.interfaces import IBaseAnalysis |
||
5 | from plone.indexer import indexer |
||
6 | from Products.CMFPlone.utils import safe_callable |
||
7 | from senaite.core.catalog.utils import sortable_sortkey_title |
||
8 | |||
9 | |||
10 | @indexer(IBaseAnalysis) |
||
11 | def sortable_title(instance): |
||
12 | title = sortable_sortkey_title(instance) |
||
13 | if safe_callable(title): |
||
14 | title = title() |
||
15 | return "{}-{}".format(title, api.get_id(instance)) |
||
16 |