Time log / Timesheet only calculates to minutes

hi all,

when I fill in timelogs the hours only get calculated down to the hour
that means that with every times log there is a potencial loss of up to 59 seconds.
I know it is a bit pernickety but
taking into account that you have tasks with small time periods that are all billable
this “time loss” quickly adds up to serious money
Could this be changed so the decimal hours are calculated with hours minutes and seconds?

thanks

Sebastian

Do you face this issue ? What process do you do. Your issues is valid but im not sure if many users use time logs to track seconds.

@neilLasrado

hi neil, thanks for getting back -
Yes I do face a problem as first of all my employees trying the Software reported this … every one of them logs up to 40 tasks a day while manufacturing/Installation that would mean they could potentially loose from 40 seconds up to 39 minutes and 20 seconds a day on their time sheet hence they complained before we even use the new software.
Also I need timelogs as exact as possible for costing… If you have a build with 2200 wallsockets to install and you can be aware of the fact that you would need 30 seconds less per unit you gain 1100 Manminutes - that
wich at calculating the next project could decide about getting a contract or not in terms of price
… belive me we lost six digts tenders because of 150€ of difference in the calculation compared to our competitor`s.
We are calculating very tight as the market forces us to
But we are also able to pay good wages as we dont waste time - not even a second:-)
I´m aware of the fact that most consultants or manufactureres would not need it that exact.
But it would not hurt anybody to have it like that.

Hi,

I think working to seconds is a reasonable request.
I work in a couple of industries, where production rates accurate to seconds is used frequently.

Tenths of a seconds might be pushing things.

Hello Tray,

thanks for joining…
had a look @ https://github.com/frappe/erpnext/blob/develop/erpnext/projects/doctype/time_log/time_log.py

as I understand with my limited knowledge of Python, this should be the responsible snippit at line 112

def calculate_total_hours(self):
	if self.to_time and self.from_time:
		from frappe.utils import time_diff_in_seconds
		self.hours = flt(time_diff_in_seconds(self.to_time, self.from_time)) / 3600

this is accomplished by https://github.com/frappe/frappe/blob/develop/frappe/utils/data.py

 def time_diff_in_seconds(string_ed_date, string_st_date):
return time_diff(string_ed_date, string_st_date).total_seconds()

it seems to meet our needs so far as it looks for seconds …
but https://github.com/frappe/erpnext/blob/develop/erpnext/projects/doctype/time_log/time_log.js

// set hours if to_time is updated
frappe.ui.form.on("Time Log", "to_time", function(frm) {
if(frm._setting_hours) return;
frm.set_value("hours", moment(cur_frm.doc.to_time).diff(moment(cur_frm.doc.from_time),
	"minutes") / 60);

Is it right that this java script then brings our seconds down to minutes before inserting the value into the Field hours??

so wouldn be the solution to change https://github.com/frappe/erpnext/blob/develop/erpnext/projects/doctype/time_log/time_log.js

// set hours if to_time is updated
frappe.ui.form.on("Time Log", "to_time", function(frm) {
if(frm._setting_hours) return;
frm.set_value("hours", moment(cur_frm.doc.to_time).diff(moment(cur_frm.doc.from_time),
	"seconds") / 3600);

??

any developer´s opinions?

@spa can you please raise a issue on github. we will fix it up.

Hi,

@neilLasrado

thanks you … done it

https://github.com/frappe/erpnext/issues/4497

… how can I close this thread??