Isaiahensley / Aquatic-RIG

Our Senior Capstone project focuses on developing a Streamlit website dedicated to the visualization of aquatic NetCDF datasets. Aquatic data is inherently complex, being both spatiotemporal—capturing information over different times and space. Our website will let users alternate through time and depth to give comprehensive visuals for their data.
https://aquaticrig-develop.streamlit.app/
0 stars 1 forks source link

Testing feedback drop box #86

Closed spaude11 closed 7 months ago

spaude11 commented 8 months ago

Description: We need to make sure that users can submit answers to our feedback page questions and they get sent to the DropBox we set up.

Expected Outcome: All submissions should be sent to the DropBox and can be viewed by our team members.

Additional context After confirming this works as intended, we will want to save the submissions in a .txt file instead as an image.

spaude11 commented 8 months ago

Description: The objective of this issue was to first integrate the method for sending the feedback files to dropbox. Report issues that we will encounter while integrating the function. I came across few issues, I have provided the details below:

  1. The first issue was I was not able to send multiple files into dropbox.
  2. The pdf file I generated as not readable in dropbox.

Steps to reproduce: Run the file in local host. Write the feedback and submit it. If there are no errors then file will be created and sent to the dropbox. If there are issues, the error will be shown below.

FeedbackPageWorking Error for DropBox integration

Expected Vs Actual Behaviour: For few times, the file was created and sent to dropbox. But I wanted to make some changes on how the files will be stored. I made some change and later some part of code starts to error. The expected behavior is: PDF file should be generated and sent to the dropbox with date and time format in each file for identification Actual Behaviour: The files were created, at first the file was replacing that file we had in dropbox but later when I made some changes to generate the file name according to time stamp, It started erroring.


Code Snippets:

` pdf_filename, pdf_content = generate_pdf(feedback_data)

    dropbox_logger = DropboxLogger(DROPBOX_ACCESS_TOKEN)
    dropbox_logger.upload_file(pdf_content, "/Apps/Feedbackfiles/feedback_report.pdf", st)

    # Display success message
    st.markdown("### Generated PDF:")
    st.success("Thank you for your feedback! 🚀")`

Environment Details: DropBox, Pycharm, Github, Streamlit


For Issue Resolution:

I will make some changes in the code again for streamlit to generate and send the file into dropbox without erroring in naming.

spaude11 commented 8 months ago

Descritption: The objective of this issue was to first integrate the method for sending the feedback files to dropbox. I came across one issue while sending the file to the dropbox.

Steps to reproduce: Run the file in local host. Write the feedback and submit it. If there are no errors then file will be created and sent to the dropbox. If there are issues, the error will be shown below.

Expected Vs Actual Behaviour: The code was supposed to send the feedback file into the directory. I gave a unique file name based on the user's email address.

But firstly it was not able to generate the file. Firstly the errror was it wasn't able to generate file but later the file was not able to send in the drop box.

Screenshot 2024-03-05 at 8 28 13 pm

Code Snippets:

            def upload_file(self, file_data, file_name, st, user_email):
              try:
             # Construct the new filename with the user's email
            new_file_name = f"feedback_report_{user_email}.pdf"

            # Upload the file to Dropbox
            upload_path = f'/Apps/Feedbackfiles/{new_file_name}'
            self.dbx.files_upload(file_data, upload_path)

            st.success(f"Feedback PDF '{new_file_name}' uploaded successfully to Dropbox.")
        except dropbox.exceptions.ApiError as e:
            st.error(f"Error uploading '{file_name}' to Dropbox: {e}")

Environment Details: DropBox, Pycharm, Github, Streamlit

For Issue Resolution:

Made some changes on how the file was generated in upload_file class. Now for each unique email address the file will be sent to drop box.

blackm61 commented 8 months ago

@spaude11 This is great but it does seem to make an assumption that a person will only ever want to submit feedback once. I think this is fine but just wanted to point it out. I think this is great! I'm glad you got it fixed. You showed us the errors you got when we were in class Monday.