Kevin has responded, and added code to protobowl that will add buzzes into a table. He records the user name, subject, and whether or not the buzz was early, an interrupt, or correct. As soon as I got the word, I went to work writing a function that would move this data into my users table. Something is a power if it is early in correct, a get if it is correct, and a neg if it is an interrupt and incorrect. My original plan was to nest a series of queries, one that would get all of the buzzes, another that would get users one at a time, and then a third that would push the new values for powers, gets, and negs. Once I got this code up in running, I realized that I had a lot of work to do, as this did not work at all. It appeared that all of the queries were being executed for the very last buzz in the table, which did not match up with what I had coded. In addition, my code was messy because I had to nest so many queries inside of each other. I finally figured out that my error was that queries run asynchronously, meaning that their execution was delayed until my counter variable was on the last index. I did some Google searching, and found a tool that allows users to run synchronous postgresql queries. Not only did this tool fix my errors, but it allowed me to run queries like functions, and returned the result as an object array, meaning that it also made my code shorter and nicer. Currently, I think my program is working, but I have been having difficulty getting test data for myself, so this is what I will be working on next.
On another note, I told a currently graduated senior that I would take over our school’s quizbowl database, but this turned out to be more work than expected. I found out that there is too much data in it for me to use a free heroku posgresql database, so I am currently exploring using DigitalOcean to host the database. I currently have a $5/month plan with them for this project, but I got $100 dollars from them for free because I am a student. Right now, I am trying to figure out how to transfer the data to my new virtual machine so that I can place it on a database there (I will also need to figure out how to connect to the database once it is up and running. This project involves a lot of things that I have never done before, and even though I am looking forward to working on it, I would rather be working on my protobowl app because it will be less about blindly following tutorials and more about using tools that I have already learned. While I would rather be working on protobowl, I feel that I have a sense of obligation to our school’s quizbowl program, as they are my family at school. I honestly don’t know which project I want to focus on, but I will be figuring that out over the next couple of days.