Latest Posts

Topic: game scheduling module

trimard
Avatar
Topic Opener
Joined: 2009-03-05, 22:40
Posts: 230
Ranking
Widelands-Forum-Junkie
Location: Paris
Posted at: 2017-08-22, 12:07

Cool face-grin.png


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3317
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2017-08-23, 16:24

I just stumbled upon this open bug - might be an idea for solving the time zones issue: https://bugs.launchpad.net/widelands-website/+bug/1649073


Busy indexing nil values

Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 2550
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-08-23, 22:36

trimard wrote:

Thanks! I'm having a lot of bug with this part right now. So I can't even test it with another timezone yet:P

Timezone handling is quite complicated...

Oh my, the js file is already 200 lines long... Could that be a problem for the performances that you seek? Longer script means longer time to download the script from the user.

May you could provide some of the implementation details? Or provide a branch on launchpad?


Top Quote
trimard
Avatar
Topic Opener
Joined: 2009-03-05, 22:40
Posts: 230
Ranking
Widelands-Forum-Junkie
Location: Paris
Posted at: 2017-08-23, 23:52

Gunscheoc Mhh I m not sure it would change much for me. I don t use django a lot for the logic. User.wlprofile.time_zone seems good enough this module. But maybe my implémentation isn t right

@Kaputnik

Yes good idea! I showed it to my brother and he told me to make some change in the db. If some other major changes are needed i guess it would be better to have your advices too.

i ll send tomorow or the day after. I want to make good explanations with it.


Top Quote
trimard
Avatar
Topic Opener
Joined: 2009-03-05, 22:40
Posts: 230
Ranking
Widelands-Forum-Junkie
Location: Paris
Posted at: 2017-08-24, 20:35

So here is the... dirty thing... https://code.launchpad.net/~trimardio/widelands-website/scheduling

How I implemented that:

js create a new date for each of the selected date by the users. In these the user can choose the hours that he want. I store the information as a dict { date1: hours_as_strings, date2: hours_as_strings, ...} This information storage is globally kept in the whole module and that is on that part that I think I should make the most changes.

on click of validate js create a form in which the dates and hours are put inside. This sends a request to the server.

The server store the dict as I described them already, simply adding the name of the user.

The server sends as a response the users that are available at those time with the hours at which they are available (not working right now because I broke things ahead)


Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 2550
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-08-24, 22:10

I think the general approach is good face-smile.png Didn't looked into the code yet.

Here's how it looks like for me:

scheduling

The calendar is a bit fuzzy.

I have to look into the code right now.... could take some time.


Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 2550
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-08-24, 22:20

Forgot: Please re-add the files to your branch:

  • local_settings.py.sample
  • local_urls.py.sample

Otherwise they will be omitted when merging into trunk.


Top Quote
trimard
Avatar
Topic Opener
Joined: 2009-03-05, 22:40
Posts: 230
Ranking
Widelands-Forum-Junkie
Location: Paris
Posted at: 2017-08-25, 18:44

Thanks!

The calandar is a bit fuzzy? What is the problem you think?

Yes I'll add the samples in the next commits. But I'm not rushing, there still needs work before the final push face-tongue.png


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3317
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2017-08-26, 08:55

Fuzzyness usually results from scaling something - is the calendar using images for anything?

It would also be good to give it the dark background and white text color.


Busy indexing nil values

Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 2550
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-08-26, 11:52

Maybe remove the text-shadow from the datepicker and use other colors: normal dates=gray, availabale dates=black, chosen date=green? Just an idea face-smile.png

You can look into the python datetime library for timezone related things. See also the setting TIME_ZONE in settings.py

Disclaimer: I do currently most of the work for the website, but i am far away from being a django/javascript/html/css specialist face-grin.png So the following statements are just some thoughts upon my little knowledge:

try:
    if request.POST['dates']:
        request_dates[r] = request.POST['dates'][r]
  • I think there should be also a different view which shows all available dates from other users without specifying an own available date. Some users have just time (e.g. school holidays) and don't want to add each day and hour to the scheduling module.

Top Quote