netmix / radio-station

Radio Station WordPress Plugin (Open Source)
https://netmix.com
GNU General Public License v3.0
19 stars 14 forks source link

[Master Schedule] Start day possibly reverts to previous week. #342

Closed majick777 closed 3 years ago

majick777 commented 3 years ago

Describe the bug https://wordpress.org/support/topic/schedule-jumps-back-a-week-at-midnight/

"Bit of a strange one – at 12 Midnight every day, the schedule shows the previous week, it then goes back to normal from 01:00 onwards. Seems to have happened since the last update?"

Example URL: http://uckfieldfm.co.uk/on-air/schedule

I have noticed this happening occassionally, though I cannot confirm the cause described here is correct, it just seems like sometimes Schedule displays the previous week.

astevens93 commented 3 years ago

Hi @majick777 I have tried out v2.3.3.9 (develop) and this now breaks the schedule completely, where it is still in the previous week but now actually doesn't show any data at all.

I have attached the debug file for your reference.

schedule_debug_052921.txt

astevens93 commented 3 years ago

And for reference here is my schedule debug file for the current stable Version 2.3.3.8 Schedule Debut for Version 2.3.3.8.txt

Edit: I would also like to add that when I upgraded to v2.3.3.9 from v2.3.3.8 it also broke all of my schedule overrides and defaulted the year to 1st Jan 1970.

majick777 commented 3 years ago

@stevens93 I have been trying to reproduce this issue without success. (I have split off the Override issue to a separate ticket as referenced above.)

I did change some code slightly in the development version note so that midnight of the current start day is always used for schedules, rather than the current time of the day. I'm hoping this might make a difference here, but again since I haven't been able to reproduce what is causing the issue I'm not sure if that's because it's resolved or I just haven't found the conditions that do so. Certainly also something it would be good to resolve before the next release.

astevens93 commented 3 years ago

Hi @majick777 sorry about my tardiness in coming back to you on this.

I just re-tried Development Version 2.3.3.9 - just downloaded from GitHub - and it is still happening to me, where everything disappears. Radio time also reappears and I've previously hidden that.

I checked the source code to see if it was to do with my CSS amends and actually isn't even printing the li class schedule items at all.

Very strange you cannot replicate the issue. Is there anything you suggest I try to determine the cause of the issue? As I say, version 2.3.3.8 works perfectly fine (apart from the reverting to previous week in schedule which this issue is about).

image
majick777 commented 3 years ago

@astevens93 It looks to me like there is a fatal error in processing the schedule template, that's usually why you would get it cut off like that - nothing is output beyond the error (including additional CSS - hence the non-hidden clock.)

You can confirm this by looking at the page source and seeing what the last printed HTML is... that will give us a clue as to where the error is coming from.

But if you could check your PHP error logs we should be able to pinpoint the cause of this more accurately - would definitely like to solve this before release!

astevens93 commented 3 years ago

Hi @majick777 sorry about the delay in coming back to you, I have been traveling so after seeing your email I took some time to write a error file and get this across to you.

This is the error I am getting for Radio Station develop v2.3.3.9.

[27-Jun-2021 07:34:00 UTC] PHP Warning: array_key_exists() expects parameter 2 to be array, string given in /home/hcrfm/public_html/wp-content/plugins/radio-station-develop/includes/support-functions.php on line 531 [27-Jun-2021 07:34:00 UTC] PHP Warning: array_key_exists() expects parameter 2 to be array, string given in /home/hcrfm/public_html/wp-content/plugins/radio-station-develop/includes/support-functions.php on line 531 [27-Jun-2021 07:34:00 UTC] PHP Warning: array_key_exists() expects parameter 2 to be array, string given in /home/hcrfm/public_html/wp-content/plugins/radio-station-develop/includes/support-functions.php on line 531 [27-Jun-2021 07:34:00 UTC] PHP Warning: array_key_exists() expects parameter 2 to be array, string given in /home/hcrfm/public_html/wp-content/plugins/radio-station-develop/includes/support-functions.php on line 531 [27-Jun-2021 07:34:04 UTC] PHP Warning: array_key_exists() expects parameter 2 to be array, string given in /home/hcrfm/public_html/wp-content/plugins/radio-station-develop/includes/support-functions.php on line 531 [27-Jun-2021 07:34:04 UTC] PHP Warning: array_key_exists() expects parameter 2 to be array, string given in /home/hcrfm/public_html/wp-content/plugins/radio-station-develop/includes/support-functions.php on line 531 [27-Jun-2021 07:34:04 UTC] PHP Warning: array_key_exists() expects parameter 2 to be array, string given in /home/hcrfm/public_html/wp-content/plugins/radio-station-develop/includes/support-functions.php on line 531 [27-Jun-2021 07:34:04 UTC] PHP Warning: array_key_exists() expects parameter 2 to be array, string given in /home/hcrfm/public_html/wp-content/plugins/radio-station-develop/includes/support-functions.php on line 531

majick777 commented 3 years ago

@astevens93 Ok, turns out that javascript clock error you sent me was a result of a variable default not being set. I didn't notice because the default is for a timezone override set in the Pro version which I've been working on (the error only occurred with the Pro version deactivated.) I've added this fix to the development version... Not sure yet if the original issue is resolved, but glad we won't have schedule crashes with the next update. :-)

astevens93 commented 3 years ago

Hi @majick777 I downloaded the latest develop version and the radio time has come back now.

image

But the main schedule is not outputting still.

There are no Javascript errors other than: DevTools failed to load source map: Could not load content for https://www.hcrfm.co.uk/wp-content/plugins/radio-station/js/moment.min.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

Such a mystery! Is there anything else you think could be affecting my install?

majick777 commented 3 years ago

@astevens93 Frustrating. I'll include the source map (is for js debugger) but I don't think that's it. It seems from the page source that everything is there, and with no errors now should work.

Does anything happen when you run radio_tabs_initialize(); in the conxole as suggested? Also worth testing resizing the window to see if that causes anything to change.

One other thing is to check the same thing happens in a different browser to eliminate that as the conflict.

astevens93 commented 3 years ago

@majick777 sadly nothing happens after clearing the command console and running radio_tabs_initialize(); I get undefined and no change to the schedule.

Resizing window does nothing either. Same issue in different browsers.

Very frustrating that you can't reproduce this your end. I can send some temporary admin credentials to you via email address to take a poke around if you think it's worth it?

majick777 commented 3 years ago

@astevens93 I believe I finally found the cause of the original issue with the start day/date possibly showing previous week. Seems like an inconsistent use of date/time conversion was causing a timezone offset to be added twice (again it seems) and thus calculating the first start date based on the day before. In any case, using the existing plugin helper function made for the purpose of this conversion instead of calculating it manually seems to have solved the problem.

Fix has ben added to the development version for next release (2.3.3.9) I will close this one finally and hopefully we can resolve schedule your issue via email.