Skip to content

Date and Crop should be "sticky" after submission of Harvest form #273

@braughtg

Description

@braughtg

Feature

The value in the "Date" and "Crop" inputs should not be reset after the harvest form is submitted. For example, if the harvest form is filled out and submitted for "11/19/2025" and "BROCCOLI" then after the sumit the the "Date" input should remain "11/19/2025" regardless of the current date and the "Crop" input should remain "BROCCOLI". However, the plant selected in the table, the "Quantity", the "Harvest Unit" and the "Comment" should all be reset (as they are now). Note that clicking the "Reset" button should still reset all fields, including the "Date" and the "Crop".

An E2E test should be added that confirms that the "Date" and "Crop" inputs are "Sticky" when the form is submitted.

Rationale

Often when a particular type of crop is being harvested it might be harvested from multiple locations (e.g. BROCCOLI might be harvested from both location A and B in different amounts). Because this is a common operation, it can be completed more quickly if the crop does not need to be re-selected for each harvest. If a different crop is being harvested, it is just as convenient to select that crop.

Similarly, if a harvest record is being created for a date different than the current date, it is often because not all harvests were recorded on some particular date. Not resetting the date after a submit, makes it more efficient to enter a collection of harvests that occurred on a given date in rapid succession.

Alternatives

As the form works now, the user can simply select the same crop to be harvested again. This works fine, but is not as efficient in the common use case described above.

Additional context

The other FarmData2 forms also have this notion of fields that are "Sticky" after submission. For example, consider the "Tray Seeding" form:

Image

In this form, the "Date" and "Location" fields are sticky. Thus, after submission, this form is mostly reset, but the "Date" and the "Location" are not. They remain whatever they had been set to.

Image

The implementation of the "Stick Reset" for the Harvest form should be similar to the implementation in the other FarmData2 forms. Studying the code in the modules/farm_fd2/src/entrypoints/tray_seeding/App.vue file to understand how its "Sticky Reset" work will be helpful.

The E2E tests can be run with: test.bash --fd2 --live --e2e --glob=modules/farm_fd2/**/harvest/*.e2e.cy.js --gui

Metadata

Metadata

Labels

EasierAn easier issue.ProjectAn issue for the project work part of the course.enhancementNew feature or requestui/uxIssue related to the user interface or the user experience.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions