This repository has been archived by the owner on Nov 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
81eb94e
commit 87a626d
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php namespace BFACP\Commands; | ||
|
||
use BFACP\Adkats\Infractions\Overall; | ||
use Illuminate\Console\Command; | ||
|
||
class InfractionsCleanup extends Command | ||
{ | ||
|
||
/** | ||
* The console command name. | ||
* | ||
* @var string | ||
*/ | ||
protected $name = 'bfacp:infractions-cleanup'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Cleans up infractions'; | ||
|
||
/** | ||
* Create a new command instance. | ||
*/ | ||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
} | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function fire() | ||
{ | ||
Overall::with('player', 'servers')->where('total_points', '<', 0)->chunk(1000, function ($infractions) { | ||
foreach ($infractions as $infraction) { | ||
$total = abs($infraction->total_points); | ||
|
||
if ($infraction->forgive_points > 0 && $infraction->punish_points == 0) { | ||
$total = $infraction->forgive_points; | ||
} elseif ($infraction->forgive_points > $infraction->punish_points) { | ||
$total = $infraction->forgive_points - $infraction->punish_points; | ||
} | ||
|
||
$this->info(sprintf('Deleted %s forgives for %s', $total, $infraction->player->SoldierName)); | ||
sleep(0.5); | ||
} | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div class="modal-header"> | ||
<h3 class="modal-title"></h3> | ||
</div> | ||
|
||
<div class="modal-body"></div> | ||
|
||
<div class="modal-footer"> | ||
<button class="btn btn-primary" ng-click="ok()"> | ||
<i class="fa fa-spinner fa-pulse" ng-show="working"></i> OK | ||
</button> | ||
<button class="btn btn-warning" ng-click="cancel()">Cancel</button> | ||
</div> |