The online racing simulator
Searching in All forums
(460 results)
Scawen
Developer
As I don't know anything about REST, and I'm not even a web developer by trade (and Victor isn't an active LFS developer at this time) that is way beyond the scope of what I could do. My question is more about if there is something I could add in an hour or two, for league admins who could nearly use our on-site signup system but it's just missing something small that they need.
Scawen
Developer
One more feature, if you use the on-site signup system, you can now export a CSV of all the racer details.

The CSV comes out something like this:

"Scawen","S Roberts","LFS Devs","37","England"
"Leo","L. Roberts","Coders","77","Wales"

I think the signup system Victor made is quite good and has a lot to it, but unfortunately it is rarely used, partly because it misses a few features (discussed earlier in this thread).

I was able to add this CSV output quite simply. The other thing that seems important and simple is for the race organiser (league admins) to be able to send a PM to all signed up racers.

For anyone unfamiliar with this, you can see in the attachment, you can add any required fields. Then there is an on-site signup and everyone can see who has entered.

Questions, to anyone who might use the on-site signup, now or if it is improved a bit more:

- Is the CSV output adequate for your needs?
- What other features are necessary to make this system more convenient than your existing methods?
Scawen
Developer
I've added a "Time zone" display in account settings: https://www.lfs.net/account/settings

You can see what the server thinks your offset is.

The result is:
- if I change my time zone, that offset is unaffected (even refresh page)
- exit the browser and go back to that page, offset is still at old time zone
- log out from LFS.net and lock back in, my new time zone offset is acquired

As far as I can tell, this only affects calendar display and something to do with poll expiry times, so I think it's not worth further investigation.
Scawen
Developer
No, not about formatting the string, I just want to know the actual offset of the client's computer compared with UTC. It seems our website knows that already but it isn't updated if I change my computer's time zone.

EDIT: Maybe it's cached and gets corrected after a while, I don't know. I suppose it's a bit complicated because the php is of course running on the server but we are talking about the client computer's time zone, so perhaps that isn't readily available on the server.

OK I think I'm starting to get the picture, it must be updated by the ajax request, as Flame said though that's not something I am familiar with yet. I suppose there is a mechanism for the client computer to inform the web server of its timezone, but we don't want to do that all the time.

EDIT2: Maybe it's not a bug at all. Maybe LFS website just isn't very quick to get the timezone right if the client adjusts their time zone. But it would be good to know if it eventually gets corrected.
Last edited by Scawen, .
Scawen
Developer
Thanks, I can reproduce that and will check it out tomorrow. I didn't realise the leagues system had quite a few bugs in it! Apparently in this case it prepares that list of tracks but doesn't specify which one is selected, so that information is lost when you submit the form.

EDIT: That is fixed now. This bug was newly introduced by me. It was caused when I changed a short track name function to display correctly on the calendar (e.g. SO2R). I didn't realise the same function was used internally for track name comparisons. I've restored the old function and added a new one for the calendar.
Last edited by Scawen, .
Scawen
Developer
Thanks a lot for your help.

I guess it's worked out at some point then stored in the session variables.

So not really a bug, but it just doesn't deal well with windows changing time zone (even if I restart the browser).

I'm not sure if there's a better way to do it, or a more standard way to do it. Maybe the time offset is readily available in a php function so we don't really have to go through all this confusing code?
Scawen
Developer
Yeah I've been looking around, it's pretty hard to unpick as there are a lot of functions calling others and conditional interactions between javascript and php.

It's too complicated for me now as long past my bed time. Trying to figure out other people's code isn't my favourite task. Maybe I can unpick this stuff a bit tomorrow.

But can I ask one question, is that session variable correct for you? I mean... do you see the calendar on the correct day, i.e. moving into the next day as the "current day" before UTC is actually at that day? Just wondering if my offset is zero because that is sort of in my session already, so it's not "tricked" by me changing the Windows time zone.
Scawen
Developer
I see... or I think I understand what you are saying but I still don't really understand why it worked fine on my computer. Uhmm

For further confusion, and answering your question, I was able to manually adjust the time using a value called LFS::$session->vars['timeOffset'] which I understand to be a time zone offset.

But I'm not really sure what's happening now, as it seems sometimes that offset is set to zero, even though I have set a different time zone in Windows. It comes from a $_GET['t'] value at some point.

That offset being zero seems to be why my calendar still shows me in Thursday when my timezone is actually UTC+1 at the moment.
Scawen
Developer
OK, I've changed it to follow the convention.

But I don't see the harm in initialising with the already converted time, it seems to me that it just avoids a 1 frame glitch when you reload the page.

When initialising with the UTC text, it is at first visible at UTC then a split second later changes to the local time for the selected timezone.

EDIT: I've found that it still thinks I am in Thursday, even though I set my timezone to UTC + 1 and that is really Friday now... looking into it...
Last edited by Scawen, .
Scawen
Developer
Nice detective work there! I've reinstated the original code now without the "bold" and fixed the same issue in another few places.
Scawen
Developer
Maybe your browser has a bug with data-format="time" ?

Instead of relying on that time tag I've now coded it manually instead, so I think it should work for you now.
Scawen
Developer
Oh, that is strange. It looks fine to me in Firefox if I go to UTC+1 timezone (the UTC hover text is an hour off from the visible text). I did have to refresh the page after changing time zone but then it looked correct.

It uses an html <time> element which in my browser shows local time normally but UTC time when hovering. It's the same with these forum post times (Today: 21:15) etc.
Scawen
Developer
I hope all the time zone stuff works properly, it's always confusing to implement and made my day's task a lot harder. Especially when we are dealing with things displayed near day and month boundaries, and must be placed and displayed in the correct day slot, and the viewer can be in any time zone, at any time, and select any month or week to view.

I'd obviously like to know if there are any errors with time zones.

A simple test is if someone could compare the in-game event browser with the website calendar and make sure it looks correct. Hovering over the event time should show the UTC time, in case that is useful.

One test I should do is set my timezone to somewhere far from UTC and confirm that some events fall into a different day or month on the calendar because of the time zone of the observer. But I'm a bit tired now, probably will test tomorrow.

I don't plan to do any more on this stuff for now except for any fixes. Really it was some holiday work but has gone on 4 extra days and we all know what I really have to work on now.

I hope the calendar and league section improvements are helpful.
Scawen
Developer
I've now made the calendar default to a weekly view, in which only one week is shown and you can click back and forward through the weeks.

That's more useful when you want to find out what's on this week. You can also switch to monthly view as before.

https://www.lfs.net/leagues/calendar
Scawen
Developer
Thanks, the in-game entry screen only showed events whose first round was less than 36 hours ago. This allowed for 24 hour races and two-day events, but not three-day events.

I've increased that limit to 3 days instead of 36 hours, so the second part of your multi day round of one of your concurrent series now appears in the in-game calendar. Big grin


EDIT: Also added the option to delete a round. At the bottom of 'edit round' page (like deleting a season).
Last edited by Scawen, .
Scawen
Developer
One more question, on cleaning up the website...

Does anyone still use IRC?
I could remove the section from this page: https://www.lfs.net/links
Scawen
Developer
Some updates:

Main page of website:

Removed text "Discover the realism of racing simulation..."
Updated events today on main page (using new calendar info)

Leagues:

FIX: Stream start time was not stored when first adding a round
Stream start time is now shown on round and season pages

Calendar:

Changed section name to Events rather than Leagues
Default page in Events section is now Calendar
Limited height of images (for taller aspect ratio images)
Replaced (some) links in description text with [link] to reduce length


Still to do:

Make calendar show current week as the top line by default

EDIT: Is it true that there is no way to DELETE a round of a series?
Last edited by Scawen, .
Scawen
Developer
I've solved the problem now by replacing words starting with 'http' or 'www.' with '[link]'

It's not actually a link but if they click it they will end up on the round's page so maybe this is OK at least for now. Though I realise they might write a link without any http or www.
Scawen
Developer
I've added: style="overflow-wrap: break-word" to the description text.
Does it help?
Scawen
Developer
Hmm, what to do? (fine in my Firefox too)
Images have max-width: 137px.
(137+10+1) * 7 + 1 = 1037 and the whole width is 1040. So 3 spare pixels according to my calculation!
Scawen
Developer
Rounds with sessions on different days now do appear on multiple days in the calendar (as a single entry).

EDIT: Moved posts about the text wrap issue to a bug report thread.
Last edited by Scawen, .
Scawen
Developer
Quote from tankslacno :tl;dr: LFS entry screen thinks my host is not online, even though it really is, and its season pages here also say it's online.

I've made the code for the in-game list match the code on the season details page, so now LFS entry screen does show the host online.

Why it is in lower case and cannot be changed, I have no idea (remember I had no part in writing this system). Maybe at some point in the process the lower case version was entered and is somehow stuck that way. Maybe I'll find out some time but I'll get on with the other changes first.
Scawen
Developer
Yes, I've been thinking that too.

Changes I want to do, related to feedback:

- Make multi day events appear on multiple days (but not showing each session, you can click to look at the event page for details.
- Have the current week at the top by default. Probably allow click forward or back 4 weeks at a time. Possibly allow month-based view as well though less important.
- Calendar as the default for leagues section, which I think should be renamed "Events" (unless someone has a better idea - to me "Leagues" at the top is a bit obscure as a way to find out what's on).
Scawen
Developer
Added a stream start time hover text to the stream logos.

It should be in your local time zone. Please could someone, who is not in GMT time zone, check if the hover text stream start time matches the stream start time shown in your LFS entry screen? EDIT: Thanks for the replies, I am sure it is OK now. Smile
Last edited by Scawen, .
Scawen
Developer
I'm trying to think how to do that.

At first I thought of auto-scrolling using a # in the url but think that might not look too good.

Now I'm wondering if it could operate in two different modes: weekly or monthly.

- Weekly mode could be the default start with the current week and have e.g. 3 extra weeks below.
- Monthly mode could be an option to show traditional calendar style as now.

Maybe someone has a better idea.
FGED GREDG RDFGDR GSFDG