From 98d5c2e2e05cc28471380462571845ba0a7fe635 Mon Sep 17 00:00:00 2001 From: PG-Momik Date: Wed, 11 Sep 2024 15:13:36 +0545 Subject: [PATCH] - [x] Update condition --- .../RefreshActivityElementCompleteness.php | 76 +++++++++++++++++ app/IATI/Data/elementJsonSchema.json | 70 ++++++++-------- app/IATI/Services/ElementCompleteService.php | 84 +++++++++++-------- .../ImportActivity/ImportXmlService.php | 29 ++++++- .../js/views/activity/elements/Result.vue | 9 +- .../activity/indicators/IndicatorDetail.vue | 12 +++ .../views/activity/results/ResultDetail.vue | 21 +++-- resources/assets/sass/component/_input.scss | 32 +++---- tests/Feature/Element/ResultCompleteTest.php | 19 +++-- 9 files changed, 245 insertions(+), 107 deletions(-) create mode 100644 app/Console/Commands/RefreshActivityElementCompleteness.php diff --git a/app/Console/Commands/RefreshActivityElementCompleteness.php b/app/Console/Commands/RefreshActivityElementCompleteness.php new file mode 100644 index 000000000..0c1893d37 --- /dev/null +++ b/app/Console/Commands/RefreshActivityElementCompleteness.php @@ -0,0 +1,76 @@ +element_status field. + * + * @var string + */ + protected $description = ' Will refresh activity->element_status field.'; + + /** + * Execute the console command. + * + * @return void + * @throws BindingResolutionException + */ + public function handle(): void + { + /** @var ElementCompleteService $elementCompleteService */ + $elementCompleteService = app()->make(ElementCompleteService::class); + + Activity::with('transactions', 'results.indicators.periods')->latest()->chunk(100, function ($activities) use ($elementCompleteService) { + DB::beginTransaction(); + try { + foreach ($activities as $activity) { + $this->info("Started for activity: $activity->id"); + + $activityElementNames = $activity->getAttributes(); + $elementStatus = []; + + foreach ($activityElementNames as $element => $value) { + $methodName = dashesToCamelCase('is_' . $element . '_element_completed'); + + if (method_exists($elementCompleteService, $methodName)) { + $elementStatus[$element] = $elementCompleteService->$methodName($activity); + } + } + + $elementStatus['result'] = $elementCompleteService->isResultElementCompleted($activity); + $elementStatus['transactions'] = $elementCompleteService->isTransactionsElementCompleted($activity); + + $activity->timestamps = false; + $activity->updateQuietly(['element_status' => $elementStatus]); + + $this->info("Completed for activity: $activity->id"); + $this->info('---------------------------------------'); + } + + DB::commit(); + } catch (Exception $e) { + DB::rollBack(); + $this->error($e->getMessage()); + } + }); + } +} diff --git a/app/IATI/Data/elementJsonSchema.json b/app/IATI/Data/elementJsonSchema.json index ee76c5d5e..ea47348bb 100644 --- a/app/IATI/Data/elementJsonSchema.json +++ b/app/IATI/Data/elementJsonSchema.json @@ -2807,7 +2807,7 @@ "type": "text", "placeholder": "Type url", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "The target URL of the external document, e.g. http://www.example.org/doc.odt. For more information.", "help_text": "Type the URL for the document that provides more information about the result. Make sure it includes “https://…" }, @@ -2818,7 +2818,7 @@ "placeholder": "Select format", "choices": "Activity/FileFormat.json", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "An IANA code for the MIME type of the document being referenced, e.g. “application/pdf”. For more information", "help_text": "" } @@ -2837,7 +2837,7 @@ "type": "textarea", "placeholder": "Type narrative", "required": true, - "criteria": "mandatory", + "criteria": "", "add_more": true, "attr": { "row": 4 @@ -2852,7 +2852,7 @@ "placeholder": "Select language", "choices": "Activity/Language.json", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "A code specifying the language of text in this element. It is recommended that wherever possible only codes from ISO 639-1 are used. If not present, the default language is assumed. For more information", "help_text": "If no language is selected, your default language is assumed." } @@ -2877,7 +2877,7 @@ "placeholder": "Select code", "choices": "Activity/DocumentCategory.json", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "An IATI code defining the category of the document. For more information", "help_text": "Select a document category from this list." } @@ -2979,7 +2979,7 @@ "placeholder": "Select vocabulary", "choices": "Activity/ResultVocabulary.json", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "A code for the results framework vocabulary. The code must be a valid value in the ResultVocabulary codelist. For more information", "help_text": "" }, @@ -2989,7 +2989,7 @@ "type": "text", "placeholder": "Type code", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "A code from the codelist identified in vocabulary that identifies a results framework. For more information", "help_text": "" }, @@ -3108,7 +3108,7 @@ "type": "textarea", "placeholder": "Type narrative", "required": true, - "criteria": "mandatory", + "criteria": "", "add_more": true, "attr": { "row": 4 @@ -3123,7 +3123,7 @@ "placeholder": "Select language", "choices": "Activity/Language.json", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "A code specifying the language of text in this element. It is recommended that wherever possible only codes from ISO 639-1 are used. If not present, the default language is assumed. For more information", "help_text": "If no language is selected, your default language is assumed." } @@ -3145,7 +3145,7 @@ "type": "text", "placeholder": "Type url", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "The target URL of the external document, e.g. http://www.example.org/doc.odt. For more information.", "help_text": "Provide the link to a specific results indicator being reported. Make sure it includes “https://…" }, @@ -3156,7 +3156,7 @@ "placeholder": "Select format", "choices": "Activity/FileFormat.json", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "An IANA code for the MIME type of the document being referenced, e.g. “application/pdf”. For more information", "help_text": "" } @@ -3175,7 +3175,7 @@ "type": "textarea", "placeholder": "Type narrative", "required": true, - "criteria": "mandatory", + "criteria": "", "add_more": true, "attr": { "row": 4 @@ -3190,7 +3190,7 @@ "placeholder": "Select language", "choices": "Activity/Language.json", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "A code specifying the language of text in this element. It is recommended that wherever possible only codes from ISO 639-1 are used. If not present, the default language is assumed. For more information", "help_text": "If no language is selected, your default language is assumed." } @@ -3215,7 +3215,7 @@ "placeholder": "Select code", "choices": "Activity/DocumentCategory.json", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "An IATI code defining the category of the document. For more information", "help_text": "Select a document category." } @@ -3317,7 +3317,7 @@ "placeholder": "Select vocabulary", "choices": "Activity/IndicatorVocabulary.json", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "A code for the results framework vocabulary. The code must be a valid value in the ResultVocabulary codelist. For more information", "help_text": "Select the results framework that your indicator is included in. If the results framework is not listed, select ‘99 Reporting Organisation’." }, @@ -3357,7 +3357,7 @@ "type": "text", "placeholder": "Type year", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "The year the baseline value was taken (yyyy). For more information", "help_text": "Provide the year when the indicator’s baseline was measured." }, @@ -3395,7 +3395,7 @@ "type": "textarea", "placeholder": "Type narrative", "required": true, - "criteria": "mandatory", + "criteria": "", "add_more": true, "attr": { "row": 4 @@ -3410,7 +3410,7 @@ "placeholder": "Select language", "choices": "Activity/Language.json", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "A code specifying the language of text in this element. It is recommended that wherever possible only codes from ISO 639-1 are used. If not present, the default language is assumed. For more information", "help_text": "If no language is selected, your default language is assumed." } @@ -3464,7 +3464,7 @@ "type": "text", "placeholder": "Type url", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "The target URL of the external document, e.g. “http://www.example.org/doc.odt”. For more information", "help_text": "Type the URL for the document that provides more information about the indicator baseline. Make sure it includes “https://…" }, @@ -3475,7 +3475,7 @@ "placeholder": "Type format", "choices": "Activity/FileFormat.json", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "An IANA code for the MIME type of the document being referenced, e.g. “application/pdf”. For more information", "help_text": "" } @@ -3495,7 +3495,7 @@ "type": "textarea", "placeholder": "Type narrative", "required": true, - "criteria": "mandatory", + "criteria": "", "add_more": true, "attr": { "row": 4 @@ -3510,7 +3510,7 @@ "placeholder": "Select code", "choices": "Activity/Language.json", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "A code specifying the language of text in this element. It is recommended that wherever possible only codes from ISO 639-1 are used. If not present, the default language is assumed. For more information", "help_text": "If no language is selected, your default language is assumed." } @@ -3535,7 +3535,7 @@ "placeholder": "Select code", "choices": "Activity/DocumentCategory.json", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "An IATI code defining the category of the document. For more information", "help_text": "Select a document category." } @@ -3793,7 +3793,7 @@ "type": "text", "placeholder": "Type url", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "The target URL of the external document, e.g. “http://www.example.org/doc.odt”. For more information", "help_text": "Type the URL for the document that provides more information about the indicator target. Make sure it includes “https://…" }, @@ -3804,7 +3804,7 @@ "placeholder": "Select format", "choices": "Activity/FileFormat.json", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "An IANA code for the MIME type of the document being referenced, e.g. “application/pdf”. For more information", "help_text": "" } @@ -3823,7 +3823,7 @@ "type": "textarea", "placeholder": "Type narrative", "required": true, - "criteria": "mandatory", + "criteria": "", "add_more": true, "attr": { "row": 4 @@ -3838,7 +3838,7 @@ "placeholder": "Select language", "choices": "Activity/Language.json", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "A code specifying the language of text in this element. It is recommended that wherever possible only codes from ISO 639-1 are used. If not present, the default language is assumed. For more information", "help_text": "If no language is selected, your default language is assumed." } @@ -3862,7 +3862,7 @@ "placeholder": "Select code", "choices": "Activity/DocumentCategory.json", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "An IATI code defining the category of the document. For more information", "help_text": "Select a document category." } @@ -4003,7 +4003,7 @@ "type": "textarea", "placeholder": "Type narrative", "required": true, - "criteria": "mandatory", + "criteria": "", "add_more": true, "hover_text": "The free text name or description of the item being described. This can be repeated in multiple languages. For more information", "help_text": "", @@ -4018,7 +4018,7 @@ "placeholder": "Select language", "choices": "Activity/Language.json", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "A code specifying the language of text in this element. It is recommended that wherever possible only codes from ISO 639-1 are used. If not present, the default language is assumed. For more information", "help_text": "If no language is selected, your default language is assumed." } @@ -4070,7 +4070,7 @@ "type": "text", "placeholder": "Type url", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "The target URL of the external document, e.g. “http://www.example.org/doc.odt”. For more information", "help_text": "Type the URL for the document that provides more information about the actual value or result. Make sure it includes “https://…" }, @@ -4081,7 +4081,7 @@ "placeholder": "Select format", "choices": "Activity/FileFormat.json", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "An IANA code for the MIME type of the document being referenced, e.g. “application/pdf”. For more information", "help_text": "" } @@ -4100,7 +4100,7 @@ "type": "textarea", "placeholder": "Type narrative", "required": true, - "criteria": "mandatory", + "criteria": "", "add_more": true, "attr": { "row": 4 @@ -4115,7 +4115,7 @@ "placeholder": "Select language", "choices": "Activity/Language.json", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "A code specifying the language of text in this element. It is recommended that wherever possible only codes from ISO 639-1 are used. If not present, the default language is assumed. For more information", "help_text": "If no language is selected, your default language is assumed." } @@ -4140,7 +4140,7 @@ "placeholder": "Select code", "choices": "Activity/DocumentCategory.json", "required": true, - "criteria": "mandatory", + "criteria": "", "hover_text": "An IATI code defining the category of the document. For more information", "help_text": "Select a document category." } diff --git a/app/IATI/Services/ElementCompleteService.php b/app/IATI/Services/ElementCompleteService.php index 7e27a4bb8..708ca1e68 100644 --- a/app/IATI/Services/ElementCompleteService.php +++ b/app/IATI/Services/ElementCompleteService.php @@ -804,37 +804,42 @@ public function getFormattedResults($activity): array $indicatorData = []; $periodData = []; - if (!empty($results)) { - foreach ($results as $resultKey => $result) { - $resultData[] = $result['result']; - $indicators = $result['indicators']; - $resultReference = Arr::get($result['result'], 'reference'); - - if (!empty($indicators)) { - foreach ($indicators as $indicatorKey => $indicator) { - $indicatorValue = $indicator['indicator']; - - if (is_array_value_empty(Arr::get($indicatorValue, 'reference'))) { - $indicatorValue['reference'] = $resultReference; - } else { - $resultLastKey = array_key_last($resultData); - $resultData[$resultLastKey]['reference'] = Arr::get($indicatorValue, 'reference'); - } - $indicatorData[] = $indicatorValue; - $periods = $indicator['periods']; - - if (!empty($periods)) { - $indicatorData[$indicatorKey] = $indicatorValue; - - foreach ($periods as $period) { - $periodData[] = $period['period']; - } - } else { - $resultData = []; - } - } + foreach ($results as $result) { + $resultId = $result['id']; + $resultIndicators = Arr::get($result, 'indicators', []); + + if (empty($resultIndicators)) { + /* + * Indicator is mandatory. + * Setting $resultData[i] to empty array in-case indicator doesn't exist because: + * This is equivalent to doing an early return, no need to continue preparing indicator data or for this result. + * Checking if $resultData contains an empty [] in it will give us result completion faster than calculating if indicator for said result is complete + */ + $resultData[$resultId] = []; + continue; + } + + $resultData[$resultId] = Arr::get($result, 'result', []); + $resultReference = Arr::get($resultData[$resultId], 'reference'); + + foreach ($resultIndicators as $indicator) { + $indicatorId = $indicator['id']; + $indicatorId = "$resultId.$indicatorId"; + $indicatorValue = Arr::get($indicator, 'indicator', []); + + if (is_array_value_empty(Arr::get($indicatorValue, 'reference'))) { + $indicatorValue['reference'] = $resultReference; } else { - $resultData = []; + $resultData[$resultId]['reference'] = Arr::get($indicatorValue, 'reference'); + } + + $indicatorData[$indicatorId] = $indicatorValue; + $periods = Arr::get($indicator, 'periods', []); + + if (!empty($periods)) { + foreach ($periods as $period) { + $periodData[] = Arr::get($period, 'period', []); + } } } } @@ -855,15 +860,22 @@ public function isResultElementCompleted($activity): bool { [$resultData, $indicatorData, $periodData] = $this->getFormattedResults($activity); - if ( - (is_variable_null($periodData) || !$this->isPeriodElementCompleted($periodData)) || !$this->isResultElementDataCompleted($resultData) - || (is_variable_null($indicatorData) || !$this->isIndicatorElementCompleted($indicatorData)) - || (is_variable_null($resultData)) - ) { + if (is_variable_null($resultData) || count($resultData) < 1) { return false; } - return true; + $periodExists = is_array($periodData) && count($periodData) > 0; + $indicatorExists = is_array($indicatorData) && count($indicatorData) > 0; + + if ($periodExists) { + return $this->isPeriodElementCompleted($periodData) && $this->isIndicatorElementCompleted($indicatorData) && $this->isResultElementDataCompleted($resultData); + } + + if ($indicatorExists) { + return $this->isIndicatorElementCompleted($indicatorData) && $this->isResultElementDataCompleted($resultData); + } + + return false; } /** diff --git a/app/IATI/Services/ImportActivity/ImportXmlService.php b/app/IATI/Services/ImportActivity/ImportXmlService.php index 02d2cc7af..d107bee32 100644 --- a/app/IATI/Services/ImportActivity/ImportXmlService.php +++ b/app/IATI/Services/ImportActivity/ImportXmlService.php @@ -4,12 +4,14 @@ namespace App\IATI\Services\ImportActivity; +use App\IATI\Models\Activity\Activity; use App\IATI\Repositories\Activity\ActivityRepository; use App\IATI\Repositories\Activity\IndicatorRepository; use App\IATI\Repositories\Activity\PeriodRepository; use App\IATI\Repositories\Activity\ResultRepository; use App\IATI\Repositories\Activity\TransactionRepository; use App\IATI\Repositories\Import\ImportActivityErrorRepository; +use App\IATI\Services\ElementCompleteService; use App\IATI\Traits\FillDefaultValuesTrait; use App\XmlImporter\Events\XmlWasUploaded; use App\XmlImporter\Foundation\Support\Providers\XmlServiceProvider; @@ -19,7 +21,6 @@ use Illuminate\Support\Arr; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Event; -use Illuminate\Support\Facades\Storage; use Psr\Log\LoggerInterface; use Symfony\Component\HttpFoundation\File\UploadedFile; @@ -100,6 +101,11 @@ class ImportXmlService */ protected ImportActivityErrorRepository $importActivityErrorRepo; + /** + * @var ElementCompleteService + */ + protected ElementCompleteService $elementCompleteService; + /** * XmlImportManager constructor. * @@ -114,6 +120,7 @@ class ImportXmlService * @param LoggerInterface $logger * @param Filesystem $filesystem * @param XmlService $xmlService + * @param ElementCompleteService $elementCompleteService */ public function __construct( XmlServiceProvider $xmlServiceProvider, @@ -126,7 +133,8 @@ public function __construct( XmlProcessor $xmlProcessor, LoggerInterface $logger, Filesystem $filesystem, - XmlService $xmlService + XmlService $xmlService, + ElementCompleteService $elementCompleteService, ) { $this->xmlServiceProvider = $xmlServiceProvider; $this->xmlProcessor = $xmlProcessor; @@ -142,6 +150,7 @@ public function __construct( $this->xml_file_storage_path = env('XML_FILE_STORAGE_PATH', 'XmlImporter/file'); $this->xml_data_storage_path = env('XML_DATA_STORAGE_PATH', 'XmlImporter/tmp'); $this->csv_data_storage_path = env('CSV_DATA_STORAGE_PATH', 'CsvImporter/tmp'); + $this->elementCompleteService = $elementCompleteService; } /** @@ -204,6 +213,7 @@ public function create($activities): bool $this->resultRepository->deleteResult($oldActivity->id); $this->saveTransactions(Arr::get($activityData, 'transactions'), $oldActivity->id, $defaultFieldValues); $this->saveResults(Arr::get($activityData, 'result'), $oldActivity->id, $defaultFieldValues); + $this->refreshActivityElementStatusForResult($oldActivity); if (!empty($activity['errors'])) { $this->importActivityErrorRepo->updateOrCreateError($oldActivity->id, $activity['errors']); @@ -219,6 +229,7 @@ public function create($activities): bool $this->saveTransactions(Arr::get($activityData, 'transactions'), $storeActivity->id, $defaultFieldValues); $this->saveResults(Arr::get($activityData, 'result'), $storeActivity->id, $defaultFieldValues); + $this->refreshActivityElementStatusForResult($storeActivity); if (!empty($activity['errors'])) { $this->importActivityErrorRepo->updateOrCreateError($storeActivity->id, $activity['errors']); @@ -400,4 +411,18 @@ protected function dbIatiIdentifiers($org_id): array { return Arr::flatten($this->activityRepository->getActivityIdentifiers($org_id)->toArray()); } + + /** + * Since we are doing upsert on results for both creation and update, need to manually check if result is complete. + * + * @throws \JsonException + */ + private function refreshActivityElementStatusForResult(Activity $activity): void + { + $elementStatus = $activity->element_status; + $resultStatus = $this->elementCompleteService->isResultElementCompleted($activity); + $elementStatus['result'] = $resultStatus; + + $this->activityRepository->update($activity->id, ['element_status' => $elementStatus]); + } } diff --git a/resources/assets/js/views/activity/elements/Result.vue b/resources/assets/js/views/activity/elements/Result.vue index 31ba7b775..f23d43409 100644 --- a/resources/assets/js/views/activity/elements/Result.vue +++ b/resources/assets/js/views/activity/elements/Result.vue @@ -17,9 +17,10 @@ 'text-crimson-50': !completed, }" > - . - completed - not completed + + . + not completed +
@@ -132,7 +133,7 @@
diff --git a/resources/assets/js/views/activity/indicators/IndicatorDetail.vue b/resources/assets/js/views/activity/indicators/IndicatorDetail.vue index f179f4c42..33b90cd28 100644 --- a/resources/assets/js/views/activity/indicators/IndicatorDetail.vue +++ b/resources/assets/js/views/activity/indicators/IndicatorDetail.vue @@ -119,6 +119,12 @@ {{ r }} + + * + @@ -416,6 +422,11 @@ export default defineComponent({ return positionY.value === 0; }); + const isMandatoryForIndicator = (elementOrAttribute: string) => { + const mandatoryElementOrAttribute = ['measure', 'title']; + + return mandatoryElementOrAttribute.includes(elementOrAttribute); + }; onUnmounted(() => { window.removeEventListener('scroll', handleScroll); window.removeEventListener('resize', calcWidth); @@ -442,6 +453,7 @@ export default defineComponent({ showSidebar, istopVisible, countDocumentLink, + isMandatoryForIndicator, }; }, }); diff --git a/resources/assets/js/views/activity/results/ResultDetail.vue b/resources/assets/js/views/activity/results/ResultDetail.vue index 6ac670948..7e31278d0 100644 --- a/resources/assets/js/views/activity/results/ResultDetail.vue +++ b/resources/assets/js/views/activity/results/ResultDetail.vue @@ -79,7 +79,7 @@
  • - indicator + indicator *
  • @@ -89,7 +89,7 @@ class="border border-dashed border-n-40" > - add indicator + add indicator *
  • @@ -105,12 +105,15 @@ {{ r }} + *
  • - indicator + indicator *
  • @@ -120,7 +123,7 @@ class="border border-dashed border-n-40" > - add indicator + add indicator *
  • @@ -167,7 +170,8 @@ class="add_indicator flex w-full rounded border border-dashed border-n-40 bg-white px-4 py-3 text-xs leading-normal" >
    - You haven't added any indicator yet. + You haven't added any Indicator yet. Indicator(s) are required to + complete Result.
    { + const mandatoryElementOrAttribute = ['type', 'title', 'indicator']; + + return mandatoryElementOrAttribute.includes(elementOrAttribute); + }; + watch( () => showSidebar.value, (sidebar) => { @@ -339,6 +349,7 @@ export default defineComponent({ toastData, showSidebar, istopVisible, + isMandatoryForResult, }; }, }); diff --git a/resources/assets/sass/component/_input.scss b/resources/assets/sass/component/_input.scss index e2c936663..0eef68c73 100644 --- a/resources/assets/sass/component/_input.scss +++ b/resources/assets/sass/component/_input.scss @@ -256,41 +256,41 @@ label { } select.select2.default-value-indicator - + .select2 - .selection - .select2-selection:not(:focus) { ++ .select2 +.selection +.select2-selection:not(:focus) { border: 2px solid #3f9a7c; background-color: #3f9a7c15; } select.select2.default-value-indicator - + .select2 - .selection - .select2-selection:not(:focus) { ++ .select2 +.selection +.select2-selection:not(:focus) { border: 2px solid #3f9a7c; background-color: #3f9a7c15; } select.select2.default-value-indicator - + .select2 - .selection - .select2-selection - .select2-selection__placeholder { ++ .select2 +.selection +.select2-selection +.select2-selection__placeholder { color: var(--bluecoral-50); } select.select2.default-value-indicator - + .select2.select2-container--open - .selection - .select2-selection { ++ .select2.select2-container--open +.selection +.select2-selection { border: 1px solid #a6b5ba; background-color: transparent; } select.select2.default-value-indicator - + .select2 - .selection - .select2-selection.select2-selection--clearable { ++ .select2 +.selection +.select2-selection.select2-selection--clearable { border: 1px solid #a6b5ba; background-color: transparent; } diff --git a/tests/Feature/Element/ResultCompleteTest.php b/tests/Feature/Element/ResultCompleteTest.php index bf31c9ad5..55ef3852b 100644 --- a/tests/Feature/Element/ResultCompleteTest.php +++ b/tests/Feature/Element/ResultCompleteTest.php @@ -82,11 +82,11 @@ public function test_indicator_mandatory_attributes(): void public function test_indicator_mandatory_sub_elements(): void { $this->element = 'indicator'; - $this->test_mandatory_sub_elements($this->element, [ - 'document_link' => ['url', 'format'], - 'reference' => ['vocabulary'], - 'baseline' => ['year'], - ]); + /* + * Change source: https://github.com/younginnovations/iatipublisher/issues/1542 + * Only title is a mandatory sub elements. + */ + $this->test_mandatory_sub_elements($this->element, []); } /** @@ -128,10 +128,11 @@ public function test_result_mandatory_attributes(): void public function test_result_mandatory_sub_elements(): void { $this->element = 'result'; - $this->test_mandatory_sub_elements($this->element, [ - 'document_link' => ['url', 'format'], - 'reference' => ['vocabulary', 'code'], - ]); + /* + * Change source: https://github.com/younginnovations/iatipublisher/issues/1542 + * Only title and type are mandatory sub elements. + */ + $this->test_mandatory_sub_elements($this->element, []); } /**