Gollwu / LoLManager

Development of amateur application LoL Manager
Other
3 stars 0 forks source link

Database and connection to application #4

Closed Gollwu closed 9 years ago

Gollwu commented 9 years ago

For now I'll just create a database with 2 teams of 5 players and 10 champions. The caracs will be the ones displayed in the BDD_Params pdf of the repo.

Gollwu commented 9 years ago

Première table créée

INSERT INTO damage_percentage(Role, ADCarry, Tank, ADTank, APCarry, APTank, AssassinAD, Support) VALUES ('ADCarry', 100, 20, 35, 100, 40, 90, 85), ('Tank', 60, 20, 5, 10, 55, 55, 50), ('ADTank', 70, 30, 15, 20, 65, 65, 60), ('APCarry', 100, 20, 35, 100, 40, 90, 100), ('APTank', 75, 35, 20, 25, 70, 70, 65), ('AssassinAD', 100, 20, 35, 100, 40, 100, 100), ('Support', 20, 5, 10, 20, 10, 20, 15);

Role is a varchar 20.

qr7hur commented 9 years ago

Avoid plaintext passwords on a public repo :) It's not even necessary to understand and argue on this issue, and there are many crawlers on GitHub constantly looking for such mistakes.

I think open projects generally have a separate file for passwords, .gitignore this file and use another secure channel to give passwords to collaborators. On the repo itself there should be some _dbcredentials.js.example instead of the actual one.

Removing the compromising comment/file would be inefficient, change the password.

Gollwu commented 9 years ago

matchup table

CREATE TABLE matchup ( champion varchar(25), irelia int, riven int, anivia int, lucian int, thresh int, trundle int, fiddlesticks int, kogmaw int, vayne int, taric int )

INSERT INTO matchup(champion, irelia, riven, anivia, lucian, thresh, trundle, fiddlesticks, kogmaw, vayne, taric) VALUES ('irelia', 50, 45, 65, 55, 65, 45, 70, 70, 50, 48), ('riven', 55, 50, 55, 55, 60, 50, 60, 60, 50, 50), ('anivia', 35, 45, 50, 50, 50, 50, 45, 45, 40, 55), ('lucian', 45, 45, 50, 50, 55, 50, 45, 60, 60, 55), ('thresh', 35, 40, 50, 45, 50, 40, 60, 55, 40, 60), ('trundle', 55, 50, 50, 50, 60, 50, 40, 45, 35, 60), ('fiddlesticks', 30, 40, 55, 55, 40, 60, 50, 60, 50, 45), ('kogmaw', 30, 40, 55, 40, 45, 55, 40, 50, 45, 55), ('vayne', 50, 50, 60, 40, 60, 65, 50, 35, 50, 50), ('taric', 52, 50, 45, 45, 40, 40, 55, 45, 50, 50);

Feel free to advise on column names/table names... The values are for decoration and for now we keep the database little.

Gollwu commented 9 years ago

Table with the synergy between champions, I took the values from the matchup even tho it's completely not correct. We'll discuss about the values later.

CREATE TABLE synergy ( champion varchar(25), irelia int, riven int, anivia int, lucian int, thresh int, trundle int, fiddlesticks int, kogmaw int, vayne int, taric int )

INSERT INTO synergy(champion, irelia, riven, anivia, lucian, thresh, trundle, fiddlesticks, kogmaw, vayne, taric) VALUES ('irelia', 50, 45, 65, 55, 65, 45, 70, 70, 50, 48), ('riven', 55, 50, 55, 55, 60, 50, 60, 60, 50, 50), ('anivia', 35, 45, 50, 50, 50, 50, 45, 45, 40, 55), ('lucian', 45, 45, 50, 50, 55, 50, 45, 60, 60, 55), ('thresh', 35, 40, 50, 45, 50, 40, 60, 55, 40, 60), ('trundle', 55, 50, 50, 50, 60, 50, 40, 45, 35, 60), ('fiddlesticks', 30, 40, 55, 55, 40, 60, 50, 60, 50, 45), ('kogmaw', 30, 40, 55, 40, 45, 55, 40, 50, 45, 55), ('vayne', 50, 50, 60, 40, 60, 65, 50, 35, 50, 50), ('taric', 52, 50, 45, 45, 40, 40, 55, 45, 50, 50);

