Skip to content

Commit

Permalink
Seperated TimeSeries analyses
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunga001 committed Sep 16, 2024
1 parent 1a56c9a commit 47f0947
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
15 changes: 15 additions & 0 deletions src/senaite/timeseries/browser/overrides/analysisrequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@ def _folder_item_result(self, analysis_brain, item):
sciformat=int(self.scinot), decimalmark=self.dmk)
item["formatted_result"] = formatted_result

def folderitems(self):
# This shouldn't be required here, but there are some views that calls
# directly contents_table() instead of __call__, so before_render is
# never called. :(
self.before_render()

# Get all items
# Note we call AnalysesView's base class!
items = super(AnalysesView, self).folderitems()
newitems = []
for item in items:
if not item.get("time_series_columns"):
newitems.append(item)
return newitems


class FieldAnalysesTable(AnalysesView):
def __init__(self, context, request):
Expand Down
18 changes: 15 additions & 3 deletions src/senaite/timeseries/browser/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,9 @@
# Some rights reserved, see README and LICENSE.

from bika.lims import api
from plone.memoize import view
from senaite.timeseries.config import is_installed
from senaite.timeseries.config import _
from senaite.timeseries.browser.overrides.analysisrequest import AnalysesView
from senaite.core.api import dtime
from senaite.core.permissions import ViewResults
from senaite.core.browser.viewlets.sampleanalyses import LabAnalysesViewlet


Expand Down Expand Up @@ -79,6 +76,21 @@ def __init__(self, context, request):
for review_state in self.review_states:
review_state.update({"columns": all_columns})

def folderitems(self):
# This shouldn't be required here, but there are some views that calls
# directly contents_table() instead of __call__, so before_render is
# never called. :(
self.before_render()

# Get all items
# Note we call AnalysesView's base class!
items = super(AnalysesView, self).folderitems()
newitems = []
for item in items:
if item.get("time_series_columns"):
newitems.append(item)
return newitems


def get_timeseries_analyses(sample, short_title=None, skip_invalid=True):
"""Returns the ast analyses assigned to the sample passed in and for the
Expand Down

0 comments on commit 47f0947

Please sign in to comment.