diff --git a/archive_api/migrations/0030_alter_dataset_doe_funding_contract_numbers_and_more.py b/archive_api/migrations/0030_alter_dataset_doe_funding_contract_numbers_and_more.py new file mode 100644 index 00000000..05311f84 --- /dev/null +++ b/archive_api/migrations/0030_alter_dataset_doe_funding_contract_numbers_and_more.py @@ -0,0 +1,25 @@ +# Generated by Django 4.2.2 on 2024-05-30 15:46 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('archive_api', '0029_alter_dataset_funding_organizations_and_more'), + ] + + def update_null_fields(apps, schema_editor): + Dataset = apps.get_model('archive_api', 'dataset') + for dataset in Dataset.objects.filter(doe_funding_contract_numbers=None): + dataset.doe_funding_contract_numbers = 'DE-AC02-05CH11231' + dataset.save() + + def reverse_update_null_fields(apps, schema_editor): + # It is ok not to reverse + pass + + operations = [ + migrations.RunPython(update_null_fields, reverse_update_null_fields), + + ] diff --git a/archive_api/models.py b/archive_api/models.py index ee9415b9..fb63fc50 100644 --- a/archive_api/models.py +++ b/archive_api/models.py @@ -467,6 +467,15 @@ def save(self, *args, **kwargs): self.modified_date = kwargs["modified_date"] del kwargs['modified_date'] + # prepend the default contract number if not set + if self.doe_funding_contract_numbers is not None and self.doe_funding_contract_numbers.strip() != "": + if "AC02-05CH11231" not in self.doe_funding_contract_numbers and \ + "AC0205CH11231" not in self.doe_funding_contract_numbers: + self.doe_funding_contract_numbers = \ + "DE-AC02-05CH11231, " + self.doe_funding_contract_numbers + else: + self.doe_funding_contract_numbers = "DE-AC02-05CH11231" + super(DataSet, self).save(*args, **kwargs) def __str__(self): diff --git a/archive_api/tests/test_api.py b/archive_api/tests/test_api.py index ddfb6b8c..71f1110c 100644 --- a/archive_api/tests/test_api.py +++ b/archive_api/tests/test_api.py @@ -193,7 +193,7 @@ def test_client_post(self): self.assertEqual(value['sites'], []) self.assertEqual(value['managed_by'], 'auser') self.assertEqual(value['end_date'], None) - self.assertEqual(value['doe_funding_contract_numbers'], None) + self.assertEqual(value['doe_funding_contract_numbers'], 'DE-AC02-05CH11231') self.assertEqual(value['funding_organizations'], None) self.assertEqual(value['description'], 'Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?') self.assertEqual(value['additional_access_information'], None) @@ -463,7 +463,7 @@ def test_admin_approve_workflow(self): self.assertEqual(value["qaqc_method_description"], "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?") self.assertEqual(value["ngee_tropics_resources"], True) self.assertEqual(value["funding_organizations"], "The funding organizations for my dataset") - self.assertEqual(value["doe_funding_contract_numbers"], "") + self.assertEqual(value["doe_funding_contract_numbers"], "DE-AC02-05CH11231") self.assertEqual(value["acknowledgement"], "") self.assertEqual(value["reference"], "") self.assertEqual(value["access_level"], "0") diff --git a/ui/static/js/app.js b/ui/static/js/app.js index bb11119a..db1aa22b 100644 --- a/ui/static/js/app.js +++ b/ui/static/js/app.js @@ -236,7 +236,7 @@ $(document).ready(function () { } }); - $.getJSON("static/js/metadata/dataset.json?v=20240329", function (data) { + $.getJSON("static/js/metadata/dataset.json?v=202405301", function (data) { templates.datasets = data; createEditForm('datasets'); }); diff --git a/ui/static/js/metadata/dataset.json b/ui/static/js/metadata/dataset.json index ea9f0c77..15a37739 100644 --- a/ui/static/js/metadata/dataset.json +++ b/ui/static/js/metadata/dataset.json @@ -30,7 +30,7 @@ "label": "Dataset Description", "sequence": 4, "multiple": false, - "tooltip": "
Dataset tooltip and overview. This should read as an abstract for the dataset, and provide users with adequate information about what the dataset contains, and how to use it. Include details on what data what, when and where data was collected, and if any data processing was done.
E.g.: Raw output from the data logger connected to 9 sapflow and 5 soil moisture sensors are provided in xxx.dat. The metadata file (BR-Ma2 E-field log_20160501.xls) has information on locations where the sensors were installed, and other installation/maintenance details. No data processing or QA/QC was done on the raw datasets. Processed datasets will be uploaded separately. Contact janedoe@lbl.gov if you need to use this dataset for additional information. This field has a limit of 4,000 characters and must have at least 100 words.
" + "tooltip": "Dataset description and overview. This should read as an abstract for the dataset, and provide users with adequate information about what the dataset contains, and how to use it. Include details on what data what, when and where data was collected, and if any data processing was done.
E.g.: Raw output from the data logger connected to 9 sapflow and 5 soil moisture sensors are provided in xxx.dat. The metadata file (BR-Ma2 E-field log_20160501.xls) has information on locations where the sensors were installed, and other installation/maintenance details. No data processing or QA/QC was done on the raw datasets. Processed datasets will be uploaded separately. Contact janedoe@lbl.gov if you need to use this dataset for additional information. This field has a limit of 4,000 characters and must have at least 100 words.
" }, "sites": { "type": "reference_list", @@ -136,14 +136,14 @@ "multiple": false, "tooltip": "Indicate if any QA/QC has been performed on the dataset. Choices are None, Provisional QA-QC, Final QA-QC.
" }, - "qaqc_method_tooltip": { + "qaqc_method_description": { "type": "string", "required": true, "read_only": false, "label": "Method Description", "sequence": 14, "multiple": false, - "tooltip": "Information about the methods employed in collecting or generating a data set or other resource. These include tooltips of sampling or experimental procedures, data QA/QC, processing and synthesis.
" + "tooltip": "Information about the methods employed in collecting or generating a data set or other resource. These include descriptions of sampling or experimental procedures, data QA/QC, processing and synthesis.
" }, "ngee_tropics_resources": { "type": "boolean", @@ -170,9 +170,11 @@ "required": false, "read_only": false, "label": "Dataset Funding Contract Number(s)", + "description": "(NGEE-Tropics is assumed by default through LBNL contract)
DE-AC02-05CH11231 will be automatically prepended
", "sequence": 17, "multiple": false, - "tooltip": "List the numbers of any DOE contract under which the work was funded. If no DOE funding for this dataset or field is empty set as 'NONE'. If the dataset is a result of a joint effort between two or more DOE Site/Facility Management Contractors, etc., additional DOE contract numbers may be entered. The 'DE' should not be included as a part of the number. This field has a limit of 100 characters.
" + "tooltip": "List the numbers of any DOE contract under which the work was funded. If no DOE funding for this dataset or field is empty set as 'DE-AC02-05CH11231'. If the dataset is a result of a joint effort between two or more DOE Site/Facility Management Contractors, etc., additional DOE contract numbers may be entered. This field has a limit of 100 characters.
", + "placeholder": "Add additional contract numbers other than the default." }, "acknowledgement": { "type": "string", @@ -199,7 +201,7 @@ "label": "Additional Information about Dataset Reference(s)", "sequence": 20, "multiple": false, - "tooltip": "Brief tooltip of dataset reference (e,g, paper) relevance, relationship with this dataset or other comments. This field has a limit of 2,255 characters.
" + "tooltip": "Brief description of dataset reference (e,g, paper) relevance, relationship with this dataset or other comments. This field has a limit of 2,255 characters.
" }, "access_level": { "type": "choice",