Dai0526 / ASE-Fall2016

Group project for ASE Fall 2016 Columbia University
3 stars 0 forks source link

2nd iteration code inspection #8

Open ruomengz opened 7 years ago

ruomengz commented 7 years ago

reader: Yunlei Qiu recorder: Ruomeng Zhang component: add event, user class

ruomengz commented 7 years ago
  1. Event
    • [ ] Event time. (UTC/ server time/ local time)
    • [x] repeated code in project/groups/views.py line 168 and line 173, querying database twice.

Solution: So we decided to use the server times instead of user local time.

  1. User
    • [x] separate form request and validation into two functions. Code in project/users/views.py line 27-41, line 51-74.
wyfwdn commented 7 years ago

reader: Yufu Wang recorder: Tianhua Fang component: download

Groups

  1. Duplicated query and code can be written as a function so it is easier to call. For example: group = db.session.query(Group).filter_by(groupname=groupname).first() user = db.session.query(User).filter_by(id=session['user_id']).first() Repeated for 3 times in group class. Reductant work.

Solution: Write a function for it so we can call it anytime we need it.

Home

  1. Login validate doesn't work for homepage. a. Login_required() after response doesn't work for it.

Solution: Do the cache manually. Set no-cache http header after every pages that requires login.

  1. add_message() If no text in form when clicking add_message button, it should pop up error message "empty message".

Solution: Write an else statment so it will report the corresponding message.