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

rethink database design on duration_hours & duration_minutes in database #126

Open
f1-outsourcing opened this issue Jun 28, 2022 · 4 comments
Labels
Type:Suggestion Issue containing a suggestion of functionality, process or UI. Associated PRs are called enhancement

Comments

@f1-outsourcing
Copy link

Issue

59 seconds are being truncated from calls, actually all seconds are.

Expected Behavior

just one field duration with seconds or interval

Actual Behavior

59 sec of calls are just dropped!

Possible Fix

just one field duration with seconds or interval

Context

3rd party plugins/modules have to modify the database to fix this. But this is just a super weird design choice, because someone in the past was not able to extract the required data properly via sql. (Mostly weird table design choices are because of lack of knowledge on sql or coding)

Your Environment

suitecrm7 and suitecrm8 have this.

@johnM2401 johnM2401 added the Type:Suggestion Issue containing a suggestion of functionality, process or UI. Associated PRs are called enhancement label Jun 28, 2022
@pgorod
Copy link
Contributor

pgorod commented Jun 28, 2022

How are you entering these values, is it manually? You time your calls and want to register that down to the seconds, is that it?

@f1-outsourcing
Copy link
Author

I have this module that reads the calls from asterisk. The average call length seems to be 4 minutes, so cutting a maximum of 59 seconds would make your analysis of calling hours of someone up to 25% incorrect.

@pgorod
Copy link
Contributor

pgorod commented Jun 29, 2022

Ok, so the original design choice seems to be made for people entering the call durations manually, where seconds are overkill, and minutes is quite reasonable.

Having a 3rd party module with a different logic and different assumptions makes it convenient to add seconds; so that is a customization, the 3rd party module can do it.

I don't disagree with you in principle, it would have been better database design to do this in the beginning with a better data type internally (even if the form only had minutes). But not I don't see that it is feasible to change this for such a small reason. There are loads of backward-compatibility issues to worry about, unfortunately.

@f1-outsourcing
Copy link
Author

@pgorod

What about this:
Luckily they created duration_hours and duration_minutes. What about introducing a field duration and when duration is modified a trigger automatically sets values in duration_hours and duration_minutes. This way newer code can just use the duration field while older code is getting still good data from duration_hours and duration_minutes.

After a few years you can then drop the duration_hours and duration_minutes fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type:Suggestion Issue containing a suggestion of functionality, process or UI. Associated PRs are called enhancement
Projects
None yet
Development

No branches or pull requests

3 participants