Latest Posts

Topic: game scheduling module

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-09, 20:31

or I create a disponibilities table which reference the id of a user?

Yes, thats the way it has to go. In Django terms you have to create a model with the fields (database columns) you need and additionally a field 'user' (or similar name) which will be a foreign key field. You can take a look at the 'Vote model in wlpoll/models.py for comparison:

class Vote(models.Model):
    user = models.ForeignKey(User, related_name='poll_votes')
    poll = models.ForeignKey(Poll)
    choice = models.ForeignKey(Choice)
    date_voted = models.DateTimeField(
        'voted at', default=datetime.datetime.now)

The field 'user' creates the relation from/to the model 'Vote' and a registered user (model: auth.user, which is part of the django frame work). After the creation of the model you have to run ./manage.py makemigrations and ./manage.py migrate to get your model into the database. All necessary work in database will be made automatically then. Refer to the Django documentation for more information about the available field types and options, e.g. there is also a DateTimeField available.

Regarding the colors:

Or how about giving the available dates a color, and making the other dates empty boxes?

+1


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

Ok thanks a lot Kaputnik, I think I'm almost done (if we ignore all the work that has to be done to check login, clean database regularly, display dates on right order and things like that).

I just need to test the module with another user, but I need to activate new users with mail activation, which is kind of hard in local (I don't want to set up the mails...). Is there any way to circumvent that?


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

You can add new users through the admin interface in admin/auth/user/add/. Then you can set them as active manually too.


Busy indexing nil values

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

Yes it's working! Thanks !:D

I don't think I'll have time to finish it before I go to vacation though, so I'll do the finitions next week face-smile.png


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

Enjoy your vacation! face-smile.png


Busy indexing nil values

Top Quote
WorldSavior
Avatar
Joined: 2016-10-15, 04:10
Posts: 2125
OS: Linux
Version: Recent tournament version
Ranking
One Elder of Players
Location: Germany
Posted at: 2017-08-11, 18:54

trimard wrote:

Well, this page can also do the job, and more things: https://dudle.inf.tu-dresden.de/

Oh yes, I use a similar tool pretty often IRL.

The main difference I'm proposing here is that you don't need to know the player before knowing if they are available or not. It's easier to check as everything would be on the same website. Also I think it would become laborious when a lot of player and a lot of date are available. It seems this tools is better for setting one date with a few people you know rather than many dates with many people you don't know. But I never use this specific tool so I might be wrong.

kaputtnik wrote:

The doodle things have one culprit: They are used to find a specific date and time where most people have time to participate.

WorldSavior: How will you make a doodle showing possible play time of players? If one player creates a doodle, how will other players may be informed?

I misunderstood the proposal. First I thought that the tool should just find the right date between players who know each other already and who are already planning that they want to play face-wink.png

So, I don't know if "dudle" could do this. Probably not...


Wanted to save the world, then I got widetracked

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

Thanks Guncleoc, they were good indeed face-smile.png

No problem worldsavior but you raised a good point though: should we create a module to find games for two players that know eachother? I agree with you that, for now at least, it is unnecessary.

I m progressing but i l having a hard time testing the timezones. I dont know why but i can t change the timezones of the users i created. Is there a trick like the one to create user? There is no option to change the timezone in the admin board..


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-21, 07:56

Setting the timezone of a user is part of the wlprofile module, not part of the auth_user. In the admin panle you could find it under Wlprofile -> Profile.


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

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

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.


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

The browser will cache the Javascript if you put it into a separate file https://stackoverflow.com/questions/29918246/javascript-inline-vs-external-script-whats-the-difference, so that should reduce the download time.


Busy indexing nil values

Top Quote