Closed njlxyaoxinwei closed 10 years ago
make_entry
action. It is defined in routes.rb as a member route. However, all links to this route passes as parameter an array of one single task_id
, and make_entry
as defined in the tasks_controller does not use params[:id]
. This confusion is why the links aren't working. There are two ways to fix this:
make_entry
as a collection routemake_entry
action using params[:id]
@tasks
requires either an existing @report
or @shift
. active_tasks
action (and all_allowed_tasks
method) has a very slow Database query: LocGroup.all.select{ |lg| lg.users.include?(current_user) }
which is slowing the action down significantly.branch 263_active_tasks fixes the first two problems by:
make_entry
a member route and modify the actionactive_tasks
action and all_allowed_tasks
method checks the day_in_week
of the weekly tasks against the day of week of the current time (Time.now
).For the slow loading time, I replaced the old query with the more intuitive current_user.loc_groups
, reducing the loading time of the page to around 3 seconds. However, despite their seeming equivalence, it turns out that they are not exactly the same.
I ran a script that compares results of the two expressions for every user in the anonymized database in issue #213. For 243 out of the total 341 users, the two expression return the same array of location groups. For the remaining 97 users, the only difference between the two results is that Bass Media location group is in user.loc_groups but not the other expression. I suspect that this might be an error in the database? I also tried adding a new user and the two expressions have the same result for the new user. @caseywatts
The links to complete the active tasks on the /active_tasks page are not working. Also the page takes very long (around 15 seconds) to load.