diff --git a/assets/www/assign_drink.html b/assets/www/assign_drink.html
index 091b3d6..391dbbd 100644
--- a/assets/www/assign_drink.html
+++ b/assets/www/assign_drink.html
@@ -27,7 +27,7 @@
Assign Drink
diff --git a/assets/www/crayplay.js b/assets/www/crayplay.js
index 1794a79..1275fc4 100644
--- a/assets/www/crayplay.js
+++ b/assets/www/crayplay.js
@@ -23,6 +23,9 @@ var currentRound = 1;
var currentReader = 0;
var currentReaderName = "";
+var currentWinner = 0;
+var currentWinnerName = "";
+
var nextReader = 0;
var nextReaderName = "";
@@ -32,15 +35,16 @@ var currentPlayerName = "";
var nextPlayer = 0;
var nextPlayerName = "";
-var currentStage = 5;
-var maxRounds = 2;
+var currentStage = 0;
+var maxRounds = 7;
var listCreated = true;
var numPlayers = 3;
-
var currentAllPlayers = new PlayerCollection();
var currentRoundPlayers = new RoundPlayerCollection();
var myWords = new WordCollection();
var myDefinitions = new DefinitionCollection();
+var thePlayerAnswers = new PlayerAnswerCollection();
+var ids = [];
function init(){
document.addEventListener("deviceready", startup);
@@ -63,6 +67,28 @@ function onStartClick(){
$.mobile.changePage("add_players.html", {transition: "none"} );
}
+function onRankAnswersSubmit(){
+ var answers = $(".sub_answers");
+ ids = [];
+
+ for(var x=0; x
");
- $("#currentvariables").append("");
//$("#currentvariables").append("
");
$("#currentvariables").append("");
@@ -381,33 +405,45 @@ function appendCurrentVariables(){
$("#currentvariables").append("");
$("#currentvariables").append("");
//$("#currentvariables").append("");
- $("#content").trigger("create");
- $("#currentvariables").listview("refresh");
- break;
+ break;
case 2:
$("#currentvariables").append("");
$("#currentvariables").append("");
$("#currentvariables").append("\"" + currentQText + "\"");
- $("#content").trigger("create");
- $("#currentvariables").listview("refresh");
break;
case 3:
$("#currentvariables").append("");
$("#currentvariables").append("");
$("#currentvariables").append("\"" + currentQText + "\"");
- $("#content").trigger("create");
- $("#currentvariables").listview("refresh");
- break;
+ break;
case 5:
$("#currentvariables").append("");
- break;
+ break;
+ case 6:
+ $("#currentvariables").append("");
+ $("#currentvariables").append("");
+ $("#currentvariables").append("\"" + currentQText + "\"");
+ break;
+ case 7:
+ $("#currentvariables").append("");
+ $("#currentvariables").append("");
+ $("#currentvariables").append("\"" + currentQText + "\"");
+ break;
+ case 8:
+ $("#currentvariables").append("");
+ $("#currentvariables").append("");
+ $("#currentvariables").append("\"" + currentQText + "\"");
+ break;
+ case 9:
+ $("#currentvariables").append("");
+ $("#currentvariables").append("");
+ $("#currentvariables").append("\"" + currentQText + "\"");
+ break;
default:
//$("#currentvariables").append("");
$("#currentvariables").append("");
break;
}
- $("#currentvariables").append(" ");
- $("#content").trigger("create");
$("#currentvariables").listview("refresh");
//BODY
@@ -420,9 +456,9 @@ function appendCurrentVariables(){
$("#currentvariables").append("");
$("#currentvariables").append("");
$("#currentvariables").append("");
- $("#currentvariables").append("");
- $("#content").trigger("create");
$("#currentvariables").listview("refresh");
+ $("#content").append("");
+ $("#content").trigger("create");
break;
case 2:
$("#currentvariables").append("");
@@ -437,10 +473,10 @@ function appendCurrentVariables(){
$("#currentvariables").append("
");
$("#currentvariables").append("");
$("#currentvariables").append("");
-
- $("#currentvariables").append("");
- $("#content").trigger("create");
$("#currentvariables").listview("refresh");
+ $("#content").append("");
+ $("#content").trigger("create");
+
break;
case 3:
$("#currentvariables").append("");
@@ -450,9 +486,10 @@ function appendCurrentVariables(){
$("#currentvariables").append("");
$("#currentvariables").append("");
$("#currentvariables").append("");
- $("#currentvariables").append("");
- $("#content").trigger("create");
$("#currentvariables").listview("refresh");
+ $("#content").append("");
+ $("#content").trigger("create");
+
break;
case 4:
$("#currentvariables").append("");
@@ -463,50 +500,81 @@ function appendCurrentVariables(){
$("#currentvariables").append("");
$("#currentvariables").append("");
$("#currentvariables").append("");
- $("#currentvariables").append("");
- $("#content").trigger("create");
$("#currentvariables").listview("refresh");
+ $("#content").append("");
+ $("#content").trigger("create");
break;
case 5:
$("#currentvariables").append("");
- $("#currentvariables").append("");
- $("#currentvariables").append("
");
- $("#currentvariables").append("");
- $("#currentvariables").append("");
- $("#content").trigger("create");
+ $("#currentvariables").append("");
$("#currentvariables").listview("refresh");
+ $("#sortable").append("Answers");
+ thePlayerAnswers.forEach(
+ function(d_id, w_id, p_id, r_id, d_v_count, d_rank)
+ {
+ if(r_id == currentRound)
+ {
+ $("#sortable").append(""+myDefinitions.item(d_id).def_text+"");
+ }
+ });
+ $("#sortable").listview("refresh");
+ $("#content").append("");
+ $("#content").trigger("create");
break;
- default:
+ case 6:
+ $("#currentvariables").append("");
+ $("#currentvariables").append("");
+ $("#currentvariables").append("Answers");
+ for (var i = 0; i < ids.length; i++)
+ {
+ //alert(ids[i]);
+ $("#currentvariables").append(""+ myDefinitions.item(parseInt(ids[i])).def_text + "");
+ }
+ $("#currentvariables").append("");
+ $("#currentvariables").listview("refresh");
+ $("#content").append("");
+ $("#content").trigger("create");
+ break;
+ case 7:
$("#currentvariables").append("");
+ $("#currentvariables").append("");
+ $("#currentvariables").listview("refresh");
+ $("#content").append("");
$("#content").trigger("create");
+ break;
+ case 8:
+ $("#currentvariables").append("");
+ $("#currentvariables").append(""+currentWinnerName+"");
+ $("#currentvariables").append("");
$("#currentvariables").listview("refresh");
-
- $("#currentvariables").append("");
+ $("#content").append("");
$("#content").trigger("create");
+ break;
+ case 9:
+ $("#currentvariables").append("");
+ $("#currentvariables").append("Choose which player takes a drink");
+ $("#currentvariables").append("");
+ currentAllPlayers.forEach(
+ function(p_id, p_name)
+ {
+ if(p_id != currentWinner)
+ {
+ $("#currentvariables").append("");
+ }
+ });
+ $("#currentvariables").append("
");
+ $("#currentvariables").append("");
$("#currentvariables").listview("refresh");
+ $("#content").append("");
+ $("#content").trigger("create");
+ break;
+ default:
break;
}
}
diff --git a/assets/www/crayplaydb.js b/assets/www/crayplaydb.js
index df57dfc..c238746 100644
--- a/assets/www/crayplaydb.js
+++ b/assets/www/crayplaydb.js
@@ -14,7 +14,7 @@ function populateDB(tx){
tx.executeSql('CREATE TABLE IF NOT EXISTS PLAYERS (p_id INTEGER PRIMARY KEY AUTOINCREMENT, p_name TEXT)');
tx.executeSql('CREATE TABLE IF NOT EXISTS GAMELOG (g_id INTEGER PRIMARY KEY AUTOINCREMENT, p_winner INTEGER, played_date DATE)');
tx.executeSql('CREATE TABLE IF NOT EXISTS GAMETRANLOG (gt_id INTEGER PRIMARY KEY AUTOINCREMENT, g_id INTEGER, p_id INTEGER, def_id INTEGER, def_used_ind INTEGER)');
- tx.executeSql('CREATE TABLE IF NOT EXISTS PLAYERANSWERS (pa_id INTEGER PRIMARY KEY AUTOINCREMENT, g_id INTEGER, p_id INTEGER, word_id, round_id INTEGER, def_id INTEGER, a_vote_count INTEGER, a_rank INTEGER)');
+ tx.executeSql('CREATE TABLE IF NOT EXISTS PLAYERANSWERS (pa_id INTEGER PRIMARY KEY AUTOINCREMENT, g_id INTEGER, p_id INTEGER, word_id INTEGER, round_id INTEGER, def_id INTEGER, a_vote_count INTEGER, a_rank INTEGER)');
tx.executeSql('CREATE TABLE IF NOT EXISTS DEFINITIONS (def_id INTEGER KEY UNIQUE, def_type INTEGER, def_text TEXT)');
tx.executeSql('CREATE TABLE IF NOT EXISTS SETUPPARAMS (setup_id INTEGER KEY UNIQUE, setup_text TEXT, setup_value TEXT)');
@@ -61,16 +61,6 @@ function populateDB(tx){
tx.executeSql('INSERT INTO DEFINITIONS (def_id, def_type, def_text) VALUES (18, 1, "Definition 18")');
tx.executeSql('INSERT INTO DEFINITIONS (def_id, def_type, def_text) VALUES (19, 1, "Definition 19")');
tx.executeSql('INSERT INTO DEFINITIONS (def_id, def_type, def_text) VALUES (20, 1, "Definition 20")');
- /*tx.executeSql('INSERT INTO DEFINITIONS (def_id, def_type, def_text) VALUES (21, 1, "Definition 21")');
- tx.executeSql('INSERT INTO DEFINITIONS (def_id, def_type, def_text) VALUES (22, 1, "Definition 22")');
- tx.executeSql('INSERT INTO DEFINITIONS (def_id, def_type, def_text) VALUES (23, 1, "Definition 23")');
- tx.executeSql('INSERT INTO DEFINITIONS (def_id, def_type, def_text) VALUES (24, 1, "Definition 24")');
- tx.executeSql('INSERT INTO DEFINITIONS (def_id, def_type, def_text) VALUES (25, 1, "Definition 25")');
- tx.executeSql('INSERT INTO DEFINITIONS (def_id, def_type, def_text) VALUES (26, 1, "Definition 26")');
- tx.executeSql('INSERT INTO DEFINITIONS (def_id, def_type, def_text) VALUES (27, 1, "Definition 27")');
- tx.executeSql('INSERT INTO DEFINITIONS (def_id, def_type, def_text) VALUES (28, 1, "Definition 28")');
- tx.executeSql('INSERT INTO DEFINITIONS (def_id, def_type, def_text) VALUES (29, 1, "Definition 29")');
- tx.executeSql('INSERT INTO DEFINITIONS (def_id, def_type, def_text) VALUES (30, 1, "Definition 30")'); */
//CREATE SETUP PARAMETERS
tx.executeSql('INSERT INTO SETUPPARAMS (setup_id, setup_text, setup_value) VALUES (1, "handsize", "5")');
@@ -204,9 +194,11 @@ function addPlayerAnswerDB(errorCallBack, successCallBack){
}
function addPlayerAnswerDBCall(tx){
var setPlayerName="";
- //alert(numPlayers);
- var a_def_id = $("input:radio:checked").val();
+ var a_def_id = $('input[name="definition"]:checked').val();//$("input:radio:checked").val();
+ //alert(a_def_id);
+ //alert(currentPlayer);
tx.executeSql('INSERT INTO PLAYERANSWERS(g_id,p_id,word_id,def_id,a_vote_count,a_rank) VALUES (?,?,?,?,?,?)', [currentGameID, currentPlayer, currentQID, a_def_id, 0,0], successCB, errorCB);
+ thePlayerAnswers.add(a_def_id, currentQID, currentPlayer, currentRound, currentGameID, 0, 0);
}
function addPlayerAnswerDBSuccess(){
//alert('inside add player answer success db');
@@ -220,9 +212,7 @@ function getPlayerAnswerDBCall(tx){
tx.executeSql('SELECT def_id, p_id from PLAYERANSWERS WHERE g_id = ? and word_id = ? and p_id = ?', [currentPlayer, currentQID, currentGameID], getDBPlayerAnswerDBSuccess, errorCB);
}
function getDBPlayerAnswerDBSuccess(tx, results) {
- //alert("inside queryDBPlayersDBSuccess");
for(var i=0; i
CrayPlay
+
+
+
diff --git a/assets/www/rank_answers.html b/assets/www/rank_answers.html
index 8d94329..30f764c 100644
--- a/assets/www/rank_answers.html
+++ b/assets/www/rank_answers.html
@@ -4,44 +4,79 @@
Rank Answers
+
+
-
-
-
-
Back
@@ -50,15 +85,9 @@
Rank Answers
Rank Answers
-
- - List
- - Item 1
- - Item 2
- - Item 3
- - Item 4
- - Item 5
-
-
+
+
+
diff --git a/assets/www/read_answers.html b/assets/www/read_answers.html
index 3d6a712..093532e 100644
--- a/assets/www/read_answers.html
+++ b/assets/www/read_answers.html
@@ -27,7 +27,7 @@
Read Answers
diff --git a/assets/www/read_new_word.html b/assets/www/read_new_word.html
index 547c580..8de7086 100644
--- a/assets/www/read_new_word.html
+++ b/assets/www/read_new_word.html
@@ -27,7 +27,7 @@
Read New Word
diff --git a/assets/www/read_real_def.html b/assets/www/read_real_def.html
index 7e5bc1f..72f9dbd 100644
--- a/assets/www/read_real_def.html
+++ b/assets/www/read_real_def.html
@@ -27,7 +27,7 @@
Read Real Definition
diff --git a/assets/www/read_winner.html b/assets/www/read_winner.html
index 699156e..c4eeed7 100644
--- a/assets/www/read_winner.html
+++ b/assets/www/read_winner.html
@@ -27,7 +27,7 @@
Read Winner
diff --git a/assets/www/select_definition.html b/assets/www/select_definition.html
index 0ff120d..d632485 100644
--- a/assets/www/select_definition.html
+++ b/assets/www/select_definition.html
@@ -27,6 +27,7 @@
Select Definition
diff --git a/assets/www/verify_def.html b/assets/www/verify_def.html
index 283eced..701db6d 100644
--- a/assets/www/verify_def.html
+++ b/assets/www/verify_def.html
@@ -8,7 +8,7 @@
-
+
@@ -27,6 +27,7 @@
Verify Definition
diff --git a/assets/www/verify_def_last_player.html b/assets/www/verify_def_last_player.html
index 2c92e3e..65449e9 100644
--- a/assets/www/verify_def_last_player.html
+++ b/assets/www/verify_def_last_player.html
@@ -8,7 +8,7 @@
-
+
@@ -27,6 +27,7 @@
Verify Definition Last Player
Verify Definition Last Player
+