Jeff VIP
Total posts: 745
15 Фев 2016 03:23

Hi,

I have noticed that the number of days left using REMAININGDAYS is one day off compared to the number of days left in the subscription history.

  • REMAININGDAYS: 5 days left
  • Subsription history: 6 days left

Is this a time offset issue?

Best regards, Jeff

Последние изменения: 25 Фев 2016


Sergey
Total posts: 13,748
18 Фев 2016 08:41

Fixed.


Jeff VIP
Total posts: 745
18 Фев 2016 09:58

Alright, after today's update:

  • REMAININGDAYS: 6 days left
  • Subsription history: 5 days left

Still not good.....


Sergey
Total posts: 13,748
22 Фев 2016 14:56

Ерук was floor function. I chnged it to ceil. May be I need round.

tryt o change it in components/com_emerald/api.php in line 607.


Jeff VIP
Total posts: 745
22 Фев 2016 23:49

Sergey tryt o change it in components/com_emerald/api.php in line 607.

That seems to work :-)

THANKS!


Jeff VIP
Total posts: 745
24 Фев 2016 03:22

A very strange thing occurred. Today I checked again and the REMAININGDAYS set to round was now offset by -1 day. I changed it back to ceil and it showed the correct days. Maybe the difference is not a day but just a couple of hours.

I remember setting my php.ini file to date.timezone = "Australia/ACT" AND Joomla's Server Timezone to Adelaide to show the correct time. Maybe this is causing the difference between REMAININGDAYS and the number of days left in the Subscription History?


Sergey
Total posts: 13,748
25 Фев 2016 07:02

That is because in history I calculate reminded days inside the query,

$query->select('IF(u.ctime <= NOW(), (TO_DAYS(u.extime) - TO_DAYS(NOW())), (TO_DAYS(u.extime) - TO_DAYS(u.ctime)) ) as days')

That is why there is a difference.

I do not use hours I first convert to number of days, then I subtract. And I cannot apply this in REMAININGDAYS because there might be few subscriptions and I do not calculate per subscription but most late expire date.

Работает на Cobalt