Commit e376f134 authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_but: display results

parent 38df79e3
......@@ -17,7 +17,7 @@
<script id="result_template" type="text/x-handlebars-template">
<table>
<caption>Result ({{match_count}} matches)</caption>
<caption>Result (<a href="https://www.rugbyworldcup.com/2023/matches">{{match_count}} matches</a>)</caption>
<thead>
<tr>
<th>Score</th>
......@@ -45,8 +45,8 @@
{{/if}}
</li>{{/each}}</ul>
<button type="button" data-wc2018="renderExport">Share!</button>
<!--button type="button" data-wc2018="renderImport">Import</button-->
<!--button type="button" data-wc2018="renderResult">Result</button-->
<button type="button" data-wc2018="renderImport">Import</button>
<button type="button" data-wc2018="renderResult">Result</button>
</script>
<script id="share_template" type="text/x-handlebars-template">
......@@ -60,7 +60,7 @@
<textarea required name="password_text"
id="password_text">{{password_text}}</textarea>
<input type="submit" value="Import"></input>
</form> nutnut
</form>
<form data-wc2018="submitNewCode">
<label for="player">Player</label>
<input required name="player" id="player"></input>
......
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1010.58506.47731.21435</string> </value>
<value> <string>1011.3955.57992.12117</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>1693772860.24</float>
<float>1694433862.91</float>
<string>UTC</string>
</tuple>
</state>
......
/*globals window, document, RSVP, rJS, jIO, Handlebars, LZString*/
/*jslint indent: 2, maxlen: 80*/
/*jslint nomen: true*/
/*globals window, document, RSVP, rJS, jIO, Handlebars, LZString, console*/
/*jslint indent: 2, maxlen: 100, nomen: true*/
(function (window, document, RSVP, rJS, jIO, Handlebars, LZString) {
"use strict";
......@@ -57,6 +56,7 @@
if (tmp.eventPhaseId.type !== 'Pool') {
continue;
}
result_list.push({
id: 'match_' + (i + 1),
value: {},
......@@ -240,9 +240,10 @@
},
remote_sub_storage: {
type: 'world_cup_data',
document_id: './world_cup_2018_data.json',
document_idXX: './world_cup_2018_data.json',
document_idXXX: 'https://raw.githubusercontent.com/lsv/' +
'fifa-worldcup-2018/master/data.json',
document_id: 'https://corsproxy.io/?https%3A%2F%2Fapi.wr-rims-prod.pulselive.com%2Frugby%2Fv3%2Fevent%2F1893%2Fschedule%3Flanguage%3Den',
attachment_id: 'enclosure',
sub_storage: {
type: 'http'
......@@ -480,8 +481,7 @@
score,
home_result,
away_result,
home_bet,
away_bet,
bet,
key_count = 0,
decoded;
for (key in code_dict) {
......@@ -502,6 +502,8 @@
return gadget.renderImport();
}
console.log('code_dict', code_dict);
// Check match result
for (i = 0; i < match_list.length; i += 1) {
home_result = match_list[i].value.home_result;
......@@ -509,6 +511,17 @@
for (key in code_dict) {
if (code_dict.hasOwnProperty(key)) {
// console.log(match_list[i]);
bet = code_dict[key].result_list[i];
if (
// draw
((bet === 0) && (home_result === away_result)) ||
((bet === 1) && (home_result > away_result)) ||
((bet === 2) && (home_result < away_result))
) {
code_dict[key].score += 1;
}
/*
home_bet = code_dict[key].result_list[2 * (parseInt(match_list[i].id.slice(6), 10) - 1)];
away_bet = code_dict[key].result_list[2 * (parseInt(match_list[i].id.slice(6), 10) - 1) + 1];
if ((home_result === home_bet) &&
......@@ -531,7 +544,7 @@
score = 1;
}
code_dict[key].score += score;
code_dict[key].score += score;*/
/*
if (i === 0) {
player_list.push({
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1010.58492.51761.29798</string> </value>
<value> <string>1011.3975.53334.5341</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -256,7 +256,7 @@
</tuple>
<state>
<tuple>
<float>1693771993.21</float>
<float>1694433153.59</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -205,7 +205,7 @@
</item>
<item>
<key> <string>configuration_content_security_policy</string> </key>
<value> <string>default-src \'none\'; img-src \'self\'; media-src \'self\'; connect-src \'self\' raw.githubusercontent.com; script-src \'self\' \'unsafe-eval\'; style-src \'self\';</string> </value>
<value> <string>default-src \'none\'; img-src \'self\'; media-src \'self\'; connect-src \'self\' corsproxy.io raw.githubusercontent.com; script-src \'self\' \'unsafe-eval\'; style-src \'self\';</string> </value>
</item>
<item>
<key> <string>configuration_x_frame_options</string> </key>
......@@ -428,7 +428,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>1010.49822.40856.18739</string> </value>
<value> <string>1011.3951.5357.1211</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -448,7 +448,7 @@
</tuple>
<state>
<tuple>
<float>1693252020.78</float>
<float>1694433215.39</float>
<string>UTC</string>
</tuple>
</state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment