From 7c654f80c4f83936a9c70c4d20288f9786effdeb Mon Sep 17 00:00:00 2001 From: Venkata Chandra Sekhar Nainala Date: Fri, 17 Nov 2023 00:19:50 +0100 Subject: [PATCH 1/2] fix: updated study public card and other bug fixes --- app/Http/Controllers/API/SearchController.php | 2 +- app/Http/Resources/StudyResource.php | 1 + app/Models/Study.php | 12 ++ resources/js/Shared/StudyCard.vue | 40 ----- resources/js/Shared/StudyCardPublic.vue | 156 +++++++++++++++--- 5 files changed, 150 insertions(+), 61 deletions(-) diff --git a/app/Http/Controllers/API/SearchController.php b/app/Http/Controllers/API/SearchController.php index f4dd4ff8..020fa5be 100644 --- a/app/Http/Controllers/API/SearchController.php +++ b/app/Http/Controllers/API/SearchController.php @@ -269,7 +269,7 @@ public function search(Request $request) $offset; } else { $statement = - 'select id, COUNT(*) OVER () from mols limit '. + 'select id, COUNT(*) OVER () from molecules WHERE identifier NOTNULL limit '. $limit. ' offset '. $offset; diff --git a/app/Http/Resources/StudyResource.php b/app/Http/Resources/StudyResource.php index 570b4485..43387af2 100644 --- a/app/Http/Resources/StudyResource.php +++ b/app/Http/Resources/StudyResource.php @@ -42,6 +42,7 @@ public function toArray($request) 'public_url' => $this->public_url ? $this->public_url : null, 'updated_at' => $this->updated_at, 'study_preview_urls' => $this->study_preview_urls, + 'experiment_types' => $this->study_experiment_types, 'download_url' => $this->download_url, 'has_nmrium' => $this->has_nmrium, $this->mergeWhen(! $this->lite, function () { diff --git a/app/Models/Study.php b/app/Models/Study.php index e528d192..fd0f97a5 100644 --- a/app/Models/Study.php +++ b/app/Models/Study.php @@ -124,6 +124,18 @@ public function getStudyPreviewUrlsAttribute() return $urls; } + + /** + * Get the experiment types performed on this sample. + * + * @return string + */ + public function getStudyExperimentTypesAttribute() + { + $experiment_types = $this->datasets->pluck('type'); + return $experiment_types; + } + public function project() { return $this->belongsTo(Project::class, 'project_id'); diff --git a/resources/js/Shared/StudyCard.vue b/resources/js/Shared/StudyCard.vue index e675144a..e3f97232 100644 --- a/resources/js/Shared/StudyCard.vue +++ b/resources/js/Shared/StudyCard.vue @@ -45,46 +45,6 @@
-
diff --git a/resources/js/Shared/StudyCardPublic.vue b/resources/js/Shared/StudyCardPublic.vue index ca8f67ca..0128f996 100644 --- a/resources/js/Shared/StudyCardPublic.vue +++ b/resources/js/Shared/StudyCardPublic.vue @@ -3,14 +3,13 @@ v-if="study" class="flex flex-col border rounded-lg shadow-lg transition ease-in-out delay-150 duration-300 overflow-hidden" > - -
-
    +
    + + +
    + + + + + +
    + + + + + + +
    +
    +
      +
    1. + + + + +
    2. +
    +
    +
    +
    + + +
    +
    + + +
    -
    +
    +
    +
    + -
    -

    +

    + {{ study.name }} +

    +
    + - {{ study.name }} -

    + {{ type }} +
    -
    -
    - Last updated on - {{ formatDate(study.updated_at) }} -
    +
    +
    +
    + Last updated on + {{ formatDate(study.updated_at) }}
    - +
    From 7e1362debc3c6e89b7f0eed873977ceb19d0ab99 Mon Sep 17 00:00:00 2001 From: Venkata Chandra Sekhar Nainala Date: Fri, 17 Nov 2023 07:46:25 +0100 Subject: [PATCH 2/2] fix: validation page rendering issue fix --- resources/js/Shared/Validation.vue | 2 +- resources/js/Shared/ValidationStatus.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/js/Shared/Validation.vue b/resources/js/Shared/Validation.vue index faaa76fc..f31df7da 100644 --- a/resources/js/Shared/Validation.vue +++ b/resources/js/Shared/Validation.vue @@ -691,7 +691,7 @@ export default { if (typeof value == "boolean") { return value; } - return value.split("|")[0] == "true"; + return value ? value.split("|")[0] == "true" : "false"; }, update(model, property) { if (this.mode == "study") { diff --git a/resources/js/Shared/ValidationStatus.vue b/resources/js/Shared/ValidationStatus.vue index 9a91fac5..13d2b154 100644 --- a/resources/js/Shared/ValidationStatus.vue +++ b/resources/js/Shared/ValidationStatus.vue @@ -74,7 +74,7 @@ export default { if (typeof this.status == "boolean") { return this.status; } - return this.status.split("|")[0] == "true"; + return this.status ? this.status.split("|")[0] == "true" : "false"; }, }, };