Ticket #381 (closed defect: fixed)

Opened 3 years ago

Last modified 7 weeks ago

Ophonekitd reporting the wrong call duration (to pyphonelogd)

Reported by: Bumbl Owned by: ptitjes
Priority: trivial Milestone:
Component: ophonekitd Version: SHR-unstable
Keywords: Cc:

Description

When a call lasts longer than one hour
ophonekitd reports a wrong call duration
(in my case instead of 65min it reported 5min)

This piece of code should be responsible

strftime('%M:%S',strftime('%s',(SELECT eventTime

FROM call_events as e
WHERE e.id = call_events.id

AND e.status = 4

)) - strftime('%s',(SELECT eventTime

FROM call_events as e
WHERE e.id = call_events.id

AND e.status = 2

)), "unixepoch")
AS duration

Attachments

sql.patch Download (1.7 KB) - added by spaetz 3 years ago.
Improve the SQL query

Change History

comment:1 Changed 3 years ago by TAsn

Further clarifications:
This is the SQL code responsible of generating the view that other applications should read from, it's located at /usr/share/ophonekitd/.
%M is 0-59.
Ophonekitd should probably leave the duration as a number (seconds) and probing applications (like pyphonelog) should be able to read and do what they want with it.

comment:2 Changed 3 years ago by ainulindale

  • Status changed from new to assigned
  • Owner changed from ainulindale to ptitjes

comment:3 Changed 3 years ago by TAsn

Btw, I already implemented the needed changes in pyphonelog, so the only thing left is changing the sql (only a view) when creating the db for the first time in ophonekitd.

comment:4 Changed 3 years ago by spaetz

hi bumbl, thanks for reporting. Nobody of us had been making calls this long, apparently. However, multiple people have gone blind by now, just by looking that this SQL snippet.

I'll see if we can come up with something better.

spaetz

comment:5 Changed 3 years ago by spaetz

Just for the record here is my SQL snippet that I prepared to replace that 'calls' VIEW without changing anything structurally. It replcaes the current lines 19-68 in the ophonekitd SQL file.

SELECT e.id, call_ids.number, e.status, 
       e.eventTime as startTime, 
       act.eventTime as activeTime, 
       rel.eventTime as releaseTime, 
       strftime("%s", rel.eventTime)-strftime("%s", act.eventTime) as Duration
FROM call_events as e
INNER JOIN call_ids ON e.id = call_ids.id
LEFT JOIN call_events as act ON e.id=act.id and act.status=2
INNER JOIN call_events as rel ON e.id=rel.id and rel.status=4
WHERE e.status in (0,1) group by e.id;

Changed 3 years ago by spaetz

Improve the SQL query

comment:6 Changed 3 years ago by mrmoku

  • Status changed from assigned to closed
  • Resolution set to fixed

comment:7 Changed 7 weeks ago by morphis

  • Milestone MS1 deleted

Milestone MS1 deleted

Note: See TracTickets for help on using tickets.