Skip to content

Commit

Permalink
fix: avoiding unnecessary processing of folders
Browse files Browse the repository at this point in the history
  • Loading branch information
CS76 committed Oct 19, 2023
1 parent 2917b02 commit ff42756
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions app/Http/Controllers/DraftController.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,22 +433,26 @@ public function processFolder($folders)
{
foreach ($folders as $folder) {
if ($folder->type == 'directory') {
if ($this->isBruker($folder)) {
$this->saveInstrumentType($folder, 'bruker');
$this->saveModelType($folder->parent);
} elseif ($this->isVarian($folder)) {
$this->saveInstrumentType($folder, 'varian');
$this->saveModelType($folder->parent);
} else {
$this->processFolder($folder->children);
if ($folder->instrument_type != null) {
if ($this->isBruker($folder)) {
$this->saveInstrumentType($folder, 'bruker');
$this->saveModelType($folder->parent);
} elseif ($this->isVarian($folder)) {
$this->saveInstrumentType($folder, 'varian');
$this->saveModelType($folder->parent);
} else {
$this->processFolder($folder->children);
}
}
} else {
if ($this->isJOEL($folder)) {
$this->saveInstrumentType($folder, 'joel');
$this->saveModelType($folder->parent);
} elseif ($this->isJcampDX($folder)) {
$this->saveInstrumentType($folder, 'jcamp');
$this->saveModelType($folder->parent);
if ($folder->instrument_type != null) {
if ($this->isJOEL($folder)) {
$this->saveInstrumentType($folder, 'joel');
$this->saveModelType($folder->parent);
} elseif ($this->isJcampDX($folder)) {
$this->saveInstrumentType($folder, 'jcamp');
$this->saveModelType($folder->parent);
}
}
}
}
Expand Down

0 comments on commit ff42756

Please sign in to comment.