Skip to content

Commit

Permalink
fix: upload screen updates and various bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CS76 committed Nov 10, 2023
1 parent 9c0e05c commit 30cc6e1
Show file tree
Hide file tree
Showing 9 changed files with 300 additions and 250 deletions.
3 changes: 2 additions & 1 deletion app/Console/Commands/ArchiveData.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public function handle()
])->get();

foreach ($projects as $project) {
// echo($project->identifier);
echo($project->identifier);
echo("\r\n");
ArchiveProject::dispatch($project);
ArchiveStudy::dispatch($project);
}
Expand Down
6 changes: 3 additions & 3 deletions app/Console/Commands/ExtractSpectra.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function handle()
} catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}

$study = $study->fresh();
foreach ($study->datasets as $dataset) {
echo $dataset->identifier;
echo "\r\n";
Expand All @@ -110,8 +110,8 @@ public function handle()
$pathsMatch = true;
if ($files) {
foreach ($files as $file) {
echo $file;
echo "\r\n";
// echo $file;
// echo "\r\n";
if (! str_contains($file, $path)) {
$pathsMatch = false;
}
Expand Down
20 changes: 10 additions & 10 deletions app/Console/Commands/SanitizeProjects.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,16 +309,16 @@ public function localise()

public function updateFilesStatus()
{
$drafts = Draft::where('is_deleted', true)->get();
foreach ($drafts as $draft) {
echo $draft->id;
echo "\r\n";
echo 'Deleting associated files';
FileSystemObject::where('draft_id', $draft->id)->delete();
echo 'Deleting draft';
echo "\r\n";
Draft::where('id', $draft->id)->delete();
}
// $drafts = Draft::where('is_deleted', true)->get();
// foreach ($drafts as $draft) {
// echo $draft->id;
// echo "\r\n";
// echo 'Deleting associated files';
// FileSystemObject::where('draft_id', $draft->id)->delete();
// echo 'Deleting draft';
// echo "\r\n";
// Draft::where('id', $draft->id)->delete();
// }

$fsObjects = FileSystemObject::whereNull('status')->get();
foreach ($fsObjects as $fsObject) {
Expand Down
20 changes: 10 additions & 10 deletions app/Http/Controllers/DraftController.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,16 @@ public function process(Request $request, Draft $draft)
$input = $request->all();
$project = Project::where('draft_id', $draft->id)->first();

if ($project) {
$rule = Rule::unique('projects')->where('owner_id', $input['owner_id'])->ignore($project->id);
} else {
$rule = Rule::unique('projects')->where('owner_id', $input['owner_id']);
}

$validation = $request->validate([
'name' => ['required', 'string', 'max:255', Rule::unique('drafts')
->where('owner_id', $input['owner_id'])->ignore($draft->id), $rule, ],
]);
// if ($project) {
// $rule = Rule::unique('projects')->where('owner_id', $input['owner_id'])->ignore($project->id);
// } else {
// $rule = Rule::unique('projects')->where('owner_id', $input['owner_id']);
// }

// $validation = $request->validate([
// 'name' => ['required', 'string', 'max:255', Rule::unique('drafts')
// ->where('owner_id', $input['owner_id'])->ignore($draft->id), $rule, ],
// ]);

$draftFolders = FileSystemObject::with('children')
->where([
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Resources/ProjectResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function () {
'children' => FileSystemObject::with(
'children'
)
->where([['project_id', $this->id]])
->where([['project_id', $this->id], ['level', 0]])
->orderBy('type')
->get(),
],
Expand Down
6 changes: 3 additions & 3 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ public function register()
*/
public function boot()
{
if ($this->app->environment('production')) {
\URL::forceScheme('https');
}
// if ($this->app->environment('production')) {
// \URL::forceScheme('https');
// }
}
}
6 changes: 3 additions & 3 deletions resources/js/Pages/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@
d="M9 13h6m-3-3v6m-9 1V7a2 2 0 012-2h6l2 2h6a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2z"
/>
</svg>
<h3 class="mt-2 text-sm font-medium text-gray-900">
No Projects or Samples
<h3 class="mt-2 text-md font-medium text-gray-900">
You have no <b>projects</b> or <b>samples</b> yet
</h3>
<div v-if="editableTeamRole" class="mt-2">
<p class="mb-1 text-sm text-gray-500">
Get started by uploading your data.
</p>
<create mode="button"></create>
<create class="mt-5" mode="button"></create>
<span
class="float-center text-xs cursor-pointer hover:text-blue-700 mt-2"
>
Expand Down
Loading

0 comments on commit 30cc6e1

Please sign in to comment.