<commit_before><?php

namespace App\Console\Commands;

use Carbon\Carbon;
use Illuminate\Console\Command;
use Point\Framework\Helpers\InventoryHelper;
use Point\Framework\Models\Formulir;
use Point\Framework\Models\Inventory;
use Point\Framework\Models\Master\Allocation;
use Point\PointInventory\Models\StockOpname\StockOpname;
use Point\PointInventory\Models\TransferItem\TransferItem;

class Reti extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'dev:reti';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'recalculate inventory';

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $this->comment('recalculating inventory');

        \DB::beginTransaction();

        $alsd = Allocation::find(1);
        if ($alsd) {
            $alsd->created_at = Carbon::now();
            $alsd->save();
        }

        $formulirs = Formulir::where('formulirable_type', '=', TransferItem::class)
            ->whereNotNull('form_number')
            ->whereNull('canceled_at')
            ->where('form_date', '>=', '2019-10-01 00:00:00')
            ->get();

        foreach ($formulirs as $formulir) {
            $qty = 0;
            $inventories = Inventory::where('formulir_id', $formulir->id)->get();

            Inventory::where('formulir_id', $formulir->id)->delete();

            foreach ($inventories as $inventory) {

                $qty += $inventory->quantity;
            }
            $this->line('DEL : '.$formulir->form_number);
            if ($qty != 0) {
                $this->line('DEL : '.$formulir->form_number . ' = ' . $qty . ' = ' . $formulir->id);
                $this->line('DEL : '.$formulir->form_number . ' = ' . $qty . ' = ' . $formulir->id);
            }
        }

        $formulirs = Formulir::where('formulirable_type', '=', TransferItem::class)
            ->whereNotNull('form_number')
            ->whereNotNull('canceled_at')
            ->where('form_date', '>=', '2019-10-01 00:00:00')
            ->get();

        foreach ($formulirs as $formulir) {
            $qty = 0;

            $transfer_item = TransferItem::where('formulir_id', $formulir->id)->first();<commit_msg>fix rejected<commit_after><?php

namespace App\Console\Commands;

use Carbon\Carbon;
use Illuminate\Console\Command;
use Point\Framework\Helpers\InventoryHelper;
use Point\Framework\Models\Formulir;
use Point\Framework\Models\Inventory;
use Point\Framework\Models\Master\Allocation;
use Point\PointInventory\Models\StockOpname\StockOpname;
use Point\PointInventory\Models\TransferItem\TransferItem;

class Reti extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'dev:reti';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'recalculate inventory';

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $this->comment('recalculating inventory');

        \DB::beginTransaction();

        $alsd = Allocation::find(1);
        if ($alsd) {
            $alsd->created_at = Carbon::now();
            $alsd->save();
        }

        $formulirs = Formulir::where('formulirable_type', '=', TransferItem::class)
            ->where('approval_status', -1)
            ->where('form_date', '>=', '2019-10-01 00:00:00')
            ->get();

        foreach ($formulirs as $formulir) {
            $qty = 0;
            $inventories = Inventory::where('formulir_id', $formulir->id)->get();

            Inventory::where('formulir_id', $formulir->id)->delete();

            foreach ($inventories as $inventory) {
                $qty += $inventory->quantity;
            }

            $this->line('DEL : '.$formulir->form_number);
            if ($qty != 0) {
                $this->line('DEL : '.$formulir->form_number . ' = ' . $qty . ' = ' . $formulir->id);
                $this->line('DEL : '.$formulir->form_number . ' = ' . $qty . ' = ' . $formulir->id);
            }
        }

        $formulirs = Formulir::where('formulirable_type', '=', TransferItem::class)
            ->whereNotNull('form_number')
            ->whereNull('canceled_at')
            ->where('form_date', '>=', '2019-10-01 00:00:00')
            ->get();

        foreach ($formulirs as $formulir) {
            $qty = 0;
            $inventories = Inventory::where('formulir_id', $formulir->id)->get();

            Inventory::where('formulir_id', $formulir->id)->delete();

            foreach ($inventories as $inventory) {
                $qty += $inventory->quantity;
            }

            $this->line('DEL : '.$formulir->form_number);
            if ($qty != 0) {
                $this->line('DEL : '.$formulir->form_number . ' = ' . $qty . ' = ' . $formulir->id);
                $this->line('DEL : '.$formulir->form_number . ' = ' . $qty . ' = ' . $formulir->id);
            }
        }

        $formulirs = Formulir::where('formulirable_type', '=', TransferItem::class)
            ->whereNotNull('form_number')
            ->whereNotNull('canceled_at')
            ->where('form_date', '>=', '2019-10-01 00:00:00')
            ->get();

        foreach ($formulirs as $formulir) {
            $qty = 0;

            $transfer_item = TransferItem::where('formulir_id', $formulir->id)->first();
{'fraction_non_alphanumeric': 0.1678069859560677, 'fraction_numerical': 0.01458408354339215, 'mean_word_length': 2.1137892376681613, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 76, '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': '7531000', 'n_tokens_mistral': 1816, 'n_tokens_neox': 1713, 'n_words': 283}