sportdb 1.8.27 → 1.8.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. data/Manifest.txt +0 -21
  2. data/lib/sportdb/calc.rb +96 -26
  3. data/lib/sportdb/models/stats/alltime_standing.rb +5 -3
  4. data/lib/sportdb/schema.rb +2 -1
  5. data/lib/sportdb/service.rb +9 -21
  6. data/lib/sportdb/service/public/style.css +0 -17
  7. data/lib/sportdb/service/public/style.css.scss +1 -27
  8. data/lib/sportdb/service/server.rb +10 -6
  9. data/lib/sportdb/service/views/_version.erb +2 -3
  10. data/lib/sportdb/service/views/index.erb +1 -141
  11. data/lib/sportdb/service/views/layout.erb +1 -4
  12. data/lib/sportdb/version.rb +1 -1
  13. data/test/test_standings.rb +30 -1
  14. metadata +26 -47
  15. data/lib/sportdb/service/public/football/js/football/api.js +0 -63
  16. data/lib/sportdb/service/public/football/js/football/plugin.js +0 -36
  17. data/lib/sportdb/service/public/football/js/football/widget.js +0 -169
  18. data/lib/sportdb/service/public/football/js/libs/jquery-2.0.2.min.js +0 -6
  19. data/lib/sportdb/service/public/football/js/libs/require-2.1.6.js +0 -2045
  20. data/lib/sportdb/service/public/football/js/libs/underscore-1.4.4.min.js +0 -1
  21. data/lib/sportdb/service/public/football/js/text.js +0 -373
  22. data/lib/sportdb/service/public/football/js/utils.js +0 -80
  23. data/lib/sportdb/service/public/football/matchday-jquery.html +0 -57
  24. data/lib/sportdb/service/public/football/matchday-template.html +0 -106
  25. data/lib/sportdb/service/public/football/matchday.html +0 -76
  26. data/lib/sportdb/service/public/football/templates/event.html +0 -6
  27. data/lib/sportdb/service/public/football/templates/games.html +0 -29
  28. data/lib/sportdb/service/public/football/templates/rounds-long.html +0 -11
  29. data/lib/sportdb/service/public/football/templates/rounds-short.html +0 -16
  30. data/lib/sportdb/service/public/football/templates/rounds-today.html +0 -8
  31. data/lib/sportdb/service/version.rb +0 -6
  32. data/lib/sportdb/service/views/_football_head.erb +0 -21
  33. data/lib/sportdb/service/views/_football_live.erb +0 -32
  34. data/lib/sportdb/service/views/_football_today.erb +0 -20
  35. data/lib/sportdb/service/views/_usage.erb +0 -25
