wololodev / d2mt

Competitive coverage on the go!
37 stars 11 forks source link

Added DD2 match API to replace GG #23

Closed gkrambs closed 9 years ago

gkrambs commented 9 years ago

Added DD2 match API to replace GG since it doesnt work anymore. The GG code is still available but commented out.

wololodev commented 9 years ago

will take a look at this tonight and hopefully pull and push to chrome's app store

MasterOdin commented 9 years ago

Before we merge, might want to make another commit to cleanup the weird whitespacing in the file and make it more consistent (as you have tab tabs and spaces tabs, braces at wrong level of indentation, and replace your padding lines with str_pad PHP function.

And I don't know about @wololodev, but I rather hate inline if blocks if it's one line and not use braces (see line 31) as all it does is reduce readability and add an increase of coding error for no real gain.

Before we push to the web store, might want to make a better method for flags inside d2mt (add img/stylesheet for it) instead of just keep leaching off jD.

wololodev commented 9 years ago

Inline blocks comes from my javascript nature. I know it's usually a good standard in PHP to write with new line blocks.

Again, it's up to you guys in terms of what to update in the webstore. AFAIK @MasterOdin you have permission to push and edit to the webstore, so I probably don't need to get involved. I don't even mind if the credits are switched to your name because I'm basically really out of time for this.

Just make sure it's going to be working by TI5 :)

MasterOdin commented 9 years ago

Yeah, with the semester finally over and free time something that's available, I'll deal with updating the app and pushing it live after I do the flag css and just add myself to Author and add grex to the thanks line.

In most languages, it's good habit (in my opinion) to do:

if (conditional) {
    // code here
}

instead of if (conditional) // code here

or

if (conditional)
    // code here

from a sheer "I don't want to potentially introduce bugs point of view" (especially with the final example as with my constant python usage I might just forget PHP is not whitespace dependent.

gkrambs commented 9 years ago

Hey, thanks for the replies. I just updated to a better styling. Dunno about the weird whitespace differences as they weren't displayed in Sublime, but nevertheless, they're fixed now.

My inline-if-condition-habit clearly comes from growing up with Perl, I should learn to avoid it in collaborative code :)

I've tested my new index.php to create some output for the api.json file, but I couldn't test if all is working as intended in the extension. And should I add a cronjob for the new index.php by myself or will you guys do that?

MasterOdin commented 9 years ago

@gkrambs Looks like it works well (I might make a small change in the nice_time function for games over 24hours. Don't worry about the cron job. Thanks for the help and please let us know when the recent results becomes available to the API :smile:

@trevorstarick can you add a cron job to run the dd2 API at the same rate as the other ones?