<commit_before><?php
namespace Minds\Core\Reports\Appeals;

use Cassandra;

use Minds\Core;
use Minds\Core\Di\Di;
use Minds\Core\Data;
use Minds\Core\Data\ElasticSearch\Prepared;
use Minds\Entities;
use Minds\Entities\DenormalizedEntity;
use Minds\Entities\NormalizedEntity;
use Minds\Common\Repository\Response;
use Minds\Core\Reports\Repository as ReportsRepository;


class Repository
{
    /** @var Data\ElasticSearch\Client $es */
    protected $es;

    /** @var ReportsRepository $reportsRepository */
    private $reportsRepository;

    public function __construct($es = null, $reportsRepository = null)
    {
        $this->es = $es ?: Di::_()->get('Database\ElasticSearch');
        $this->reportsRepository = $reportsRepository ?: new ReportsRepository;
    }

    /**
     * Return a list of appeals
     * @param array $options 'limit', 'offset', 'state'
     * @return array
     */
    public function getList(array $opts = [])
    {
        $opts = array_merge([
            'limit' => 12,
            'offset' => '',
            'state' => '',
            'owner_guid' => null
        ], $opts);

        $response = new Response();

        $must = [];
        $must_not = [];

        // Only show for posts user owns
        $must[] = [
            'match' => [
                'entity_owner_guid' => (int) $opts['owner_guid'],
            ],
        ];

        // Initial jury must have acted
        $must[] = [
            'exists' => [
                'field' => '@initial_jury_decided_timestamp',
            ],
        ];

        // But not the appeal jury if we are simply reviewing
        if ($opts['showAppealed']) {<commit_msg>(chore): do not return for appeal if initial jury overturned<commit_after><?php
namespace Minds\Core\Reports\Appeals;

use Cassandra;

use Minds\Core;
use Minds\Core\Di\Di;
use Minds\Core\Data;
use Minds\Core\Data\ElasticSearch\Prepared;
use Minds\Entities;
use Minds\Entities\DenormalizedEntity;
use Minds\Entities\NormalizedEntity;
use Minds\Common\Repository\Response;
use Minds\Core\Reports\Repository as ReportsRepository;


class Repository
{
    /** @var Data\ElasticSearch\Client $es */
    protected $es;

    /** @var ReportsRepository $reportsRepository */
    private $reportsRepository;

    public function __construct($es = null, $reportsRepository = null)
    {
        $this->es = $es ?: Di::_()->get('Database\ElasticSearch');
        $this->reportsRepository = $reportsRepository ?: new ReportsRepository;
    }

    /**
     * Return a list of appeals
     * @param array $options 'limit', 'offset', 'state'
     * @return array
     */
    public function getList(array $opts = [])
    {
        $opts = array_merge([
            'limit' => 12,
            'offset' => '',
            'state' => '',
            'owner_guid' => null
        ], $opts);

        $response = new Response();

        $must = [];
        $must_not = [];

        // Only show for posts user owns
        $must[] = [
            'match' => [
                'entity_owner_guid' => (int) $opts['owner_guid'],
            ],
        ];

        // Initial jury must have acted
        $must[] = [
            'exists' => [
                'field' => '@initial_jury_decided_timestamp',
            ],
        ];

        $must_not[] = [
            'match' => [
                'initial_jury_action' => 'overturn',
            ],
        ];

        // But not the appeal jury if we are simply reviewing
        if ($opts['showAppealed']) {
{'fraction_non_alphanumeric': 0.13950829045168667, 'fraction_numerical': 0.0011435105774728416, 'mean_word_length': 2.0964601769911506, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1538991', 'n_tokens_mistral': 1049, 'n_tokens_neox': 1005, 'n_words': 239}