Class: Solidstats::ProductivityController

Inherits:
ApplicationController show all
Defined in:
app/controllers/solidstats/productivity_controller.rb

Instance Method Summary collapse

Instance Method Details

#my_todosObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/solidstats/productivity_controller.rb', line 7

def my_todos
  @todos = MyTodoService.collect_todos
  @summary = MyTodoService.get_summary

  # Group todos by type for display
  @todos_by_type = @todos.group_by { |todo| todo[:type] }

  # Recent todos (first 10 for quick view)
  @recent_todos = @todos.first(10)

  # Stats for dashboard
  @stats = {
    total: @todos.length,
    by_type: @todos_by_type.transform_values(&:count),
    files_with_todos: @todos.map { |t| t[:file] }.uniq.length
  }

  respond_to do |format|
    format.html
    format.json { render json: { todos: @todos, summary: @summary, stats: @stats } }
  end
end

#refresh_todosObject



30
31
32
33
34
35
36
37
# File 'app/controllers/solidstats/productivity_controller.rb', line 30

def refresh_todos
  @todos = MyTodoService.collect_todos(force_refresh: true)

  respond_to do |format|
    format.html { redirect_to my_todos_productivity_index_path, notice: "TODOs refreshed successfully!" }
    format.json { render json: { status: "success", message: "TODOs refreshed", count: @todos.length } }
  end
end