Code Monkey home page Code Monkey logo

query_report's People

Contributors

ashrafuzzaman avatar bitdeli-chef avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

query_report's Issues

how to avoid duplication with column names

many of my reports have common columns:

  def future_report
    check_auth
    requests = Request::where("status = 'future'").order('date DESC')

    reporter(requests) do
      column :user_id
      column "user name" do |request|
        begin
          @user_profile = User.find(request[:user_id])
          "#{@user_profile.first_name} #{@user_profile.last_name}"
        rescue
          "user no longer registered"
        end
      end
      column :driver_id
      column :vehicle_id
      column :status
      column :from
      column :to
      column :rate
      column :passengers
      column :luggage
      column :comment
      column :reserve_number
      column :promo_code_id
      column :payment_options
      column :time
      column :distance
      column :route
      column :eta
      column :booked
      column :start
      column :end
      column :real_time
      column :cancelled
      column :partner_id
      column :cancelled_user_id
    end
  end

  def driver_report
    check_auth
    requests = Request.select("requests.*, concat(user_profile.first_name, ' ',user_profile.last_name) as driver_name")
                      .from("requests, user_profile")
                      .where("driver_id is not null and user_profile.user_id = requests.driver_id")

    reporter(requests.scoped) do
      filter :booked, type: :date, default: [1.day.ago.to_date.to_s(:db), Date.current.to_s(:db)]
      filter :driver_name, type: :text do |query, name|
        query.where("user_profile.first_name like ? or user_profile.last_name like ?", "%#{name}%", "%#{name}%")
      end

      column :user_id
      column :driver_name
      column :driver_id
      column :vehicle_id
      column :status
      column :from
      column :to
      column :rate
      column :passengers
      column :luggage
      column :comment
      column :reserve_number
      column :promo_code_id
      column :payment_options
      column :time
      column :distance
      column :route
      column :eta
      column :booked
      column :start
      column :end
      column :real_time
      column :cancelled
      column :partner_id
      column :cancelled_user_id
    end
  end

is there a way i can encapsulate the columns in a variable or something? what would it look like?

how to control the action of search

I noticed by just putting a filter you get a search form.. However I'm not sure how to control the action of that search form (ie where the search form directs to)..

so let's say i'm in admin/reports/daily.. if i hit search it automatically goes to admin/reports.. where do i control this kind of routing/action for the search form?

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

how to add time filtering to date filter?

the way query report is made is that it auto generates a date filer (it uses bootstrap-datepicker).. i will need to add a time picker as well.. there is a gem for that as well.. how can i do this? will i have to build my own gem? โš ๏ธ

trouble publishing pdf

I noticed that in your demo project gemfile, there aren't any dependencies for gems that generate pdfs (ie gem 'wkhtmltopdf-binary'
gem 'wicked_pdf'
gem 'pdfkit').. which makes me wonder how does query_report generate pdfs?

Support for raw SQL

Hello,

Thanks for the wonderful plugin.
I would like to know whether there is support to generate report using raw SQL.

Can we use query using Active Record find_by_sql() method?

Thanks,

Apply where condition

Let say I have a table with column AMOUNT and TYPE. Amounts 10,20,50. Type 1,1,2

Let say I want in a column the sum of amounts for which type is 1. Result should be 30.
And in another column sum of amounts for which type is 2. Result should be 50.

In controller I can apply sum in this way sum(AMOUNT) as total_amount and then call column :total_amount.

But I am unable to apply the condition where type = 1.

I understand that it can't be done through a scope or new method as column refers to db tables not active records.

Is this possible at all?

Use with Sinatra

Can this be used this with Sinatra or other non-rails frameworks?

thx!

how to put placeholders in search field

how do i put a placeholder in the search field? right now i can only put a default value:

filter :driver_name, type: :text, default: "enter driver name"

i would like to do something like this

filter :driver_name, type: :text, placeholder: "enter driver name"

right now if i do the above i get this in the placeholder:

placeholder="translation missing: en.query_report.filters.driver_name.contains"

Rails 4 Support?

Does this not work with rails 4?

I added gem "query_report", "~> 1.1.2" to my Gemfile and did bundle install but my rails app isn't recognizing it. It says cannot load such file -- query_report/helper.

filter doesn't work when running on on a join active record relation

the date works just fine in filtering.. but filtering by driver_name doesn't make a difference:

requests = Request.select("requests.*, concat(user_profile.first_name, ' ',user_profile.last_name) as driver_name")
                  .from("requests, user_profile")
                  .where("driver_id is not null and user_profile.user_id = requests.driver_id")

reporter(requests.scoped) do
  filter :booked, type: :date, default: [1.day.ago.to_date.to_s(:db), Date.current.to_s(:db)]
  filter :driver_name, type: :text

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.