mirror of
https://github.com/Karaka-Management/oms-QA.git
synced 2026-02-15 23:38:41 +00:00
bug fixes and template adjustments
This commit is contained in:
parent
75bfde55e8
commit
79e0138cfc
|
|
@ -438,6 +438,7 @@ final class ApiController extends Controller
|
||||||
$this->createModel($request->header->account, $new, QAQuestionVoteMapper::class, 'qa_question_vote', $request->getOrigin());
|
$this->createModel($request->header->account, $new, QAQuestionVoteMapper::class, 'qa_question_vote', $request->getOrigin());
|
||||||
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Vote', 'Sucessfully voted.', $new);
|
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Vote', 'Sucessfully voted.', $new);
|
||||||
} else {
|
} else {
|
||||||
|
/** @var QAQuestionVote $questionVote */
|
||||||
$new = clone $questionVote;
|
$new = clone $questionVote;
|
||||||
$new->score = (int) $request->getData('type');
|
$new->score = (int) $request->getData('type');
|
||||||
|
|
||||||
|
|
@ -500,6 +501,7 @@ final class ApiController extends Controller
|
||||||
$this->createModel($request->header->account, $new, QAAnswerVoteMapper::class, 'qa_answer_vote', $request->getOrigin());
|
$this->createModel($request->header->account, $new, QAAnswerVoteMapper::class, 'qa_answer_vote', $request->getOrigin());
|
||||||
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Vote', 'Sucessfully voted.', $new);
|
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Vote', 'Sucessfully voted.', $new);
|
||||||
} else {
|
} else {
|
||||||
|
/** @var QAAnswerVote $answerVote */
|
||||||
$new = clone $answerVote;
|
$new = clone $answerVote;
|
||||||
$new->score = (int) $request->getData('type');
|
$new->score = (int) $request->getData('type');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 8.0
|
|
||||||
*
|
|
||||||
* @package Modules\QA\Models
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link https://orange-management.org
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Modules\QA\Models;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Null model
|
|
||||||
*
|
|
||||||
* @package Modules\QA\Models
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @link https://orange-management.org
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
final class NullQACategory extends QACategory
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param int $id Model id
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function __construct(int $id = 0)
|
|
||||||
{
|
|
||||||
$this->id = $id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -27,18 +27,18 @@ use phpOMS\DataStorage\Database\Query\Builder;
|
||||||
*/
|
*/
|
||||||
final class QAHelperMapper extends DataMapperAbstract
|
final class QAHelperMapper extends DataMapperAbstract
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get total score of account
|
* Get total score of account
|
||||||
*
|
*
|
||||||
* @param array $accounts Accounts
|
* @param array $accounts Accounts
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getAccountScore(array $accounts) : array
|
public static function getAccountScore(array $accounts) : array
|
||||||
{
|
{
|
||||||
$scores = [];
|
$scores = [];
|
||||||
|
|
||||||
$query = new Builder(self::$db);
|
$query = new Builder(self::$db);
|
||||||
$questionScore = $query->select('qa_question_created_by')
|
$questionScore = $query->select('qa_question_created_by')
|
||||||
->selectAs('SUM(qa_question_vote_score)', 'score')
|
->selectAs('SUM(qa_question_vote_score)', 'score')
|
||||||
->from(QAQuestionVoteMapper::getTable())
|
->from(QAQuestionVoteMapper::getTable())
|
||||||
|
|
@ -70,5 +70,5 @@ final class QAHelperMapper extends DataMapperAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
return $scores;
|
return $scores;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ class QAQuestion implements \JsonSerializable
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* App
|
* App
|
||||||
* @var int
|
* @var QAApp
|
||||||
*/
|
*/
|
||||||
public QAApp $app;
|
public QAApp $app;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": ">=9.4",
|
"phpunit/phpunit": ">=9.4",
|
||||||
"friendsofphp/php-cs-fixer": ">=3.0",
|
"friendsofphp/php-cs-fixer": ">=3.0",
|
||||||
"squizlabs/php_codesniffer": ">=3.5",
|
"squizlabs/php_codesniffer": ">=3.6",
|
||||||
"phpmd/phpmd": ">=2.9",
|
"phpmd/phpmd": ">=2.9",
|
||||||
"phpstan/phpstan": ">=0.12.58",
|
"phpstan/phpstan": ">=0.12.58",
|
||||||
"phan/phan": ">=3.2.6"
|
"phan/phan": ">=3.2.6"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user