Passed
Push — master ( ac8f85...f8b67c )
by Ramon
05:19
created

bika.lims.catalog.indexers   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 9
dl 0
loc 20
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A cancellation_state() 0 8 2
1
# -*- coding: utf-8 -*-
2
#
3
# This file is part of SENAITE.CORE
4
#
5
# Copyright 2018 by it's authors.
6
# Some rights reserved. See LICENSE.rst, CONTRIBUTORS.rst.
7
8
from bika.lims import api
9
from bika.lims.interfaces import ICancellable
10
from plone.indexer import indexer
11
12
@indexer(ICancellable)
13
def cancellation_state(instance):
14
    """Acts as a mask for cancellation_workflow for those content types that are
15
    not bound to this workflow. Returns 'active' or 'cancelled'
16
    """
17
    if api.get_workflow_status_of(instance) == "cancelled":
18
        return "cancelled"
19
    return "active"
20