Hall of Fame Vote Backload

From StatsLab Wiki
Jump to navigation Jump to search

This pages contains basic instructions for backloading Hall of Fame voting results. If your league has historical ballot information from prior to using StatsLab for HOF voting, this is the way to get that information into the StatsLab database.

This process will require direct access to your MySQL database either through a web portal like phpMyAdmin or through some other means. Since direct access to MySQL is dependent on your web host, each league commissioner will have to determine this piece individually.


Step 0: Back Up Your StatsLab Database

Whenever modifying a database, it’s an extremely good idea to back up your existing database first. That way, any mistakes that happen can easily be rolled back.

Step 1: Organize your ballots

StatsLab allows for one HOF ballot annually. For each historical ballot, you’ll need to know the year that ballot applied to, the players who appeared on the ballot, whether they were a batter or a pitcher, how many votes they received, and who voted for them.

Step 2: Find Player ID’s

For each player who has ever appeared on a ballot, you’ll need to identify the OOTP internal player ID for that player. If you’re not sure what it is, you can look them up in StatsLab or in the HTML reports. The player ID will appear in the URL.

Step 3: Find Voter Human Manager ID’s

StatsLab associates votes with logged in users. This is necessary to keep a history of who vote for who, as well as to determine exactly how many ballots were cast in a given year. If you’re not sure what it is, you can go into StatsLab, go to the manager listing, click on the manager name, and the HTML report for that user will have the human manager ID in the URL.

What about people who have left your league? Consider looking them up in the OOTP history pages manager listing.

What about people who have never been a part of the OOTP experience but who voted on your forums? It is possible to give a fake human manager ID with a very high number to each of these. Just make sure that you always use the same ID for each voter. E.g. 10001, 10002, 10003, etc.

Step 4: Determine the League ID

StatsLab associates HOF voting with major leagues. For example, if you have MLB and NPB, the HOF votes for each of those leagues is considered independent. Make sure you know the right league ID for the league your vote applies to. Usually, this is the primary league in your game. If you’re not sure what it is, you can find it by looking at the URL for the league’s primary OOTP home page. Interlude: MySQL Concepts Databases like MySQL have defined structures and understand specific commands. SQL stands for Structured Query Language. Modifying the data in a MySQL database is done through queries. Queries can modify multiple rows in a MySQL table, or one row at a time. In this process, we’ll create one query per row we want to modify. A semi colon is used to indicate the end of a query, so don’t forget to include them!

Step 5: Prepare the Ballot Queries

Since it’s possible for some players to appear on a ballot and not receive a single vote, the entire ballot needs to be stored in the StatsLab database. You’ll need a separate query for each player who appeared on the ballot, and each year they appeared on the ballot.

The queries listed below should be filled out with the appropriate data:

For batters, the query is:

INSERT IGNORE INTO awards_vote (player_id,league_id,sub_league_id,human_manager_id,year,award_id,vote,position) VALUES (<player_id>,<league_id>,0,-1,<ballot_year>,100,0,10);

For pitchers, the query is:

INSERT IGNORE INTO awards_vote (player_id,league_id,sub_league_id,human_manager_id,year,award_id,vote,position) VALUES (<player_id>,<league_id>,0,-1,<ballot_year>,100,0,1);

Example of 3 batters, 2 pitchers, on 2013 ballot in league 100:

INSERT IGNORE INTO awards_vote (player_id,league_id,sub_league_id,human_manager_id,year,award_id,vote,position) VALUES (1,100,0,-1,2013,100,0,10);

INSERT IGNORE INTO awards_vote (player_id,league_id,sub_league_id,human_manager_id,year,award_id,vote,position) VALUES (2,100,0,-1,2013,100,0,10);

INSERT IGNORE INTO awards_vote (player_id,league_id,sub_league_id,human_manager_id,year,award_id,vote,position) VALUES (3,100,0,-1,2013,100,0,10);

INSERT IGNORE INTO awards_vote (player_id,league_id,sub_league_id,human_manager_id,year,award_id,vote,position) VALUES (4,100,0,-1,2013,100,0,1);

INSERT IGNORE INTO awards_vote (player_id,league_id,sub_league_id,human_manager_id,year,award_id,vote,position) VALUES (5,100,0,-1,2013,100,0,1);


Step 6: Prepare the Vote Queries

The vote query looks like this:

INSERT INTO awards_vote (player_id,league_id,sub_league_id,human_manager_id,year,award_id,vote) VALUES (<player_id>,<league_id>,0,<human_manager_id>,<ballot_year>,100,1);

Examples of some vote queries (3 different voters):

INSERT INTO awards_vote (player_id,league_id,sub_league_id,human_manager_id,year,award_id,vote) VALUES (1,100,0,1,2013,100,1);

INSERT INTO awards_vote (player_id,league_id,sub_league_id,human_manager_id,year,award_id,vote) VALUES (2,100,0,1,2013,100,1);

INSERT INTO awards_vote (player_id,league_id,sub_league_id,human_manager_id,year,award_id,vote) VALUES (4,100,0,1,2013,100,1);

INSERT INTO awards_vote (player_id,league_id,sub_league_id,human_manager_id,year,award_id,vote) VALUES (1,100,0,2,2013,100,1);

INSERT INTO awards_vote (player_id,league_id,sub_league_id,human_manager_id,year,award_id,vote) VALUES (1,100,0,3,2013,100,1);

INSERT INTO awards_vote (player_id,league_id,sub_league_id,human_manager_id,year,award_id,vote) VALUES (4,100,0,3,2013,100,1);


Step 7: Load the Queries

It’s at this point that you actually need to access your MySQL database. If you’re using phpMyAdmin, log in and then select your StatsLab database. From there, you should be able to import the queries as part of a SQL text file or by manually entering them into a SQL query window.