SOA-04 / leaf-app

https://docs.google.com/spreadsheets/d/1in8nvVFMh99L_NCA-PDzP0xR529cWyqTXr9tJljar0M/edit?gid=682049865#gid=682049865
0 stars 3 forks source link

DEVELOP 06: Presentation Layer Refactoring #97

Open jerry914 opened 2 days ago

jerry914 commented 2 days ago
  1. Manage user sessions:
    • [x] Use cookie-based sessions to maintain any history or information about the user’s experience
    • [x] Configure Roda to use cookies to manage user sessions
    • [x] Create a hashing secret for the cookies (Use: rake new_session_secret - in Rakefile)
  1. Add error-checking to your routes

    • [ ] Distinguish the steps of each route (get data from API, store data in DB, etc.) and leave simple comments in your code identifying these steps (This is an important step for readability and helps your further maintenance!)
    • [x] Check and catch errors at each step:
    • [x] Use conditional logic (e.g, if-else) to check the validity of the output of steps
    • [x] Catch (rescue) expected or unexpected errors in each step
    • [x] Display notice / error flash messages (cookie-based)
  2. Refactor your views

    • [x] Identify all the places your views use domain objects (entities/values)
    • [x] Create View Objects in your domain
    • [x] Implement the major functionality your views need
    • [x] Some view object methods might simply call the same method on domain objects
    • [x] Give descriptive names to the complex behavior
    • [x] You might have to make several view objects corresponding to smaller entities and values
    • [ ] Ensure controller is only passing a view objects to views
    • [ ] Refactor views (e.g., slim files) to only use view objects
  1. Deploy to Heroku
    • [x] Merge your refactor-presentation branch into main and push both branches to Github
    • [ ] Deploy your updates to main branch on Heroku (Error message: Failed to load resource: the server responded with a status of 500)
    • [x] Don’t forget to add a SESSION_SECRET environment variable to Heroku
pedestrianlove commented 2 days ago

@jerry914 Sorry, but I can't reproduce the issue by clicking on the link inside of the Upstart team sheet. Could you please provide more information on how to reproduce the 500 error?

The main branch deployment hasn't been changed since 11/15:

image
jerry914 commented 2 days ago

Oh, thanks for the question. I think the problem is using Chinese for searches; when I use English, the problem is resolved. e.g.: https://soa04-leaf-d708d21ee0ae.herokuapp.com/locations/%E6%96%B0%E7%AB%B9

I would suggest adding error checking to prevent this kind of thing happen.

In addition, I just realized that there is no search history based on the session for the user. Did you implement that yet on the front-end page?

pedestrianlove commented 2 days ago

Oh, thanks for the question. I think the problem is using Chinese for searches; when I use English, the problem is resolved. e.g.: https://soa04-leaf-d708d21ee0ae.herokuapp.com/locations/%E6%96%B0%E7%AB%B9

I would suggest adding error checking to prevent this kind of thing happen.

In addition, I just realized that there is no search history based on the session for the user. Did you implement that yet on the front-end page?

Not quite, we haven't yet got the time nor energy to do so.

We're planning to add the session feature on the home page though, but I'm still thinking how the UI should be designed such that it would make the most sense with the current flow.

pedestrianlove commented 1 day ago

Oh, thanks for the question. I think the problem is using Chinese for searches; when I use English, the problem is resolved.

@jerry914 #103 fixed the 500 error caused by Chinese character input, and the patch has now reached the main branch.