bug fixes and template adjustments

This commit is contained in:
Dennis Eichhorn 2021-07-31 17:20:49 +02:00
parent 75bfde55e8
commit 79e0138cfc
5 changed files with 15 additions and 51 deletions

View File

@ -438,6 +438,7 @@ final class ApiController extends Controller
$this->createModel($request->header->account, $new, QAQuestionVoteMapper::class, 'qa_question_vote', $request->getOrigin());
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Vote', 'Sucessfully voted.', $new);
} else {
/** @var QAQuestionVote $questionVote */
$new = clone $questionVote;
$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->fillJsonResponse($request, $response, NotificationLevel::OK, 'Vote', 'Sucessfully voted.', $new);
} else {
/** @var QAAnswerVote $answerVote */
$new = clone $answerVote;
$new->score = (int) $request->getData('type');

View File

@ -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;
}
}

View File

@ -27,18 +27,18 @@ use phpOMS\DataStorage\Database\Query\Builder;
*/
final class QAHelperMapper extends DataMapperAbstract
{
/**
* Get total score of account
*
* @param array $accounts Accounts
*
* @return array
*/
public static function getAccountScore(array $accounts) : array
{
/**
* Get total score of account
*
* @param array $accounts Accounts
*
* @return array
*/
public static function getAccountScore(array $accounts) : array
{
$scores = [];
$query = new Builder(self::$db);
$query = new Builder(self::$db);
$questionScore = $query->select('qa_question_created_by')
->selectAs('SUM(qa_question_vote_score)', 'score')
->from(QAQuestionVoteMapper::getTable())
@ -70,5 +70,5 @@ final class QAHelperMapper extends DataMapperAbstract
}
return $scores;
}
}
}

View File

@ -119,7 +119,7 @@ class QAQuestion implements \JsonSerializable
/**
* App
* @var int
* @var QAApp
*/
public QAApp $app;

View File

@ -10,7 +10,7 @@
"require-dev": {
"phpunit/phpunit": ">=9.4",
"friendsofphp/php-cs-fixer": ">=3.0",
"squizlabs/php_codesniffer": ">=3.5",
"squizlabs/php_codesniffer": ">=3.6",
"phpmd/phpmd": ">=2.9",
"phpstan/phpstan": ">=0.12.58",
"phan/phan": ">=3.2.6"