You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: pending_todos_finder.rb
    path of file: ./repos/gitlabhq/app/finders
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

# Finder for retrieving the pending todos of a user, optionally filtered using
# various fields.
#
# While this finder is a bit more verbose compared to use
# `where(params.slice(...))`, it allows us to decouple the input paramet
    
  def execute
    todos = Todo.pending
    todos = by_users(todos)
    todos = by_project(todos)
    todos = by_target_id(todos)
    todos = by_target_type(todos)
    todos = by_author_id(todos)
    todos = by_discussion(todos)
    todos = by_commit_id(todos)

    todos = todos.with_preloaded_user if @preload_user_association

    by_action(todos)
  end