add eraser button and add start calculation logic
This commit is contained in:
@@ -13,19 +13,23 @@ const gameName = url.split('/');
|
||||
const gameType = gameName[3].split('?id=');
|
||||
let gameVersion;
|
||||
|
||||
console.log("Here is game name ", gameName)
|
||||
|
||||
if(gameType[0] == "guided-tracing"){
|
||||
gameVersion = gameType[0].split('?')[0];
|
||||
gameId = gameName[4];
|
||||
console.log('Type - 1');
|
||||
} else if(gameName.length == 5){
|
||||
gameVersion = gameName[3];
|
||||
gameId = urlParams.get('id');
|
||||
console.log('Type - 2');
|
||||
}else if(gameName.length == 6){
|
||||
gameVersion = gameType[0] + '-' + gameName[4];
|
||||
gameId = urlParams.get('id');
|
||||
console.log('Type - 3');
|
||||
}
|
||||
|
||||
|
||||
// console.log(gameType[0])
|
||||
|
||||
function submitUserData(drawingZone) {
|
||||
const endTime = Date.now();
|
||||
@@ -74,8 +78,14 @@ function submitUserData(drawingZone) {
|
||||
document.body.removeChild(image);
|
||||
imageCode = image.src;
|
||||
}
|
||||
|
||||
|
||||
let starValue;
|
||||
if(scoreTotal === maxScore){
|
||||
starValue = 5;
|
||||
} else if(scoreTotal === maxScore - 1){
|
||||
starValue = 4;
|
||||
} else{
|
||||
starValue = 3;
|
||||
}
|
||||
|
||||
let userData = {
|
||||
'gameName': gameVersion,
|
||||
@@ -83,7 +93,8 @@ function submitUserData(drawingZone) {
|
||||
'screenShot': imageCode,
|
||||
'userId' : userId,
|
||||
'gameTime' : timeDifferenceInSeconds,
|
||||
'score' : scoreTotal
|
||||
'score' : scoreTotal,
|
||||
'star' : starValue
|
||||
// 'starts': formattedDateTime,
|
||||
// 'game_start' : gameStartTime,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user