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

Refactored and fixed inconsistencies with Analysis Turnaround Time logic #1032

Merged
merged 25 commits into from
Oct 1, 2018
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
718b27e
Earliness of analysis is not expressed as minutes
xispa Sep 25, 2018
27a448e
Simplify a bit
xispa Sep 25, 2018
6f72e7d
Added to_minutes function to api
xispa Sep 25, 2018
a982204
Simplify getDuration() and getEarliness() functions
xispa Sep 25, 2018
c40a319
Make Analysis' due date to be based on start process date
xispa Sep 25, 2018
c8ac256
getLate function from Analysis Request was inconsistent
xispa Sep 25, 2018
a856b1f
Added test for TAT and CHANGES.rst update
xispa Sep 25, 2018
cb82457
Some cleaning in late analyses portlet (not in use)
xispa Sep 25, 2018
5188b9c
Return setup's default TAT if analysis has no TAT set
xispa Sep 26, 2018
21f2555
Added to_dhm_format function in API
xispa Sep 26, 2018
625e9f2
First late analysis is enough for the ar to be late too
xispa Sep 26, 2018
75f460e
Move getMaxTimeAllowed to base class with schema field
xispa Sep 26, 2018
7c9855b
Test updated (default TAT from setup)
xispa Sep 26, 2018
15ed979
Do not force to choose an analyst in productivity reports
xispa Sep 25, 2018
414ce45
Change TAT is not displayed correctly. Add days
xispa Sep 25, 2018
c7dd9b2
Refactor report Analysis turnaround time over time
xispa Sep 25, 2018
ae02555
Update CHANGES.rst
xispa Sep 25, 2018
796ac21
utils.formatDuration deprecated in favor of api.to_dhm_format
xispa Sep 26, 2018
0f55ff8
Remove function no longer used
xispa Sep 26, 2018
694ec48
Added upgrade step to refresh getDueDate of Analyses
xispa Sep 26, 2018
be1b0cb
Param to_int -> round_to_int in api.to_minutes()
xispa Oct 1, 2018
3e62c50
PEP8
xispa Oct 1, 2018
2a11e98
Return None to be more explicit
xispa Oct 1, 2018
9287a14
Fix API's get_minutes test
xispa Oct 1, 2018
5b91ec8
Merge branch 'master' into tat-refactor
ramonski Oct 1, 2018
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
Prev Previous commit
Next Next commit
Some cleaning in late analyses portlet (not in use)
xispa committed Sep 25, 2018
commit cb824576b106bfb5ac5df96edd87e5dbcfc631c9
23 changes: 10 additions & 13 deletions bika/lims/browser/analyses/late.py
Original file line number Diff line number Diff line change
@@ -104,19 +104,16 @@ def folderitems(self):
items[x]['DateReceived'] = self.ulocalized_time(sample.getDateReceived())
items[x]['DueDate'] = self.ulocalized_time(obj.getDueDate())

late_str = ""
if obj.getDueDate():
late = DateTime() - obj.getDueDate()
days = int(late / 1)
hours = int((late % 1 ) * 24)
mins = int((((late % 1) * 24) % 1) * 60)
late_str = days and "%s day%s" % (days, days > 1 and 's' or '') or ""
if days < 2:
late_str += hours and " %s hour%s" % (hours, hours > 1 and 's' or '') or ""
if not days and not hours:
late_str = "%s min%s" % (mins, mins > 1 and 's' or '')

items[x]['Late'] = late_str
minutes = abs(obj.getEarliness())
minutes = int(round(minutes))
hours = minutes/60
days = hours/24
minutes = minutes % 60
hours = hours % 24
days = days and "{}d ".format(str(days)) or ""
hours = hours and "{}h ".format(str(hours)) or ""
minutes = minutes and "{}m ".format(str(minutes)) or ""
items[x]['Late'] = "".join([days, hours, minutes])
return items

def isItemAllowed(self, obj):