Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full support for Mongoid support + by_quarter + by_calendar_month + fixes for using Date class #14

Closed
wants to merge 17 commits into from

Commits on Jan 5, 2013

  1. Added support for Mongoid (adapter for MongoDB). It's basically a mon…

    …key-patch file (see: lib/mongoid/by_star.rb) with a small change at the end of lib/by_star.rb to detect inclusion of ActiveRecord and/or Mongoid.
    
    I refactored the specs so that the exact same specs can be run by both Mongoid and ActiveRecord seamlessly (core specs now moved to /spec/by_star/generic). I am able to pass 49/60 ActiveRecord specs (i.e. prior to this commit; I have not introduced any regressions) and 50/60 Mongoid test--basically the same ones fail, the only exception is "by year/should be able to order the result set" which I believe is genuinely broken on Mongoid due to API differences.
    
    Updated readme as well.
    johnnyshields committed Jan 5, 2013
    Copy the full SHA
    14357e7 View commit details
    Browse the repository at this point in the history
  2. Moved failing Mongoid case to ActiveRecord only. After investigation …

    …seems the case is failing due to how the test code is written (AR-specific), not due to Mongoid features.
    johnnyshields committed Jan 5, 2013
    Copy the full SHA
    c11bce6 View commit details
    Browse the repository at this point in the history

Commits on Jan 6, 2013

  1. Refactoring of test specs so that both ActiveRecord and Mongoid tests…

    … can be run cleanly in one master run
    johnnyshields committed Jan 6, 2013
    Copy the full SHA
    4a9f5d5 View commit details
    Browse the repository at this point in the history
  2. Add test cases to verify that the object return type of Model.between…

    … method is correct for both AR and Mongoid
    johnnyshields committed Jan 6, 2013
    Copy the full SHA
    b940b35 View commit details
    Browse the repository at this point in the history

Commits on Jan 7, 2013

  1. Copy the full SHA
    5025143 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    70cb668 View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    399a236 View commit details
    Browse the repository at this point in the history

Commits on Jan 27, 2013

  1. Adding support for by_month as Date datatype (in addition to Time dat…

    …atype currently supported)
    johnnyshields committed Jan 27, 2013
    Copy the full SHA
    83bfe0e View commit details
    Browse the repository at this point in the history
  2. Added #between_times as an alias of #between, since between is likely…

    … to be used by other gems (it was in my case).
    johnnyshields committed Jan 27, 2013
    Copy the full SHA
    0b4d1bf View commit details
    Browse the repository at this point in the history
  3. Added new method "by_calendar_month". This is similar to by_month, bu…

    …t it also includes any results which fall in the same week as the first and last of the month. Useful for displaying monthly calendars. (This is based on a real-world use case I encountered in my app).
    johnnyshields committed Jan 27, 2013
    Copy the full SHA
    d020285 View commit details
    Browse the repository at this point in the history
  4. Bug fix: when by_month and by_week accept a Date, must convert date.t…

    …o_time first.
    
    The reason is this is that Date.end_of_week and Date.end_of_month under some conditions yield the *beginning* of the last day, rather than the end, so the query misses the last day of the period.
    
    Probably this fix is required everywhere Date type is used.
    johnnyshields committed Jan 27, 2013
    Copy the full SHA
    551be2d View commit details
    Browse the repository at this point in the history
  5. Copy the full SHA
    99fde1e View commit details
    Browse the repository at this point in the history
  6. Added new by_quarter method for 3-month quarter period. Following a s…

    …imilar pattern as other methods:
    
    x.by_quarter() gets all results from current quarter
    
    x.by_quarter(n) gets all results from the nth quarter of current year (e.g. n=2 means Apr thru Jun). Optional :year parameter can be given.
    
    x.by_quarter(date) gets all results from the quarter of date given
    johnnyshields committed Jan 27, 2013
    Copy the full SHA
    5b8ec06 View commit details
    Browse the repository at this point in the history
  7. Copy the full SHA
    ef52130 View commit details
    Browse the repository at this point in the history

Commits on Feb 2, 2013

  1. Copy the full SHA
    dbfe1af View commit details
    Browse the repository at this point in the history

Commits on Apr 17, 2013

  1. Copy the full SHA
    77c1962 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    fd6d49a View commit details
    Browse the repository at this point in the history