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

ActionView.recalculate()   A

Complexity

Conditions 3

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 13
rs 9.9
c 0
b 0
f 0
cc 3
nop 1
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