Passed
Push — 2.x ( d9b1fa...45ccde )
by Jordi
07:02
created

senaite.core.browser.listing.actions.analysis   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 13
dl 0
loc 23
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A ActionView.recalculate() 0 13 3
1
# -*- coding: utf-8 -*-
2
3
from senaite.core.browser.listing.actions import BaseActionView
4
5
6
class ActionView(BaseActionView):
7
    """Action View for Analyses
8
    """
9
10
    def recalculate(self):
11
        """Recalculate the results
12
        """
13
        title = self.context.Title()
14
        calc = self.context.getCalculation()
15
        if not calc:
16
            return self.message("No calculation found", False, title=title)
17
        success = self.context.calculateResult(override=True)
18
        if not success:
19
            return self.message(
20
                "Failed to recalculate result", False, title=title)
21
22
        return self.message("Result recalucated", True, title=title)
23