Commit 81c4bec83aae37fad510502716b19779ab97a026
1 parent
8103f1bb
Exists in
master
and in
1 other branch
Adicionado novos parâmetros na requisição finish_task.
Showing
2 changed files
with
24 additions
and
21 deletions
Show diff stats
view/assets/js/tmpJSONParser.js
@@ -3,15 +3,8 @@ | @@ -3,15 +3,8 @@ | ||
3 | var base_parameter_json = {}; | 3 | var base_parameter_json = {}; |
4 | var movement_parameter_json = {}; | 4 | var movement_parameter_json = {}; |
5 | 5 | ||
6 | - function _getLoggedUser() { | ||
7 | - var pybossa_rembember_token = Cookies.get('remember_token'); | ||
8 | - var splitted_token_id = pybossa_rembember_token.split('|'); | ||
9 | - return splitted_token_id.length > 0 ? splitted_token_id[0] | ||
10 | - : 'anonymous'; | ||
11 | - } | ||
12 | - | ||
13 | function _setupBaseParameterJSON(tmpJSON) { | 6 | function _setupBaseParameterJSON(tmpJSON) { |
14 | - base_parameter_json['userId'] = _getLoggedUser(); | 7 | + base_parameter_json['userId'] = tmpJSON['userId']; |
15 | base_parameter_json['sinal'] = tmpJSON['sinal']; | 8 | base_parameter_json['sinal'] = tmpJSON['sinal']; |
16 | base_parameter_json['interpolacao'] = 'normal'; | 9 | base_parameter_json['interpolacao'] = 'normal'; |
17 | base_parameter_json['movimentos'] = []; | 10 | base_parameter_json['movimentos'] = []; |
view/assets/js/wikilibras.js
@@ -12,6 +12,7 @@ | @@ -12,6 +12,7 @@ | ||
12 | function _setupTmpParameterJSON(sign_name) { | 12 | function _setupTmpParameterJSON(sign_name) { |
13 | tmpParameterJSON = { | 13 | tmpParameterJSON = { |
14 | 'sinal' : sign_name, | 14 | 'sinal' : sign_name, |
15 | + 'userId' : _getLoggedUser(), | ||
15 | 'facial' : {}, | 16 | 'facial' : {}, |
16 | 'right-hand' : {}, | 17 | 'right-hand' : {}, |
17 | 'left-hand' : {} | 18 | 'left-hand' : {} |
@@ -19,6 +20,13 @@ | @@ -19,6 +20,13 @@ | ||
19 | parsedParameterJSON = {}; | 20 | parsedParameterJSON = {}; |
20 | } | 21 | } |
21 | 22 | ||
23 | + function _getLoggedUser() { | ||
24 | + var pybossa_rembember_token = Cookies.get('remember_token'); | ||
25 | + var splitted_token_id = pybossa_rembember_token.split('|'); | ||
26 | + return splitted_token_id.length > 0 ? splitted_token_id[0] | ||
27 | + : 'anonymous'; | ||
28 | + } | ||
29 | + | ||
22 | function _loadTaskInfo(task) { | 30 | function _loadTaskInfo(task) { |
23 | current_task_id = task.id; | 31 | current_task_id = task.id; |
24 | var sign_name = task.info.sign_name; | 32 | var sign_name = task.info.sign_name; |
@@ -329,12 +337,12 @@ | @@ -329,12 +337,12 @@ | ||
329 | $("#finish-button").show(); | 337 | $("#finish-button").show(); |
330 | 338 | ||
331 | _submitParameterJSON(function() { | 339 | _submitParameterJSON(function() { |
332 | - $("#render-loading").fadeOut(300); | ||
333 | - $("#render-ref video").prop("controls", true); | ||
334 | - $("#render-ref video").get(0).play(); | ||
335 | - $("#finish-button").removeClass("disabled"); | ||
336 | - _showRenderedAvatar(parsedParameterJSON); | ||
337 | - }); | 340 | + $("#render-loading").fadeOut(300); |
341 | + $("#render-ref video").prop("controls", true); | ||
342 | + $("#render-ref video").get(0).play(); | ||
343 | + $("#finish-button").removeClass("disabled"); | ||
344 | + _showRenderedAvatar(parsedParameterJSON); | ||
345 | + }); | ||
338 | } | 346 | } |
339 | 347 | ||
340 | function _setupApprovalScreen(parameterJSON) { | 348 | function _setupApprovalScreen(parameterJSON) { |
@@ -417,7 +425,7 @@ | @@ -417,7 +425,7 @@ | ||
417 | answer["status"] = status; | 425 | answer["status"] = status; |
418 | var last_answer = task.info.last_answer; | 426 | var last_answer = task.info.last_answer; |
419 | var hasLastAnswer = typeof last_answer != "undefined"; | 427 | var hasLastAnswer = typeof last_answer != "undefined"; |
420 | - | 428 | + |
421 | if (hasLastAnswer && status == "APPROVED") { | 429 | if (hasLastAnswer && status == "APPROVED") { |
422 | answer["number_of_approval"] = last_answer.number_of_approval + 1; | 430 | answer["number_of_approval"] = last_answer.number_of_approval + 1; |
423 | answer["parameter_json"] = last_answer.parameter_json; | 431 | answer["parameter_json"] = last_answer.parameter_json; |
@@ -435,6 +443,8 @@ | @@ -435,6 +443,8 @@ | ||
435 | data : { | 443 | data : { |
436 | "task_id" : task.id, | 444 | "task_id" : task.id, |
437 | "project_id" : task.project_id, | 445 | "project_id" : task.project_id, |
446 | + "user_id" : _getLoggedUser(), | ||
447 | + "sign_name" : task.info.sign_name, | ||
438 | "number_of_approval" : answer.number_of_approval, | 448 | "number_of_approval" : answer.number_of_approval, |
439 | }, | 449 | }, |
440 | success : function(response) { | 450 | success : function(response) { |
@@ -462,14 +472,14 @@ | @@ -462,14 +472,14 @@ | ||
462 | // It removes the PyBossa default message | 472 | // It removes the PyBossa default message |
463 | $(".row .col-md-12 p").remove(); | 473 | $(".row .col-md-12 p").remove(); |
464 | } | 474 | } |
465 | - | 475 | + |
466 | function _loadMainComponents() { | 476 | function _loadMainComponents() { |
467 | dynengine.load(); | 477 | dynengine.load(); |
468 | dynworkflow.load(); | 478 | dynworkflow.load(); |
469 | submitSign.setup(upload_signs_url); | 479 | submitSign.setup(upload_signs_url); |
470 | teachedSigns.setup(); | 480 | teachedSigns.setup(); |
471 | } | 481 | } |
472 | - | 482 | + |
473 | pybossa.presentTask(function(task, deferred) { | 483 | pybossa.presentTask(function(task, deferred) { |
474 | _loadMainComponents(); | 484 | _loadMainComponents(); |
475 | if (!$.isEmptyObject(task) && current_task_id != task.id) { | 485 | if (!$.isEmptyObject(task) && current_task_id != task.id) { |
@@ -488,8 +498,8 @@ | @@ -488,8 +498,8 @@ | ||
488 | } | 498 | } |
489 | 499 | ||
490 | // Public methods | 500 | // Public methods |
491 | - wikilibras.run = function(serverhost, serverbackend, projectname, | ||
492 | - apihost, uploadsignshost) { | 501 | + wikilibras.run = function(serverhost, serverbackend, projectname, apihost, |
502 | + uploadsignshost) { | ||
493 | base_url = serverhost; | 503 | base_url = serverhost; |
494 | server_backend_url = serverbackend; | 504 | server_backend_url = serverbackend; |
495 | videos_url = base_url + "/videos/"; | 505 | videos_url = base_url + "/videos/"; |
@@ -514,11 +524,11 @@ | @@ -514,11 +524,11 @@ | ||
514 | wikilibras.enableIconCheck = function(container, isHover) { | 524 | wikilibras.enableIconCheck = function(container, isHover) { |
515 | _enableIconCheck(container, isHover); | 525 | _enableIconCheck(container, isHover); |
516 | } | 526 | } |
517 | - | 527 | + |
518 | wikilibras.canHover = function(container) { | 528 | wikilibras.canHover = function(container) { |
519 | return _canHover(container); | 529 | return _canHover(container); |
520 | } | 530 | } |
521 | - | 531 | + |
522 | wikilibras.enableIconHover = function(container, isHover) { | 532 | wikilibras.enableIconHover = function(container, isHover) { |
523 | _enableIconHover(container, isHover); | 533 | _enableIconHover(container, isHover); |
524 | } | 534 | } |