Gollwu commented 9 years ago

Here the tables for the players, not yet queried because I'd like to add the real values but I can't access LeaguePedia here. Feel free to send me your line of stats and/or modification for the table (age+birthdate redundant and shit like that)

CREATE TABLE player ( id int, firstname varchar(25), lastname varchar(25), pseudo varchar(25), age int, birthdate date, country varchar(30), role varchar(15), warding int, community int, attitude int, charisma int, adaptability int, excentricity int, laning int, farming int, outplay int, ganking int, pressuring int, smiting int,
ADcarry int, ADCarry int, Tank int, ADTank int, APCarry int, APTank int, AssassinAD int, Support int, )

INSERT INTO player(id, firstname,lastname, pseudo, age, birthdate, country, role, warding, community, attitude, charisma, adaptability, excentricity, laning, farming, outplay, ganking, pressuring, smiting, ADcarry, ADCarry, Tank, ADTank, APCarry, APTank, AssassinAD, Support) VALUES (1, 'Mike', 'Petersen', 'Wickd', 23, '1991/01/22', 'Denmark', 'toplaner', 20, 15, 60, 45, 20, 35, 70, 70, 50, 30, 20, 10, 15, 90, 80, 60, 80, 25, 40), (2, '', '', 'Shook', 23, '1991/01/22', 'German', 'jungler', 20, 15, 60, 45, 20, 35, 70, 70, 50, 30, 20, 10, 15, 90, 80, 60, 80, 25, 40), (3, 'Henrik', '', 'Froggen', 23, '1991/01/22', 'Denmark', 'midlaner', 20, 15, 60, 45, 20, 35, 70, 70, 50, 30, 20, 10, 15, 90, 80, 60, 80, 25, 40), (4, 'Martin', 'Larssen', 'Rekkles', 23, '1991/01/22', 'Denmark', 'adcarry', 20, 15, 60, 45, 20, 35, 70, 70, 50, 30, 20, 10, 15, 90, 80, 60, 80, 25, 40), (5, 'Patryk', '', 'Nyph', 23, '1991/01/22', 'Germany', 'support', 20, 15, 60, 45, 20, 35, 70, 70, 50, 30, 20, 10, 15, 90, 80, 60, 80, 25, 40), (6, 'Jeff', 'Aubry', 'Gollwu', 22, '1992/11/02', 'France', 'toplaner', 20, 15, 60, 45, 20, 35, 70, 70, 50, 30, 20, 10, 15, 90, 80, 60, 80, 25, 40), (7, 'Maxime', 'Gillet', 'Nerevar', 23, '1991/01/22', 'France', 'jungler', 20, 15, 60, 45, 20, 35, 70, 70, 50, 30, 20, 10, 15, 90, 80, 60, 80, 25, 40), (8, 'Arthur', 'Baudoin', 'Overplow', 23, '1991/01/22', 'France', 'midlaner', 20, 15, 60, 45, 20, 35, 70, 70, 50, 30, 20, 10, 15, 90, 80, 60, 80, 25, 40), (9, 'Fabien', 'Daoulas', 'Hycariss', 23, '1991/01/22', 'France', 'adcarry', 20, 15, 60, 45, 20, 35, 70, 70, 50, 30, 20, 10, 15, 90, 80, 60, 80, 25, 40), (10, 'Alexis', 'Krakowinski', 'Sowerdski', 23, '1991/01/22', 'France', 'support', 20, 15, 60, 45, 20, 35, 70, 70, 50, 30, 20, 10, 15, 90, 80, 60, 80, 25, 40);

