diff --git a/.gitignore b/.gitignore index a833ad90..ab9c1a70 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ *.sqlite3-shm *.sqlite3-wal certs/ -.DS_Store \ No newline at end of file +.DS_Store + +.byebug_history \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 12d4c023..27a29b9c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -86,6 +86,7 @@ GEM activerecord (>= 4.1) sinatra (>= 1.0) sqlite3 (1.6.8-arm64-darwin) + sqlite3 (1.6.8-x86_64-linux) tilt (2.3.0) timeout (0.4.1) tzinfo (2.0.6) @@ -94,6 +95,7 @@ GEM PLATFORMS arm64-darwin-22 + x86_64-linux DEPENDENCIES bcrypt diff --git a/app.rb b/app.rb index e1cb56e8..99a4c64c 100644 --- a/app.rb +++ b/app.rb @@ -1,6 +1,7 @@ require 'sinatra' require 'sinatra/activerecord' require 'securerandom' +require 'byebug' require './app/models/user' require './app/models/area' @@ -103,7 +104,7 @@ def url_without_tag end get '/inbox' do - @tasks = current_user.tasks.incomplete.where(project_id: nil).where(due_date: nil).order(:name) + @tasks = current_user.tasks.incomplete.where(project_id: nil, due_date: nil).order('tasks.created_at DESC') erb :inbox end diff --git a/app/routes/tasks_routes.rb b/app/routes/tasks_routes.rb index 88a01a80..9253bfc1 100644 --- a/app/routes/tasks_routes.rb +++ b/app/routes/tasks_routes.rb @@ -58,7 +58,7 @@ def update_task_tags(task, tags_json) @tasks = @tasks.where(id: tagged_task_ids) end - @tasks = @tasks.distinct + @tasks = @tasks.joins(:tags).distinct erb :'tasks/index' end diff --git a/app/views/projects/show.erb b/app/views/projects/show.erb index 4fda1db1..9d2973f4 100644 --- a/app/views/projects/show.erb +++ b/app/views/projects/show.erb @@ -39,7 +39,7 @@ <% end %>
<% if @project.tasks.incomplete.any? %> - <% @project.tasks.incomplete.each do |task| %> + <% @project.tasks.incomplete.order('created_at DESC').each do |task| %>
<%= partial :'tasks/_form', locals: { task: task } %>
@@ -48,13 +48,13 @@
<% end %> <% else %> -
+
No tasks have been created yet for this project
<% end %>

Notes

-