http://footballdb.herokuapp.com/api/v1/event/world.2014/round/1

288 views
Skip to first unread message

Brice Vançon

unread,
May 30, 2014, 3:55:50 AM5/30/14
to open...@googlegroups.com
Hi,
I'm trying to know what is the "score1ot" or "score1p" filed ?
How do I know which team wons, in egality case ?
Thanks

Gerald Bauer

unread,
May 30, 2014, 4:41:54 AM5/30/14
to open...@googlegroups.com
Hello,


  > I'm trying to know what is the "score1ot" or "score1p" filed ?

   - score1ot/score1et  => is the score for team 1 after overtime (ot) / after extra time (et)
   - score1p   => is the penalty (p) shootout score for team 1   

   and

   - score2ot and score2p is the same for team 2.

   Cheers.

Brice Vançon

unread,
Jun 2, 2014, 3:24:08 AM6/2/14
to open...@googlegroups.com
Thanks for reply, I don't see field "score1et".
So for the finale, for example, if score1=1 and score2=1, it's the score1ot which is important.
And if the score1ot and score2ot are against the same, it's the score1p which is important ?
Thank you for your API, it's so nice, I hope you can update resultats each day, it would be so great.

Gerald Bauer

unread,
Jun 2, 2014, 3:47:23 AM6/2/14
to open...@googlegroups.com
Hello,

To calculate the winner as an example see the calc_winner "formula"
in the Game (soon Match) model source [1]:

def calc_winner
if score1.nil? || score2.nil?
self.winner90 = nil
self.winner = nil
else
if score1 > score2
self.winner90 = 1
elsif score1 < score2
self.winner90 = 2
else # assume score1 == score2 - draw
self.winner90 = 0
end

## todo/fix:
# check for next-game/pre-game !!!
# use 1st leg and 2nd leg - use for winner too
# or add new winner_total or winner_aggregated method ???

## check for penalty - note: some games might only have penalty
and no extra time (e.g. copa liberatadores)
if score1p.present? && score2p.present?
if score1p > score2p
self.winner = 1
elsif score1p < score2p
self.winner = 2
else
# issue warning! - should not happen; penalty goes on until
winner found!
puts "*** warn: should not happen; penalty goes on until winner found"
end
## check for extra time
elsif score1et.present? && score2et.present?
if score1et > score2et
self.winner = 1
elsif score1et < score2et
self.winner = 2
else # assume score1et == score2et - draw
self.winner = 0
end
else
# assume no penalty and no extra time; same as 90min result
self.winner = self.winner90
end
end
end

Looks more complicated than it is:
1) check 90 minute score
2) if equal check extra time score (if present otherwise draw/tie)
3) if equal check penalty shootout score (if present otherwise draw/tie)

Cheers.

[1] github.com/geraldb/sport.db.ruby/blob/master/lib/sportdb/models/game.rb
> --
> You received this message because you are subscribed to the Google Groups
> "Open Sport(s) Database - football.db, formula1.db, ski.db, and Friends"
> group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to opensport+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Brice Vançon

unread,
Jun 2, 2014, 4:17:21 AM6/2/14
to open...@googlegroups.com
Thank for reply,
I understand that :



  Looks more complicated than it is:
1) check 90 minute score => score1 and score2
2) if equal check extra time score  (if present otherwise draw/tie)  => score1ot and score2ot
3) if equal check penalty shootout score (if present otherwise draw/tie)  => score1p and score2p


When you say "extra time", you say "over time" ? It's thame things ?
Because there is no score1et but "ot" :

...
"score1"
:null,
"score2"
:null,
"score1ot"
:null,
"score2ot"
:null,
"score1p"
:null,
"score2p":null
...

Gerald Bauer

unread,
Jun 2, 2014, 4:38:09 AM6/2/14
to open...@googlegroups.com
Hello,
Sorry for the confusion. Yes, "extra time" is the same thing as
"over time" (in the db its called score1et, thus, score1et/ot).
Cheers.

Brice Vançon

unread,
Jun 2, 2014, 4:46:21 AM6/2/14
to open...@googlegroups.com
Ok thank you so much !
My apps is ready, now I depend upon you to work great.




Le vendredi 30 mai 2014 09:55:50 UTC+2, Brice Vançon a écrit :

Brice Vançon

unread,
Jun 3, 2014, 10:39:10 AM6/3/14
to open...@googlegroups.com
Another question ?
Is there a limit of call the API ?
Can I make a request every hour ?


Le vendredi 30 mai 2014 09:55:50 UTC+2, Brice Vançon a écrit :

Gerald Bauer

unread,
Jun 3, 2014, 12:30:53 PM6/3/14
to open...@googlegroups.com
Hello,
There is no limit calling the API. Note, the webapp runs on the
Heroku free plan. If it will run out of dyna hours (I assume it will
stop working until next month).

Note, the API is just a demo you're invited to host / run your own
service. See the sport.db.api.starter[1] to get started. Cheers

[1] github.com/geraldb/sport.db.api.starter
Reply all
Reply to author
Forward
0 new messages