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: contribution_reports_for_project_owners_controller.rb
    path of file: ./repos/catarse/app/controllers/reports
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

class Reports::ContributionReportsForProjectOwnersController < ApplicationController
  respond_to :csv, :xls

  has_scope :project_id, :reward_id
  has_scope :state, default: 'paid'
  has_scope :waiting_payment, type: :boolean

  def index
    authorize project, :update?
    respond_to do |fo
    
  def index
    authorize project, :update?
    respond_to do |format|
      if params[:reward_id] && params[:reward_id] != '0'
        reward = Reward.find params[:reward_id]
        data = ContributionReportsForProjectOwner.to_csv(collection(false), params[:reward_id])
      else
        data = collection.copy_to_string
      end
      format.csv do
        if params[:reward_id] && params[:reward_id] != '0'
          send_data data, filename: "#{project.permalink}#{reward.title ? '_' + reward.title : ''}.csv" 
        else
          send_data data, filename: "#{project.permalink}.csv"
        end
      end