Forum

Bug's correction pr...
 
Notifications
Clear all

Bug's correction proposal: duration calculation (projeqtor.js:workDaysDiffDates)

6 Posts
2 Users
0 Reactions
3,069 Views
(@glaurung4567)
Posts: 9
Active Member
Topic starter
 
[#5096]

Hello,
i'm working on projeqtor for my traineeship, and i think i found a bug in the function workDayDiffDates, in view/js/projeqtor.js at the line 2724 in projeqtor v7.0.5.
In some cases, the result it returns is larger than the number of working days expected.

First of all, two examples:

If i create an activity with a start date and an end date set each at 01/05/2018, a date which has been set as an off day beforehand in calendar, the validated duration indicated is 1 day,
and not 0 day as expected (after saving, the duration is set at 0, so this bug doesn't affect the database).

Similarly, if i take a startdate such as the monday 14/05/18 and an end date at the saturday 19/05/18 (saturday is Day Off in Global Parameters), the duration is 6 days and not 5.

Here a proposition for the correction:

Thanks


 
Posted : 24 Apr 2018 18H23
(@babynus)
Posts: 14952
Member Admin
 

In my opinion, this is not an issue.

If work is done on off day, then duration is at least 1, not zero.
The same way, if I start on friday and end on saturday, of course duration is 2 days (I worked during off days).


 
Posted : 24 Apr 2018 21H59
(@glaurung4567)
Posts: 9
Active Member
Topic starter
 

Well i agree that it's possible to work during off days, but may i point two problems then ?
Why, after i save with the case in which start date and end date are set to 01/05/2018 (an off day), validated duration has become "0 d" and not "1 d" ?
There seems to be an inconsistency between the js and php.

And also, why when i take a start date set at friday 04/05/2018 and end date set at saturday 05/04/2018 (saturday is set as OffDays),
validated duration is "2 d" in js and "1 d" in php (after saving the activity) ? Which one is valid (js or php) ?

Here are the two functions (js and php), and as you can see, the variable duration is set to 1 in projeqtor.js and to 0 projeqtor.php.

Thanks


 
Posted : 26 Apr 2018 13H40
(@babynus)
Posts: 14952
Member Admin
 

Hi,

Thanks for pointing this out.

In my opinion, PHP is wrong.
Duration must not be zero, never.
Only milestones have zero duration.

We'll fox it in php part.

Thanks for pointing out this issue


 
Posted : 26 Apr 2018 14H46
(@glaurung4567)
Posts: 9
Active Member
Topic starter
 

Hi,
Thanks you for your answer and can you notify me when you have fixed this issue ?

Also, did you notice this proposal of code to correct a problem with DateTime in projeqtor.js/workdaysdiffDates

?


 
Posted : 26 Apr 2018 18H53
(@babynus)
Posts: 14952
Member Admin
 

Fix will be included in V7.0.5
Your patch will also be included.

Thanks for your contribution.


 
Posted : 27 Apr 2018 0H37
Share:

Scroll to Top