Skip to content

[BI-1761] Error message with the backend code#319

Merged
dmeidlin merged 5 commits intodevelopfrom
feature/BI-1761
Jan 4, 2024
Merged

[BI-1761] Error message with the backend code#319
dmeidlin merged 5 commits intodevelopfrom
feature/BI-1761

Conversation

@dmeidlin
Copy link
Contributor

@dmeidlin dmeidlin commented Dec 6, 2023

Description

Story: BI-1761

updated the error message for missing observation unit ids in experiment file import.

Dependencies

none

Testing

run all tests in ExperimentFileImportTest

Checklist:

  • I have performed a self-review of my own code
  • I have tested my code and ensured it meets the acceptance criteria of the story
  • I have tested that my code works with both the brapi-java-server and BreedBase
  • I have create/modified unit tests to cover this change
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to documentation
  • I have run TAF: <please include a link to TAF run>

@dmeidlin
Copy link
Contributor Author

dmeidlin commented Dec 7, 2023

updated the message after confirming with Shawn

"If you’re trying to add these units to the experiment, please create a new environment" +
" with all appropriate experiment units (NOTE: this will generate new Observation Unit Ids " +
"for each experiment unit).";
private static final String MISSING_OBS_UNIT_ID_ERROR = "Experimental entities are missing ObsUnitIDs. You must append file with the appropriate ObsUnitIDs or specify a new environment for these entities to proceed.";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The source of truth reads,Error detected in file, XXX.xls. Experimental entities are missing ObsUnitIDs. Import cannot proceed.

The current error message reads,Error(s) detected in file, XXX.xls. Experimental entities are missing ObsUnitIDs. You must append file with the appropriate ObsUnitIDs or specify a new environment for these entities to proceed.. Import cannot proceed.

I recommend changing MISSING_OBS_UNIT_ID_ERROR to "Experimental entities are missing ObsUnitIDs"

NOTE: there is no period (.) at the end of this string. It is added by the javascript code.

[ I do like your wording, at the very least, please change MISSING_OBS_UNIT_ID_ERROR to "Experimental entities are missing ObsUnitIDs. You must append file with the appropriate ObsUnitIDs or specify a new environment" ( and leave off " for these entities to proceed." ) ]

"If you’re trying to add these units to the experiment, please create a new environment" +
" with all appropriate experiment units (NOTE: this will generate new Observation Unit Ids " +
"for each experiment unit).";
private static final String MISSING_OBS_UNIT_ID_ERROR = "Experimental entities are missing ObsUnitIDs. You must append file with the appropriate ObsUnitIDs or specify a new environment for these entities to proceed";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private static final String MISSING_OBS_UNIT_ID_ERROR = "Experimental entities are missing ObsUnitIDs. You must append file with the appropriate ObsUnitIDs or specify a new environment for these entities to proceed";
private static final String MISSING_OBS_UNIT_ID_ERROR = "Experimental entities are missing ObsUnitIDs";

This will be interpolated into "Error detected in file, ${fileName}. ${backendErrorMessage}. Import cannot proceed." by bi-web, to produce the desired message, "Error detected in file, XXX.xls. Experimental entities are missing ObsUnitIDs. Import cannot proceed.". See row 15 in the source of truth.

assertEquals(422, result.getAsJsonObject("progress").get("statuscode").getAsInt(), "Returned data: " + result);

assertTrue(result.getAsJsonObject("progress").get("message").getAsString().startsWith("Cannot create new observation unit"));
assertTrue(result.getAsJsonObject("progress").get("message").getAsString().startsWith("Experimental entities are missing ObsUnitIDs."));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assertTrue(result.getAsJsonObject("progress").get("message").getAsString().startsWith("Experimental entities are missing ObsUnitIDs."));
assertTrue(result.getAsJsonObject("progress").get("message").getAsString().startsWith("Experimental entities are missing ObsUnitIDs"));

Remove period.

@dmeidlin dmeidlin requested a review from mlm483 December 20, 2023 17:57
@nickpalladino nickpalladino requested review from nickpalladino and removed request for mlm483 December 21, 2023 18:10
@dmeidlin dmeidlin merged commit c11b492 into develop Jan 4, 2024
@dmeidlin dmeidlin deleted the feature/BI-1761 branch January 4, 2024 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants