Giter VIP home page Giter VIP logo

openstudyroom's Introduction

Open Study Room

Open Study Room (OSR) is a community of go/baduk/weiqi players who share, build and organize knowledge, opportunities and resources for learning, studying and playing Go online as part of a thriving worldwide community.

You can always meet us in our discord server.

Our website

This is the code of our website that runs at openstudyroom.org.

This website is written in python and powered by the django framework.

The project is under GNU GPL 3.

You are welcome to help us improve it or use it as the base for your own go community website.

It comes with the folowing tools:

A CMS

To manage the content, we use the wagtail CMS along with the puput blogging app.

The models and templates of this app can be found in the home folder.

A forum

The forum is powered by machina and uses mistune for markdown formating.

Custom template forum base template in openstudyroom/templates/boardbase.html.

A league app

Allow hosting go leagues where games are played on the KGS or OGS go server. A cron job can get games automatically from those servers.

Note that the auth model league.models.User is in here.

The scraper() function inside league.views is run by cron every 5 mins.

It's all under the league folder.

A tournament app

Allow hosting go tournaments. Games must be uploaded manually by admins.

A calendar and game planning tools

Allow admins to manage calendar events and users to plan games.

The client side is rendered by the js fullcalendar library.

Js goodies

[gmt] tag

This js will replace every [gmt]YYYY/MM/DD HH:mm[/gmt] to the locale datetime in the user timezone. Example output in french "dimanche 11 novembre 2018 19:00 (Europe/Paris)".

It is loaded on all .rich-text elements here and in the forum .post elements here.

[goban] tag

This js allow to replace [goban url="url/of/the/url"]some interactive comments[/goban] to a go board using the wgo.js library.

It's loaded on the forum .post-content elements here.

It's functionalities are documented here.

Contributing:

Have a look at our contributing guidelines here.

Working with Docker

  • Run the web server:
docker compose up app
  • Run ruff checks:
docker compose run --rm ruff
  • Launch the container CLI (for ewample to update translations):
docker compose run --rm cli

openstudyroom's People

Contributors

alexengelhardt avatar alextwadd avatar angelsesma avatar bcoulange avatar climu avatar clubdego974 avatar cspaier avatar czabo avatar dependabot[bot] avatar guishu avatar kamelotusky avatar lime-green avatar lknecht avatar lswest avatar lucasbertrand avatar mcsh avatar musniro avatar niels-van-den-hork avatar nomadfarmer avatar nshiff avatar nutler avatar patrickjamet avatar raylu avatar sammyeyeballs avatar zephyrraine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openstudyroom's Issues

Games archive are not working

In the game archive view, no games are listed.
Strange thing is I can't reproduce locally. I really don't understand why.

There is have one game view (here) that handle this.

This view can take an optional argument event_id that, if provided, only show games related to this league event.

When this event_id argument is provided, everything works well (see here).

When no event_id is provided (bug case), it calls this archive_game.html template.

When an event_id (working case), it calls this game.html template.

Both archive_games.html and games.html include another includes/games.html template for the game listing.

It seems the bug scenario don't call this include/game.html template at all in production.

Support multiple leagues at the same time

For now we just use on active event Registry.primary_event.

We think it would be better to support multiple event at the same time. That would allow us to host tournaments for instance, have long term league running along our ladder league system, support OGS leagues latter...

Since all the code rely on this primary_event thing, that's some work. If someone feels like sharing ideas, or starting working on it, he is welcome.

Allow us to host 'guest' leagues

Considering OSR would be happy to host leagues for some other friendly go community, it might be good to have a modular permissions system:

I am thinking creating a 'guest' class that would have:

  • admin group: Foreign Key on a user group
  • user group: (optional) Foreign Key on a user group
  • close: boolean flag. If true, only user from user group can join the league
  • private: (boolean flag): If true, only users from user group can see the league.
  • description: (rich ?) Text field that explain what this group is about.

When an admin would create for instance the guest 'A' we should :

  • create a user group ' A admins': users who would be allowed to administrated 'A league'

Those 'A admins' users would have acces to restricted league admin pages showing only 'A leagues'.

Setup a discord view

