Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transplanting Input Form #532

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

FutzMonitor
Copy link
Collaborator

@FutzMonitor FutzMonitor commented Jul 12, 2022

Pull Request Description

Closes #526. This PR hopes to add a Transplanting Input form sub-tab to the Field Kit module. When you visit the page, a table with planting assets exclusively in tray seeded areas will appear and clicking a button will bring up the transplanting input form pre-populated with the information of that asset's tray seeding log. From there the page behaves the same as the seeding report minus user editing. The user has to submit a transplanting log solely from the pre-populated values done automatically between the table and the input form (save for some specifics like labor, comments, and the amount planted). This is to address the possibility of users creating multiple logs for the same crop in the same area.

This PR is not ready to be merged into upstream/main
Here are a list of things that need to be accomplished before this PR is ready to be reviewed:

  • Complete the functionality of the table that displays the planting assets
  • Complete the Transplanting Input form's functionality (API calls, necessary functions, etc.)
  • Complete the communication between these two features
  • Complete the testing file for this page
  • Cleanliness: spaces, indentation, and consistency
  • Change the first commit and co-author original authors of the base code (details for that here)

Licensing Certification

FarmData2 is a Free Cultural Work and all accepted contributions are licensed as described in the LICENSE.md file. This requires that the contributor holds the rights to do so. By submitting this pull request I certify that I satisfy the terms of the Developer Certificate of Origin for its contents.

1. Added the transplanting input form to the module's file.
2. Added the transplanting page to the field kit module.
1. Removed some spaces from the page.
2. Added an empty test file
…Form

1. Removed Comments from Data and put it in its own category.
2. Replaced all inputs with RegexInputs
3. Added some new methods to update the values inside of the Vue data
4. Brought in the map to verify valid inputs
5. Added the alert banners fo successful submission or cancel
6. Added the cancel method
(Still needs to be looked at heavily. Up until this point I've frankly been copy and pasting things from the Seeding Report to make things consistent. Things that may be unnecessary may have slipped in).
1. Transplanting Input Form is essentially complete. The API calls and some cleaning up have to be done.
1. Added a table that will be populated by planting assets that are in areas where exclusively tray seeding occurs.
2. Added some code for caching the planting assets into the page because it currently takes 5-8 seconds for the table to generate as it waits for the assets to come in.
3. Added filter behavior, but it currently doesn't work.
@braughtg
Copy link
Member

@FutzMonitor said "Currently it takes a good five seconds for the assets to load in. I believe it'll be worthwhile to cache them, but I'm aware that I'm going to have to implement something to remove it from the local cache if that asset is no longer in the list. Is that possible?"

Caching is one idea, and would be useful once records have been fetched. We might also allow the user to set the crop and/or area before fetching the list. That would reduce the number of records to be fetched and should speed things up. So the form might include a button to fetch the assets. It would then do that based on the values in the dropdowns indicating the selected crop and/or area. Thoughts?

@FutzMonitor
Copy link
Collaborator Author

@FutzMonitor said "Currently it takes a good five seconds for the assets to load in. I believe it'll be worthwhile to cache them, but I'm aware that I'm going to have to implement something to remove it from the local cache if that asset is no longer in the list. Is that possible?"

Caching is one idea, and would be useful once records have been fetched. We might also allow the user to set the crop and/or area before fetching the list. That would reduce the number of records to be fetched and should speed things up. So the form might include a button to fetch the assets. It would then do that based on the values in the dropdowns indicating the selected crop and/or area. Thoughts?

Would this be similar to the Seeding Report using dates to generate the report table?

@braughtg
Copy link
Member

Would this be similar to the Seeding Report using dates to generate the report table?

Yes it would be similar to that if this seems a reasonable way to go. We could try it and experiment with it and see how it works and feels as a user.

@FutzMonitor
Copy link
Collaborator Author

Would this be similar to the Seeding Report using dates to generate the report table?

Yes it would be similar to that if this seems a reasonable way to go. We could try it and experiment with it and see how it works and feels as a user.

The original plan that I had in my mind is that I would have a sort of generate report bar, similar to the Seeding Report, with the crop and area dropdown. A generate button would light up when a selection has been made, and it would generate a table of assets fitting the criteria specified by the user. When the button was clicked, it would pass the selections to a method that would make an API request for all planting assets that matches that criteria. The problem is that is seems that you can't go into the arrays containing the information for the crop and area using an API request:

image
image

The other implementation would have to just generate a report table when the user visits the page of all the planting assets that are currently in the ground. This was previously going to be done using the done data to determine if the planting asset has been harvested or not. Unfortunately, that cannot be done because that data doesn't exist for the planting asset. If it did exist, we could call all those assets and cache them and simply update that cache by removing assets that have been marked as done. However, without it, we basically have to cache all assets which will grow more and more inefficient and cost space as the assets grow during the lifetime of a farm.

@braughtg
Copy link
Member

braughtg commented Dec 24, 2022

With the reorganization of the code by PR #602 this PR will ultimately need to be reworked to place the input form in the proper location.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transplanting Input Form To Log Transplanting of Crops
2 participants