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 | 3 | var base_parameter_json = {}; |
| 4 | 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 | 6 | function _setupBaseParameterJSON(tmpJSON) { |
| 14 | - base_parameter_json['userId'] = _getLoggedUser(); | |
| 7 | + base_parameter_json['userId'] = tmpJSON['userId']; | |
| 15 | 8 | base_parameter_json['sinal'] = tmpJSON['sinal']; |
| 16 | 9 | base_parameter_json['interpolacao'] = 'normal'; |
| 17 | 10 | base_parameter_json['movimentos'] = []; | ... | ... |
view/assets/js/wikilibras.js
| ... | ... | @@ -12,6 +12,7 @@ |
| 12 | 12 | function _setupTmpParameterJSON(sign_name) { |
| 13 | 13 | tmpParameterJSON = { |
| 14 | 14 | 'sinal' : sign_name, |
| 15 | + 'userId' : _getLoggedUser(), | |
| 15 | 16 | 'facial' : {}, |
| 16 | 17 | 'right-hand' : {}, |
| 17 | 18 | 'left-hand' : {} |
| ... | ... | @@ -19,6 +20,13 @@ |
| 19 | 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 | 30 | function _loadTaskInfo(task) { |
| 23 | 31 | current_task_id = task.id; |
| 24 | 32 | var sign_name = task.info.sign_name; |
| ... | ... | @@ -329,12 +337,12 @@ |
| 329 | 337 | $("#finish-button").show(); |
| 330 | 338 | |
| 331 | 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 | 348 | function _setupApprovalScreen(parameterJSON) { |
| ... | ... | @@ -417,7 +425,7 @@ |
| 417 | 425 | answer["status"] = status; |
| 418 | 426 | var last_answer = task.info.last_answer; |
| 419 | 427 | var hasLastAnswer = typeof last_answer != "undefined"; |
| 420 | - | |
| 428 | + | |
| 421 | 429 | if (hasLastAnswer && status == "APPROVED") { |
| 422 | 430 | answer["number_of_approval"] = last_answer.number_of_approval + 1; |
| 423 | 431 | answer["parameter_json"] = last_answer.parameter_json; |
| ... | ... | @@ -435,6 +443,8 @@ |
| 435 | 443 | data : { |
| 436 | 444 | "task_id" : task.id, |
| 437 | 445 | "project_id" : task.project_id, |
| 446 | + "user_id" : _getLoggedUser(), | |
| 447 | + "sign_name" : task.info.sign_name, | |
| 438 | 448 | "number_of_approval" : answer.number_of_approval, |
| 439 | 449 | }, |
| 440 | 450 | success : function(response) { |
| ... | ... | @@ -462,14 +472,14 @@ |
| 462 | 472 | // It removes the PyBossa default message |
| 463 | 473 | $(".row .col-md-12 p").remove(); |
| 464 | 474 | } |
| 465 | - | |
| 475 | + | |
| 466 | 476 | function _loadMainComponents() { |
| 467 | 477 | dynengine.load(); |
| 468 | 478 | dynworkflow.load(); |
| 469 | 479 | submitSign.setup(upload_signs_url); |
| 470 | 480 | teachedSigns.setup(); |
| 471 | 481 | } |
| 472 | - | |
| 482 | + | |
| 473 | 483 | pybossa.presentTask(function(task, deferred) { |
| 474 | 484 | _loadMainComponents(); |
| 475 | 485 | if (!$.isEmptyObject(task) && current_task_id != task.id) { |
| ... | ... | @@ -488,8 +498,8 @@ |
| 488 | 498 | } |
| 489 | 499 | |
| 490 | 500 | // Public methods |
| 491 | - wikilibras.run = function(serverhost, serverbackend, projectname, | |
| 492 | - apihost, uploadsignshost) { | |
| 501 | + wikilibras.run = function(serverhost, serverbackend, projectname, apihost, | |
| 502 | + uploadsignshost) { | |
| 493 | 503 | base_url = serverhost; |
| 494 | 504 | server_backend_url = serverbackend; |
| 495 | 505 | videos_url = base_url + "/videos/"; |
| ... | ... | @@ -514,11 +524,11 @@ |
| 514 | 524 | wikilibras.enableIconCheck = function(container, isHover) { |
| 515 | 525 | _enableIconCheck(container, isHover); |
| 516 | 526 | } |
| 517 | - | |
| 527 | + | |
| 518 | 528 | wikilibras.canHover = function(container) { |
| 519 | 529 | return _canHover(container); |
| 520 | 530 | } |
| 521 | - | |
| 531 | + | |
| 522 | 532 | wikilibras.enableIconHover = function(container, isHover) { |
| 523 | 533 | _enableIconHover(container, isHover); |
| 524 | 534 | } | ... | ... |