Gollwu commented 9 years ago

Team table. Do I have to create a 0 player in the player database for the empty players in the team?

CREATE TABLE team ( id int, name varchar(40), player1 int, player2 int, player3 int, player4 int, player5 int, player6 int, player7 int, player8 int, synergy int,
splitpushing int, teamfighting int, poking int, aoe int, objectivecontrol int, closinggames int

)

INSERT INTO team(id, name, player1, player2, player3, player4, player5, player6, player7, player8, synergy, splitpushing, teamfighting, poking, aoe, objectivecontrol, closinggames) VALUES (1, 'Elements', 1, 2, 3, 4, 5, 0,0,0, 65, 90, 70, 70, 80, 70, 40), (2, 'Ze Random Guys', 6, 7, 8, 9, 10, 0, 0, 0, 80, 30, 50, 50, 70, 40, 20);

Gollwu commented 9 years ago

CREATE TABLE affinity ( player int, irelia int, riven int, anivia int, lucian int, thresh int, trundle int, fiddlesticks int, kogmaw int, vayne int, taric int
)

INSERT INTO affinity(player, irelia, riven, anivia, lucian, thresh, trundle, fiddlesticks, kogmaw, vayne, taric) VALUES (1, 100, 80, 30, 35, 40, 80, 20, 30, 15, 45), (2, 50, 95, 25, 60, 50, 70, 80, 50, 20, 20), (3, 75, 80, 100, 80, 40, 10, 20, 40, 40, 10), (4, 20, 20, 20, 100, 20, 20, 20, 95, 85, 5), (5, 25, 20, 30, 40, 95, 30, 75, 20, 20, 75), (7, 30, 40, 55, 55, 40, 60, 50, 60, 15, 50), (8, 20, 30, 20, 20, 10, 10, 75, 100, 20, 10), (9, 80, 40, 20, 90, 55, 70, 10, 40, 75, 30), (10, 0, 0, 0, 0, 85, 20, 0, 30, -5, 110);

Gollwu commented 9 years ago

I am currently trying to connect to the database via sockets from a client.

Currently having a problem (No 'Access-Control-Allow-Origin' header is present on the requested resource.) If anyone wanna help me on this one, the server with the client test file are under Gollwu/LoLManager-Server and it is temporarily linked to lolmanager.herokuapp.com with an autodeploy on the commits on the master branch.

Gollwu commented 9 years ago

Ok the problem is server-side, I'll check the logs of the application. Currently you can't GET anything from it and it sens errors 503

Gollwu commented 9 years ago

Server problem was a dependency missing (pg library). Now the client can connect. I still can't make the sockets work to query the database

fabienDaou commented 9 years ago

WebSockets is not needed for this feature. A REST architecture is more appropriate, there is no need to keep the connection alive. We only need to process queries on a DB which can be done via a GET http request (retrieving data) or a POST http request (modifying data). A PHP script would be the REST server providing several services. Here is picture to better understand the whole thing: server

Gollwu commented 9 years ago

I don't think we will need AJAX yet. There should only be one load in the database at the beginning of a match to retrieve stats of the players. The actual live stats during a game should be managed client-side for the moment imo.

If the game ever sees multiplayer then we will have to rethink eveything :)

fabienDaou commented 9 years ago

How would you perform a GET request without AJAX? I mean there must be a trick but i would rather use a well known library allowing us to add feature in the future. Having a well-thought backbone will avoid us a lot of future issues

Gollwu commented 9 years ago

Any neeeeeeews?

Gollwu commented 9 years ago

See #30 , we need to add stats to champion themselves to make them fit or not to the different strategies. Also could be nice to have stats like "farming", "ganking" etc...

Gollwu commented 9 years ago

Ticket outdated? Maybe we should close it

Nhacsam commented 9 years ago

Just do it