Skip to content

Commit

Permalink
Merge pull request #1134 from NFDI4Chem/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
CS76 authored May 2, 2024
2 parents 72a05c5 + 2a833f6 commit 294807a
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 84 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ jobs:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20
cache: npm
- run: npm ci
- name: Build
run: npm run docs:build
- uses: actions/configure-pages@v2
- uses: actions/upload-pages-artifact@v1
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist
- name: Deploy
id: deployment
uses: actions/deploy-pages@v2.0.2
uses: actions/deploy-pages@v4
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class BioschemasController extends Controller
* @param Illuminate\Http\Request $request
* @param App\Models\User $username
* @param App\Models\Project $projectName
* @param App\Models\Study $studyName Optional
* @param App\Models\Dataset $datasetName Optional
* @param App\Models\Study $studyName Optional
* @param App\Models\Dataset $datasetName Optional
* @return object
*/
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class DataCiteController extends Controller
* @param Illuminate\Http\Request $request
* @param App\Models\User $username
* @param App\Models\Project $projectName
* @param App\Models\Study $studyName Optional
* @param App\Models\Dataset $datasetName Optional
* @param App\Models\Study $studyName Optional
* @param App\Models\Dataset $datasetName Optional
* @return object
*/
/**
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/API/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ public function search(Request $request)
$statement = $statement.')';
}
$statement = $statement.' LIMIT '.$limit;
// dd($statement );
// dd($statement );
} else {
if ($query) {
$query = str_replace("'", "''", $query);
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Admin/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function checkPassword(Request $request)
/**
* Delete the profile photo.
*
* @return \Illuminate\Http\RedirectResponse
* @return \Illuminate\Http\RedirectResponse
*/
public function destroyPhoto(User $user, Request $request)
{
Expand Down
123 changes: 55 additions & 68 deletions app/Http/Controllers/ProjectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use App\Models\User;
use App\Models\Validation;
use Auth;
use Carbon\Carbon;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Contracts\Auth\StatefulGuard;
use Illuminate\Http\JsonResponse;
Expand Down Expand Up @@ -328,83 +327,71 @@ public function publish(Request $request, Project $project, PublishProject $publ
if ($project) {
$input = $request->all();
$release_date = $input['release_date'];
if (! $project->is_public && ! is_null($project->doi) && ! is_null($release_date)) {
$release_date = Carbon::parse($release_date);
if ($release_date->isPast()) {
$updater->update($project, $request->all());
$publisher->publish($project);
$project->sendNotification('publish', $this->prepareSendList($project));
}
} else {

$enableProjectMode = $request->get('enableProjectMode');
if ($enableProjectMode) {
$validation = $project->validation;
$validation->process();
$validation = $validation->fresh();
if ($validation['report']['project']['status']) {
$project->release_date = $request->get('release_date');
$project->status = 'queued';
$project->save();

ProcessSubmission::dispatch($project);

return response()->json([
'project' => $project,
'validation' => $validation,
]);
} else {
return response()->json([
'errors' => 'Validation failing. Please provide all the required data and try again. If the problem persists, please contact us.',
'validation' => $validation,
], 422);
}
} else {
$draft = $project->draft;
$draft->project_enabled = false;
$draft->save();

$enableProjectMode = $request->get('enableProjectMode');
if ($enableProjectMode) {
$validation = $project->validation;
$validation->process();
$validation = $validation->fresh();
if ($validation['report']['project']['status']) {
$project->release_date = $request->get('release_date');
$project->status = 'queued';
$project->save();

$validation = $project->validation;
$validation->process();
$validation = $validation->fresh();

foreach ($project->studies as $study) {
$study->license_id = $project->license_id;
$study->save();
foreach ($study->datasets as $dataset) {
$dataset->license_id = $project->license_id;
$dataset->save();
}
ProcessSubmission::dispatch($project);

return response()->json([
'project' => $project,
'validation' => $validation,
]);
} else {
return response()->json([
'errors' => 'Validation failing. Please provide all the required data and try again. If the problem persists, please contact us.',
'validation' => $validation,
], 422);
}
} else {
$draft = $project->draft;
$draft->project_enabled = false;
$draft->save();

$project->release_date = $request->get('release_date');
$project->status = 'queued';
$project->save();

$validation = $project->validation;
$validation->process();
$validation = $validation->fresh();

foreach ($project->studies as $study) {
$study->license_id = $project->license_id;
$study->save();
foreach ($study->datasets as $dataset) {
$dataset->license_id = $project->license_id;
$dataset->save();
}
}

$status = true;
$status = true;

foreach ($validation['report']['project']['studies'] as $study) {
if (! $study['status']) {
$status = false;
}
}
// add license check
if ($status) {
ProcessSubmission::dispatch($project);

return response()->json([
'project' => $project,
'validation' => $validation,
]);
} else {
return response()->json([
'errors' => 'Validation failing. Please provide all the required data and try again. If the problem persists, please contact us.',
], 422);
foreach ($validation['report']['project']['studies'] as $study) {
if (! $study['status']) {
$status = false;
}
}

// add license check
if ($status) {
ProcessSubmission::dispatch($project);

return response()->json([
'project' => $project,
'validation' => $validation,
]);
} else {
return response()->json([
'errors' => 'Validation failing. Please provide all the required data and try again. If the problem persists, please contact us.',
], 422);
}
}

}

}
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public function citations()
/**
* Send Notification via email.
*
* @param string $notifyType (deletion / deletionReminder / archival / archivalAdmin)
* @param string $notifyType (deletion / deletionReminder / archival / archivalAdmin)
* @param array sendTo
* @return void
*/
Expand Down
1 change: 0 additions & 1 deletion app/Models/Schemas/Study.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ public function studyDomain($studyDomain)
* drugs, etc. investigated by the study.
*
* @param \Spatie\SchemaOrg\Contracts\BioChemEntityContract|\Spatie\SchemaOrg\Contracts\MedicalEntityContract[] $studySubject
* @return static
*/
public function studySubject($studySubject)
Expand Down
2 changes: 1 addition & 1 deletion app/Policies/ProjectPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function createProject(User $user)
*/
public function updateProject(User $user, Project $project)
{
if ($project->is_public || $project->is_archived || $project->is_deleted || $project->is_published || (! $project->is_published && $project->doi)) {
if ($project->is_public || $project->is_archived || $project->is_deleted || $project->is_published) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion resources/js/App/MoleculeCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</div>
<div class="font-bold text-md mb-2">
<a class="font-semibold text-gray-600 hover:underline"
>#NMRXIV:{{ molecule.identifier }}</a
>#NMRXIV:M{{ molecule.identifier }}</a
>
</div>
<div
Expand Down

0 comments on commit 294807a

Please sign in to comment.