@@ -1,57 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset='UTF-8'>
5
- <title>Matchday Example / football.db JSON(P) API</title>
6
-
7
- <script src='js/libs/jquery-2.0.2.min.js'></script>
8
- <script src='js/libs/underscore-1.4.4.min.js'></script>
9
- <script src='js/libs/require-2.1.6.js'></script>
10
-
11
- <style>
12
-
13
- .football-widget a
14
- {
15
- color: black;
16
- text-decoration: none;
17
- }
18
-
19
- .football-widget {
20
- border: 1px solid green;
21
- padding: 4px;
22
- margin: 10px;
23
- }
24
-
25
- .football-widget .rounds {
26
- margin-bottom: 10px;
27
- }
28
-
29
- </style>
30
-
31
- <script>
32
- require.config( {
33
- baseUrl: 'js'
34
- });
35
-
36
- require( ['football/plugin'], function() {
37
-
38
- $(document).ready( function() {
39
-
40
- $( '#confed' ).football( { event: 'world.conf.2013' } );
41
-
42
- });
43
-
44
- }); // fn require
45
- </script>
46
-
47
-
48
- </head>
49
- <body>
50
-
51
-
52
- <h1>Matchday Example / football.db JSON(P) API</h1>
53
-
54
- <div id='confed'></div>
55
-
56
- </body>
57
- </html>
@@ -1,106 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset='UTF-8'>
5
- <title>Matchday Example / football.db JSON(P) API</title>
6
-
7
- <script src='js/libs/jquery-2.0.2.min.js'></script>
8
- <script src='js/libs/underscore-1.4.4.min.js'></script>
9
- <script src='js/libs/require-2.1.6.js'></script>
10
-
11
- <style>
12
-
13
- .football-widget a {
14
- color: black;
15
- text-decoration: none;
16
- display: inline-block;
17
- min-width: 24px;
18
- text-align: center;
19
- }
20
-
21
- .football-widget a:hover {
22
- background-color: lime;
23
- }
24
-
25
- .football-widget {
26
- border: 1px solid green;
27
- padding: 4px;
28
- margin: 12px;
29
- }
30
-
31
- .football-widget .rounds {
32
- margin-bottom: 10px;
33
- }
34
-
35
- .football-widget tr.game-day td {
36
- border-top: 1px solid black;
37
- border-bottom: 1px solid black;
38
- }
39
- .football-widget tr.game td:nth-child(1) {
40
- text-align: right;
41
- }
42
- </style>
43
-
44
- <script>
45
- require.config( {
46
- baseUrl: 'js'
47
- });
48
-
49
- require( ['football/widget'], function(Widget) {
50
-
51
- $(document).ready( function() {
52
-
53
- Widget.create( '#de',{ event: 'de.2012_13', tplId: '#deTpl'} );
54
-
55
- });
56
-
57
- }); // fn require
58
- </script>
59
-
60
- </head>
61
- <body>
62
-
63
- <script type='text/template' id='deTpl'>
64
- <table>
65
- <% var last_play_at = new Date( 1970, 1, 1 );
66
- _.each( games, function( game, index ) {
67
- var play_at = new Date( game.play_at );
68
- if( cmp_date( last_play_at, play_at ) !== 0 ) {
69
- last_play_at = play_at;
70
- %>
71
- <tr class='game-day'><td colspan='3'><%= fmt_date( play_at ) %></td></tr>
72
- <% } %>
73
- <tr class='game'>
74
- <td>
75
- <%= game.team1_title %> (<%= game.team1_code %>)
76
- </td>
77
-
78
- <td>
79
- <% if( game.score1 != null && game.score2 != null ) { %>
80
- <% if( game.score1ot != null && game.score2ot != null ) { %>
81
- <% if ( game.score1p != null && game.score2p != null ) { %>
82
- <%= game.score1p %> - <%= game.score2p %> iE /
83
- <% } %>
84
- <%= game.score1ot %> - <%= game.score2ot %> nV /
85
- <% } %>
86
- <%= game.score1 %> - <%= game.score2 %>
87
- <% } else { %>
88
- -
89
- <% } %>
90
- </td>
91
- <td>
92
- <%= game.team2_title %> (<%= game.team2_code %>)
93
- </td>
94
- </tr>
95
- <% }); %>
96
- </table>
97
- </script>
98
-
99
-
100
-
101
- <h1>Matchday Example / football.db JSON(P) API</h1>
102
-
103
- <div id='de'></div>
104
-
105
- </body>
106
- </html>
@@ -1,76 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset='UTF-8'>
5
- <title>Matchday Example / football.db JSON(P) API</title>
6
-
7
- <script src='js/libs/jquery-2.0.2.min.js'></script>
8
- <script src='js/libs/underscore-1.4.4.min.js'></script>
9
- <script src='js/libs/require-2.1.6.js'></script>
10
-
11
- <style>
12
-
13
- .football-widget a
14
- {
15
- color: black;
16
- text-decoration: none;
17
- }
18
-
19
- .football-widget {
20
- border: 1px solid green;
21
- padding: 4px;
22
- margin: 10px;
23
- }
24
-
25
- .football-widget .rounds {
26
- margin-bottom: 10px;
27
- }
28
-
29
- </style>
30
-
31
- <script>
32
- require.config( {
33
- baseUrl: 'js'
34
- });
35
-
36
- require( ['football/widget'], function(Widget) {
37
-
38
- $(document).ready( function() {
39
-
40
- Widget.create( '#euro', { event: 'euro.2012' } );
41
- Widget.create( '#at', { event: 'at.2013_14' } );
42
-
43
- // option 2) show today's round or the last or the next
44
- Widget.create( '#de', { event: 'de.2013_14', showRounds: false } );
45
-
46
- // option 3) widget with no event => show scheduled rounds for today (for all events)
47
- Widget.create( '#rounds' );
48
- });
49
-
50
- }); // fn require
51
- </script>
52
-
53
-
54
- </head>
55
- <body>
56
-
57
-
58
- <h1>Matchday Example / football.db JSON(P) API</h1>
59
-
60
- <div id='euro'></div>
61
-
62
- <!-- try another widget -->
63
-
64
- <div id='at'></div>
65
-
66
- <!-- try another widget -->
67
-
68
- <div id='de'></div>
69
-
70
- <!-- try another widget -->
71
-
72
- <p>Any rounds scheduled today?</p>
73
- <div id='rounds'></div>
74
-
75
- </body>
76
- </html>
@@ -1,6 +0,0 @@
1
-
2
- <h3>
3
- <%= event.title %>
4
- -
5
- <%= round.title %>
6
- </h3>
@@ -1,29 +0,0 @@
1
- <table>
2
- <% _.each( games, function( game, index ) { %>
3
- <tr>
4
- <td>
5
- <%= game.play_at %>
6
- </td>
7
- <td style='text-align: right;'>
8
- <%= game.team1_title %> (<%= game.team1_code %>)
9
- </td>
10
-
11
- <td>
12
- <% if( game.score1 != null && game.score2 != null ) { %>
13
- <% if( game.score1ot != null && game.score2ot != null ) { %>
14
- <% if ( game.score1p != null && game.score2p != null ) { %>
15
- <%= game.score1p %> - <%= game.score2p %> iE /
16
- <% } %>
17
- <%= game.score1ot %> - <%= game.score2ot %> nV /
18
- <% } %>
19
- <%= game.score1 %> - <%= game.score2 %>
20
- <% } else { %>
21
- -
22
- <% } %>
23
- </td>
24
- <td>
25
- <%= game.team2_title %> (<%= game.team2_code %>)
26
- </td>
27
- </tr>
28
- <% }); %>
29
- </table>
@@ -1,11 +0,0 @@
1
-
2
- <% _.each( rounds, function( round, index ) { %>
3
-
4
- <% if( index > 0 ) { %>
5
- |
6
- <% } %>
7
- <a href='#' data-round='<%= round.pos %>'>
8
- <%= round.title %>
9
- </a>
10
-
11
- <% }); %>
@@ -1,16 +0,0 @@
1
-
2
- <% _.each( rounds, function( round, index ) { %>
3
-
4
- <% if( rounds.length/2 === index ) { %>
5
- <br>
6
- <% } else {
7
- if( index > 0 ) {
8
- %>
9
- |
10
- <% }} %>
11
-
12
- <a href='#' data-round='<%= round.pos %>'>
13
- <%= round.pos %>
14
- </a>
15
-
16
- <% }); %>
@@ -1,8 +0,0 @@
1
-
2
- <ul>
3
- <% _.each( rounds, function( round ) { %>
4
- <li>
5
- <%= round.title %> - <%= round.event.title %>
6
- </li>
7
- <% }); %>
8
- </ul>
@@ -1,6 +0,0 @@
1
-
2
- module SportDb
3
- module Service
4
- VERSION='0.4.0' # todo: use same version for now as containing spordb gem? why? why not??
5
- end
6
- end
@@ -1,21 +0,0 @@
1
-
2
- <script src="<%= url('/football/js/libs/jquery-2.0.2.min.js') %>" ></script>
3
- <script src="<%= url('/football/js/libs/underscore-1.4.4.min.js') %>" ></script>
4
- <script src="<%= url('/football/js/libs/require-2.1.6.js') %>" ></script>
5
-
6
- <script>
7
- require.config( {
8
- baseUrl: "<%= url('/football/js') %>"
9
- });
10
-
11
- var api;
12
-
13
- require( ['football/api'], function(Api) {
14
-
15
- // todo/fix: strip trailing slash from baseUrl if present
16
- // - use path_prefix for now as work around
17
- // e.g. url('/') is http://footballdb.herokuapp.com/api/v1
18
- api = Api.create( { baseUrl: '<%= path_prefix %>' } );
19
-
20
- });
21
- </script>
@@ -1,32 +0,0 @@
1
-
2
-
3
- <h2>Live Usage Sample</h2>
4
-
5
- <!--
6
- 'en.2012_13',
7
- 'de.2012_13',
8
- 'euro.2012',
9
- 'world.2010',
10
- 'world.conf.2013'
11
- -->
12
-
13
- <div id='widget_en_2012_13'></div>
14
-
15
- <p></p>
16
- <p></p>
17
-
18
- <div id='widget_world_2010'></div>
19
-
20
- <p>
21
- (Source: <code><a href='https://github.com/geraldb/football.js'>football.js</a></code>)
22
- </p>
23
-
24
-
25
- <script>
26
- require( ['football/widget'], function(Widget) {
27
-
28
- Widget.create( '#widget_en_2012_13', { api: api, event: 'en.2012_13' } );
29
- Widget.create( '#widget_world_2010', { api: api, event: 'world.2010' } );
30
-
31
- });
32
- </script>
@@ -1,20 +0,0 @@
1
-
2
- <div style='float: right;'>
3
-
4
- <div id='widget_de_2013_14'></div>
5
-
6
- <p></p>
7
-
8
- <p>Any rounds scheduled today?</p>
9
-
10
- <div id='widget_rounds'></div>
11
- </div>
12
-
13
- <script>
14
- require( ['football/widget'], function(Widget) {
15
-
16
- Widget.create( '#widget_de_2013_14', { api: api, event: 'de.2013_14', showRounds: false } );
17
- Widget.create( '#widget_rounds', { api: api } );
18
-
19
- });
20
- </script>
@@ -1,25 +0,0 @@
1
-
2
- <h2 id="usage">Usage</h2>
3
-
4
- <p>In your hypertext (HTML) document using a plain vanilla cross-domain JavaScript
5
- request (using the JSONP technique):</p>
6
-
7
- <pre><code>&lt;script&gt;
8
- function handleGames( json ) {
9
- // Do something with the returned data
10
- }
11
- &lt;/script&gt;
12
-
13
- &lt;script src="<%= url( '/' ) %>event/en.2012_13/round/2?callback=handleGames"&gt;&lt;/script&gt;
14
- </code></pre>
15
-
16
- <p>Or using the jQuery library using the <a href="http://api.jquery.com/jQuery.getJSON"><code>getJSON</code> function</a>:</p>
17
-
18
- <pre><code>$.getJSON('<%= url( '/' ) %>event/en.2012_13/round/2?callback=?', function(json) {
19
- // Do something with the returned data
20
- });
21
- </code></pre>
22
-
23
- <p>Note: Add the <code>callback=?</code> query parameter to tell jQuery to use a cross-domain JSONP request.</p>
24
-
25
- <p>That’s it.</p>