SaintsRobotics / frc-scout-2016

super fancy web scouting
http://frcscout.com
5 stars 0 forks source link

match-scouting.js code formatting #3

Open terabyte128 opened 8 years ago

terabyte128 commented 8 years ago

Hi all,

I'm super happy that you've decided to work on porting FRC scout to this year's game. I'd just like to apologize for the complete mess that is match-scouting.js. If you have any questions about it, I can try and answer.

Sam

PrecociouslyDigital commented 8 years ago

just to clarify; what we got was that each scouting screen is called a "stage", and that at the end of each "stage", data is written to localstorage. At the end of each match, it attempts to post all data in localstorage to the server, then deletes it from localstorage if successful. @terabyte128

terabyte128 commented 8 years ago

That's correct. Data will persist in local storage if it can't be pushed to the server; I also had a button on the home screen that would appear if cached data was left over, and let the user attempt to push it to the server again. Everything at that point is encoded as JSON.

PrecociouslyDigital commented 8 years ago

Can you explain how pit scout image data is saved? (I know it doesn't have anything to do with match scouter, but it's been bugging me.)

PrecociouslyDigital commented 8 years ago

@terabyte128

terabyte128 commented 8 years ago

Yes, let's see... Normal data is sent off right to the database here. (note: some more validation here would be a good idea)

Images are uploaded to Imgur, to avoid dealing with storing them on our website. (We had some issues with it being blocked on school networks last year, might be a good idea to find an alternate host. Though if you can get away with not hosting images on your own server, I would highly recommend that.) The function for doing so is located here.

  1. It attempts to upload the image, if it exists, then calls postFormData() no matter if the upload succeeds or not (this was an inane design decision, it should probably notify the user of failure and then not transparently upload the rest of the data). <-- I actually think this was a mistake, and it should really just reset the progress bar and prompt them to try again
  2. postFormData() bundles up Imgur's response with the picture's URL, along with the rest of the form data, and submits it to our server, where it is processed as noted above.
terabyte128 commented 8 years ago

another note: you can probably use the same auth token for Imgur as we did, although uploading that to GitHub likely wasn't the best idea ;)

PrecociouslyDigital commented 8 years ago

Yeah you guys left all your api keys in. I'm deleting them rn. :-P

terabyte128 commented 8 years ago

Iirc, the imgur key was the only one I forgot about -- did you find something else (oh, and Google analytics) On Tue, Jan 26, 2016 at 3:22 PM Benjamin notifications@github.com wrote:

Yeah you guys left all your api keys in. I'm deleting them rn. :-P

— Reply to this email directly or view it on GitHub https://github.com/SaintsRobotics/frc-scout-2016/issues/3#issuecomment-175290023 .

Sam Wolfson

PrecociouslyDigital commented 8 years ago

You left your django secret key in the default setup instructions, and yeah, google analytics.

terabyte128 commented 8 years ago

That's not the same secret key actually on the server, it's a different local_settings.py, lol

terabyte128 commented 8 years ago

@Precociuslydigital did you get the email I sent your regarding frc scout this year? (Sorry to hijack the issue)

PrecociouslyDigital commented 8 years ago

@terabyte128 I have not been checking my email recently. Sorry, away from project temporarily, school and stuff. I'll look at that email, and also, did you ever have problems with csrf tokens?

PrecociouslyDigital commented 8 years ago

@terabyte128 I also didn't see your email anywhere; where did you send that email?

PrecociouslyDigital commented 8 years ago

@terabyte128 nevermind on the csrf front, apparently one of your message cookies screwed up the http headers.So you couldn't log out then log right back in again

terabyte128 commented 8 years ago

Huh, I just tested logging out/immediately back in and didn't have any issues with CSRF verification. Not sure why the message cookies would be causing issues; they're built into Django so it seems like they would be designed to not conflict.

I sent the email to fellfromatree@gmail.com