-
Notifications
You must be signed in to change notification settings - Fork 15
Description
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:
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.
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