

    set_language_if_valid user.language
    @issues = issues
    @days = days
    @issues_url = url_for(:controller => 'issues', :action => 'index',
                                :set_filter => 1, :assigned_to_id => user.id,
                                :sort => 'due_date:asc')

  
  
  #added this loop within def reminder
  x=0
  @issues.each do |issue|
    if(issue.due_date >= DateTime.now )
        x = x + 1
    end
  end
  mail :to => user,
      :subject => l(:mail_subject_reminder, :count => x, :days => days) #changed to be :count => x
  end



    scope = scope.where(:assigned_to_id => user_ids) if user_ids.present?
    scope = scope.where(:project_id => project.id) if project
    scope = scope.where(:fixed_version_id => target_version_id) if target_version_id.present?
    scope = scope.where(:tracker_id => tracker.id) if tracker
    scope = scope.order('due_date') #added this line within self.reminders
