fix: env vars handled via conf file, add: functional tests

This commit is contained in:
Michael 2024-08-17 18:06:06 +02:00
parent 3d08b14f11
commit 21c4330f16
39 changed files with 416 additions and 172 deletions
app/Http/Controllers/CsvController

View file

@ -17,11 +17,12 @@ class CsvController extends Controller
private $csv_data_handling;
public function __construct()
public function __construct($calculate_agent_cost = false)
{
$this->calculate_agent_cost = $calculate_agent_cost || config('app.gitea_calculate_agent_cost');
$this->csv_data_init = new CsvDataInit();
$this->csv_data_handling = new CsvDataHandling();
$this->third_party_integrations_allow = env('THIRD_PARTY_INTEGRATIONS_ALLOW', false);
$this->csv_data_handling = new CsvDataHandling($this->calculate_agent_cost);
$this->third_party_integrations_allow = config('app.third_party_integrations_allow', false);
}
function create_columns(array $issue, array $issue_time, array $company_agents = [])
@ -29,7 +30,7 @@ class CsvController extends Controller
try {
$array = $this->csv_data_init->initialize_csv_data($issue);
$array = $this->csv_data_init->handle_labels($array, $issue['labels']);
$array = $this->csv_data_handling->handle_csv_time($array, $issue, $issue_time, $company_agents);
$array = $this->csv_data_handling->handle_csv_time($array, $issue, $issue_time, $company_agents, $this->calculate_agent_cost);
return $array;
} catch (Error $e) {
Log::error('E-CSV-COLUMNS - ' . $e->getMessage());