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

Add Harvest Report to the Barn Kit #418

Closed
braughtg opened this issue Mar 7, 2022 · 9 comments
Closed

Add Harvest Report to the Barn Kit #418

braughtg opened this issue Mar 7, 2022 · 9 comments
Labels
new feature A new user visible feature to be added Reserved Issue created and reserved for use in a course.

Comments

@braughtg
Copy link
Member

braughtg commented Mar 7, 2022

A report can be generated showing all of the harvests that have been done.

The functionality of the FarmData2 Harvest Report will be similar to the Harvest Report in the original FarmData, which can be seen here:

https://farmdata.dickinson.edu/Harvest/harvestReport.php?tab=harvest:harvestReport

In FarmData2 this Harvest Report will appear in the Barn Kit tab and will allow the user to generate a report that displays information about the requested harvest events. When generating and displaying this report, the style and user experience should be similar to:

  • The examples that appear in the FD2 Example tabs
    • Their defining code is in the html files in the directory: farmdata2_modules/fd2_tabs/fd2_example
  • The Seeding Report form that appears in the Barn Kit.
    • Its defining code is in the file: farmdata2_modules/fd2_tabs/fd2_barn_kit/seedingReport.html

Data Model Notes:

  • All Harvest Logs have a Planting Asset associated with them.
    • The Planting Asset represents the crop that was harvested.

Information about the Harvest Logs and Planting Assets:

  • General documentation for the sample database: https://github.com/DickinsonCollege/FarmData2/tree/main/docker/sampleDB
    • API Calls in that document show how to retrieve existing logs and assets that can be used to understand the JSON structures and their contents.
  • The JSON Structures used to create the Logs and Assets in the sample database can be found in the python files in the docker/sampleDB directory:
    • The JSON structure for a Planting Asset can be found in the file: docker/sampleDB/addDirectSeeding.py
    • The JSON structure for a Harvest Log and the process of creating one can be found in the file: docker/sampleDB/addHarvests.py
  • Information about the API calls used to create Logs and Assets using the JSON structures can be found:
    • In the file: docker/sampleDB/utils.py
    • In section of CONTRIBUTING.md that points to the FarmOS API documentation.
@braughtg braughtg added new feature A new user visible feature to be added Reserved Issue created and reserved for use in a course. labels Mar 7, 2022
@maitnngo2002
Copy link

maitnngo2002 commented Mar 23, 2022

Hi Professor Braught,

Do you think adding the Download Harvest Report feature would be helpful to the farmworkers?

@evanwong1020
Copy link

Hi Professor Braught,

Do you think adding the Download Harvest Report feature would be helpful to the farmworkers?

We have a consumer who would benefit from a feature like this, since it allows for him to save a local copy of the report and save it for easy access.

@braughtg
Copy link
Member Author

Do you think adding the Download Harvest Report feature would be helpful to the farmworkers?

We have a consumer who would benefit from a feature like this, since it allows for him to save a local copy of the report and save it for easy access.

Ultimately there should be a CSV download button for all of the reports. For the purposes of COMP 290 work I would make this a low priority. The current design plan for FarmData2 is that there will be a Vue component that manages the download. This component when complete will then be added to each of the pages. That way each page will not have to implement their own version of the download. There is an issue open issue #290 with an associated draft PR #313 that begin this work. If you get to the point of wanting to work on the CSV download check those out and I will be happy to have further conversations about how to proceed.

@johnmaccormick
Copy link
Collaborator

If you get a login error at the first link in the original post, you need to first visit https://farmdata.dickinson.edu/guest.php to log in as a guest.

@maitnngo2002
Copy link

Hi Professor Braught,

Our team has a question: How could we identify if a user is an admin, worker, or guest? So that if he/she is an admin or worker, we could let him/her to edit or delete the harvests?

@braughtg
Copy link
Member Author

braughtg commented Apr 22, 2022

You raise a good question here. The short answer to your question is that who is permitted to do what is controlled through permissions configured on the server side. So if a user attempts an operation they are not permitted to, it will fail. So you do not need to worry about preventing users from attempting operations they do not have permissions for at this point.

Of course, ideally the UI will only show the buttons that the current user has permissions to perform. The exact details of which users will be able to perform which operations has not yet been settled so implementation of this is a bit premature. For now, please follow the example set by the Seeding Report.

A new issue #447 has been opened to ensure that this capability is addressed in the future.

@maitnngo2002
Copy link

maitnngo2002 commented May 4, 2022

Current status of the issue:
We ran into problems of Vue.js cycle of creating components when we enable the users to choose date, crop and field at the same time. Therefore, now we instead let the user choose the date range first. Then, we fetch all the harvest logs in that date range and display them. Then, the drop-down lists for Crops and Fields will appear so that users could filter the harvest logs for specific Crops and Fields as they want to.

The issue remaining is that when we implement the Edit and Delete features for harvest logs, it works on the front-end side but the database does not receive the updated data that the users (admin/workers) have modified/deleted.

@braughtg
Copy link
Member Author

braughtg commented May 4, 2022

we fetch all the harvest logs in that date range and display them. Then, the drop-down lists for Crops and Fields will appear so that users could filter the harvest logs for specific Crops and Fields as they want to.

This is exactly the right way to do it! Well done.

The issue remaining is that when we implement the Edit and Delete features for harvest logs, it works on the front-end side but the database does not receive the updated data that the users (admin/workers) have modified/deleted.

You'll just need to connect in calls to the functions in FarmOSAPI.js to update or delete the logs. You can find the documentation for those functions by opening the following file in your browser:

@braughtg
Copy link
Member Author

Closed as the course associated with this issue has concluded. It will be preserved in the project history as a basis for implementation of this feature in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature A new user visible feature to be added Reserved Issue created and reserved for use in a course.
Projects
None yet
Development

No branches or pull requests

4 participants