I am thinking of a discord view at /discord that would:

  • if user is a league member: redirect him to discord invite url (this url shoudln't be in the this github, so probably in a file as secretkey or in a setting)

  • else: redirect to / with a message as "OSR discord server is only for OSR member"

This would allow us to share the url /discord publicly without any worry.

kgs username not cheked during registration

Hi,
During registration, we perform no check on the kgs username.
We don't even check that it's not already in our db.

For the record, we use django allauth plugin for registration process.

Komi is not checked

We are currently not checking the komi setting of the game.
I don't know if I should have a strong 6.5 hardcoded or a setting per event.

wrong number of possible games

The event function (or method?) event.possible_games is very wrong.

It doesn't take care that some players are not in the same division.

I guess this calculus should belong to division.possible_games and we should change event.possible_games by summing all division.possible_games.

We shouldn't record unfinished sgf

Already happened: players stop their game before it's finish in order to resume it latter and our scraper check one of the player in the meantime.

We end up with a sgf that have no results.

Such a sgf won't pass test and no game will be created but when they finish their game, the scraper won't analyse it again since we will already have a sgf with the same urlto in the db.

Get player results implicitly from DB

The current way the results of a player are stored is via a string that stores a serialized dict, that is eval'ed to get the dict back.

As each game has 3 foreign keys to players (black, white and winner) we can generate the very same results dict from the database directly. This means we no-longer have to keep the serialized dicts in sync with the actual played games. (It also closes a security hole where we are eval'ing player names. Those could theoretically contain python code).

Given that we are going to be deleting matches (as per issue #18) this is going to save a lot of time.
A similar thing could be done to LeagePlayer.nb_wins and LeaguePlayer.nb_losses, at which point (I think) we wouldn't need to modify a LeaguePlayer at all when deleting a Game.

The solution would look something like below, this is fully of the cuff, I haven't even checked if it has syntax errors.

from collections import defaultdict

from collections import defaultdict

def get_results(self):
    blackGames = self.black.get_queryset() 
    whiteGames = self.black.get_queryset()
    
    resultsDict = defaultdict(list)
    
    for game in blackGames:
        opponent = game.white
        won = game.winner == self
        
        record = {
            'id': game.pk,
            'r' : 1 if won else 0
        }        
        resultsDict[opponent.kgs_username].append(record)
        
    for game in whiteGames:
        opponent = game.black
        won = game.winner == self
        
        record = {
            'id': game.pk,
            'r' : 1 if won else 0
        }        
        resultsDict[opponent.kgs_username].append(record)

Should performance ever be an issue, this function could be cached.

Allow hosting manual upload leagues

Let say some community (go club) want to host a real life league. Or another one want their users to play anywhere they want.

We could allow one player to upload a sgf and then wait for the opponent to confirm the game is proper.

Me vs opponent in profile

When a logged user browse another user profile, it could be cool if there were a place opponent VS me containing things like:

  • stats of games we played together (win/loss).
  • list of games we played together.

Just an idea.

Show public event detail on hover

Public events title often doesn't fit the calendar day width.
We should show a tooltip on hover with event title and event description.

Change the results to a object

Right now, results are a dict.
I am thinking it would be cleaner to have a result object.

Such models are quite above my head at the moment.

Templates are wrong (W3C very far)

Just checked this W3C validator and we have 19 erros and 8 warnings on homepage.

If someone feels likes sanitysing a bit our templates he is more than welcome.

Wrong rank in player list

In players template we just use a forloop.counter to display the user's rank.

While this works well when there was only one division, it show wrong rank now see here.

I guess we should have a nested loop:
for division in divisions:
for player in division.get_players:

HTTPS for website

For a system the allows user to register and login with a username and password an HTTPS website is mandatory.

better css

I think our website could use some css polishing.

I am thinking about our sidebar for instance. I just copy/past css from puput demo.

Feel free to change things in this folder and send pull/request.

Add latests kgs rank next to names

Hi there. I am a ruby coder and just joined OSR. And it surprised me that this is not implemented.

Although Python feels like a ruby a close relative I don't feel so confident as to develop this myself (I'll try though).

Basically I think we could hit http://www.gokgs.com/gameArchives.jsp?user=jacksonh parse the html (obviously there are a lot of libs for this) and get the last rank from there (the rank of the player in it's last game).

I would be glad to pair program on this so I could learn some python/django while doing it.

Calendar event system

I think we should start having a proper event system.

We could have 2 kind of events: public and private.

  • Public: For lectures, game commentary... Only OSR admins should be able to create such.

  • Private: To allow our member to shcedule games.

Then each member would have a calendar with all events both public and private related to him.

Best would be to create a new django app for this I guess.
draft model I can think of:

Class Event:

  • begindate: DatetimeField
  • enddate: DatetimeField
  • place: Charfield # the server where the event will take place
  • description: Charfield #a richtext thing would be best I think
  • public: boolean
  • users: ManytoManyfield(User) # if not public, will be showed for those users
  • groups: ManytoMany(group) # if not public, will be showed for those groups

Get rid of the game class

It appear the game class is not needed.
It's just a valid sgf related to an event.
I will add Foreignkeys to link a sgf to black and white users instead of keeping the kgs_usernames.

Then I will create a view that will update all valid sgfs.

League admin tools missing

We need to create some views that allow league admins to view/edit/delete games, events, divisions, and players.

wgo doesn't like iframe (who does?)

When viewing games in pages like this one there is a error popup when you reach the end of the sgf.

Such error doesn't happen when is not iframed. See here for instance.

Since wgo js is loaded on every pages of the website (that is not proper I guess) it might be a conflict between the 2 js files.

I see 2 ways to fix it:

1: Remove wgo js from pages that doesn't needs it.

2 :sgf api and no more iframe:

  • create a sgf api: a view at /league/sgf/id that would just return the sgf datas.
  • instead of changing iframe content, we could have a js function update_wgo(id) that would get sgf data from sgf api and update the player using wgo js.

Maybe best would be to apply both since neither using iframe nor loading unneeded js on everypages we want.

have linked leagues

Following this idea on our forum, I think it would be good to be able to have linked leagues.

The idea would be for a game to count in mutliple leagues.

I think a way could be to create a new "master league" type that would get all games played in all leagues.

Support timezones

Soon we will have a calendar view and event list.

It could be really cool to display all dates on the user timezone.

Django have a way to deal with that (doc).

We could have a timezone field in the user profile to allow user to set them manually.

We could also detect timezone directly.

I think best would be to check if user have a timezone setted and, if not, detect it.

Having a game view

I think it could be good to have a view that show a game at /league/game/id.

Just some infos with the league, group, players, winner and the game showed with wgo.

That will allow us to easily refer to a game by providing a link to it.

Better profile

We should create a better profile page allowing users to set their biography, usernames on various go servers...

Best would be to regroup the forum profile fields and the others. I tryed onece, but it was tricky.

fix the how to deploy locally

RIght now, I can't manage to deploy the website locally following this how to.

I am working on already deployed versions.

This is quite a big bug since it means people are not able to help us anymore.

adapt time to local format

We should adapt times and dates to local format.

Specially on calendar, but I guess everywhere.

Either we detect users location or we use timezone setting, or we ask user his country to set format ?

Write a game planing tool

Allow users to set when they are available is already working.

Next step is to display when people are available in a user calendar and allow him to create game request.

Have a tournament system

That's an idea that have been raise multiple times.

I just saw this django package that should help doing so.

It's not urgent but if someone feels like integrating such things, he is welcome

Account Screen - League Tables should be fixed size when paging through

https://openstudyroom.org/league/account/

When you page through the league players, for example in the OSR Meijin league, when there are fewer players to display it shrinks the table and causes everything underneath to shift up. This is disorienting to the user. When you are on the final page of pagination, even with fewer players to display, the height should be fixed.

Fourth Page:
image

Final Page:
image

Clicking back and forth should keep the table consistent for easy browsing.

uploading a specific game doesn't work

Uploading the sgf ;kiren vs p0tat0 does create a sgf but not a game object.

The save sgf buttons calls this view.

I got the message "Succesfully created a sgf and a league game " and the created sgf is valid.

I think it's here and here: we need to ad _iexact to so the kgs_username check are case insensitive.

Trying tomorow

I might edit directly in the server and pushed from there if we don't manage to deal with the github things soon.

add better way to identify sgfs

Hi,
At the moment we are using the urlto field to check if a sgf is not already in the db.

While this work for automatic kgs games added by check_player, there could be conflict when we upload games manually.

Indeed manual upload sgf urlto field is set to the default 'http://'.

I was thinking using the BL[time] WL[time] that record the exact time (milliseconds) left for a player at a move inside a sgf.

I guess we can assume that if in 2 sgf, both 5 first move have been played at the exact same time, those are same sgf;

So creating a new field 'check_code' that would be a list (or the sum?) of those could work better I think.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.