Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean some stale indexes from analysis_catalog #1518

Merged
merged 6 commits into from
Feb 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Changelog

**Removed**

- #1518 Removed stale indexes from `analysis_catalog`
- #1516 Removed getResultsRange metadata from analysis_catalog
- #1487 Dexterity Compatible Catalog Base Class
- #1482 Remove `senaite.instruments` dependency for instrument import form
Expand Down
2 changes: 1 addition & 1 deletion bika/lims/browser/worksheet/views/add_analyses.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def __init__(self, context, request):
("getClientOrderNumber", {
"title": _("Order"),
"toggle": False,
"index": "getClientOrderNumber"}),
"attr": "getClientOrderNumber"}),
("getRequestID", {
"title": _("Request ID"),
"attr": "getRequestID",
Expand Down
5 changes: 1 addition & 4 deletions bika/lims/catalog/analysis_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,13 @@
"getParentUID": "FieldIndex",
"getRequestUID": "FieldIndex",
"getDueDate": "DateIndex",
"getDateSampled": "DateIndex",
"getDateReceived": "DateIndex",
"getResultCaptureDate": "DateIndex",
"getClientUID": "FieldIndex",
"getClientTitle": "FieldIndex",
# Only used in Productivity report: productivity_analysestats_overtime
"getAnalyst": "FieldIndex",
"getRequestID": "FieldIndex",
"getClientOrderNumber": "FieldIndex",
"getKeyword": "FieldIndex",
"getServiceUID": "FieldIndex",
"getCategoryUID": "FieldIndex",
Expand All @@ -57,8 +56,6 @@
"getReferenceAnalysesGroupID": "FieldIndex",
"getMethodUID": "FieldIndex",
"getInstrumentUID": "FieldIndex",
"getBatchUID": "FieldIndex",
"getAnalysisRequestPrintStatus": "FieldIndex",
"getWorksheetUID": "FieldIndex",
"getOriginalReflexedAnalysisUID": "FieldIndex",
"getPrioritySortkey": "FieldIndex",
Expand Down
20 changes: 2 additions & 18 deletions bika/lims/content/abstractroutineanalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,11 @@ def getDateSampled(self):
return None

@security.public
def isSampleSampled(instance):
def isSampleSampled(self):
"""Returns whether if the Analysis Request this analysis comes from has
been received or not
"""
return instance.getDateSampled() and True or False
return self.getDateSampled() and True or False

@security.public
def getStartProcessDate(self):
Expand Down Expand Up @@ -320,22 +320,6 @@ def getSampleTypeUID(self):
if sample_type:
return api.get_uid(sample_type)

@security.public
def getBatchUID(self):
"""This method is used to populate catalog values
"""
request = self.getRequest()
if request:
return request.getBatchUID()

@security.public
def getAnalysisRequestPrintStatus(self):
"""This method is used to populate catalog values
"""
request = self.getRequest()
if request:
return request.getPrinted()

@security.public
def getResultsRange(self):
"""Returns the valid result range for this routine analysis
Expand Down
1 change: 0 additions & 1 deletion bika/lims/content/analysisrequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1554,7 +1554,6 @@ def setBatch(self, value=None):
original_value = self.Schema().getField('Batch').get(self)
if original_value != value:
self.Schema().getField('Batch').set(self, value)
self._reindexAnalyses(['getBatchUID'], False)

def getDefaultMemberDiscount(self):
"""Compute default member discount if it applies
Expand Down
8 changes: 8 additions & 0 deletions bika/lims/upgrade/v01_03_003.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,14 @@
# getCategoryUID --> category_uid
("bika_setup_catalog", "getCategoryUID"),

# Not used anywhere
(CATALOG_ANALYSIS_LISTING, "getAnalysisRequestPrintStatus"),
(CATALOG_ANALYSIS_LISTING, "getBatchUID"),

# Only used in Add analyses (as sortable column)
(CATALOG_ANALYSIS_LISTING, "getClientOrderNumber"),
(CATALOG_ANALYSIS_LISTING, "getDateSampled"),

]

METADATA_TO_REMOVE = [
Expand Down
3 changes: 0 additions & 3 deletions bika/lims/workflow/analysisrequest/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,6 @@ def after_sample(analysis_request):
passed in is performed
"""
analysis_request.setDateSampled(DateTime())
idxs = ['getDateSampled']
for analysis in analysis_request.getAnalyses(full_objects=True):
analysis.reindexObject(idxs=idxs)


def after_rollback_to_receive(analysis_request):
Expand Down