def data_sessions_overview
      onCampus = params[:onCampus] ? params[:onCampus].to_i : 0
      offCampus = params[:offCampus] ? params[:offCampus].to_i : 0
      isMobile = params[:isMobile] ? params[:isMobile].to_i : 0
      notMobile = params[:notMobile] ? params[:notMobile].to_i : 0
      filterCase = (2**3)*onCampus + (2**2)*offCampus + (2**1)*isMobile + notMobile

      case filterCase
      when 1 #mobile=f
        sessions = Session.where(@range).where(:is_mobile => false).group(:created_at_string).order("created_at_string ASC").count(:created_at_string)
      when 2 #mobile=t
        sessions = Session.where(@range).where(:is_mobile => true).group(:created_at_string).order("created_at_string ASC").count(:created_at_string)
      when 4 #campus=f
        sessions = Session.where(@range).where(:on_campus => false).group(:created_at_string).order("created_at_string ASC").count(:created_at_string)
      when 5 #campus=f, mobile=f
        sessions = Session.where(@range).where(:on_campus => false, :is_mobile => false).group(:created_at_string).order("created_at_string ASC").count(:created_at_string)
      when 6 #campus=f, mobile=t
        sessions = Session.where(@range).where(:on_campus => false, :is_mobile => true).group(:created_at_string).order("created_at_string ASC").count(:created_at_string)
      when 8 #campus=t
        sessions = Session.where(@range).where(:on_campus => true).group(:created_at_string).order("created_at_string ASC").count(:created_at_string)
      when 9 #campus=t, mobile=f
        sessions = Session.where(@range).where(:on_campus => true, :is_mobile => false).group(:created_at_string).order("created_at_string ASC").count(:created_at_string)
      when 10 #campus=t, mobile=t
        sessions = Session.where(@range).where(:on_campus => true, :is_mobile => true).group(:created_at_string).order("created_at_string ASC").count(:created_at_string)
      else
        sessions = Session.where(@range).group(:created_at_string).order("created_at_string ASC").count(:created_at_string)
      end

      @result = process_time_query(sessions)

      render_data
    end
def data_sessions_overview
      onCampus = params[:onCampus] ? params[:onCampus].to_i : 0
      offCampus = params[:offCampus] ? params[:offCampus].to_i : 0
      isMobile = params[:isMobile] ? params[:isMobile].to_i : 0
      notMobile = params[:notMobile] ? params[:notMobile].to_i : 0
      filterCase = (2**3)*onCampus + (2**2)*offCampus + (2**1)*isMobile + notMobile

      case filterCase
      when 1 #mobile=f
        sessions = Session.where(@range).where(:is_mobile => false).group(:created_at_string).order("created_at_string ASC").count(:created_at_string)
      when 2 #mobile=t
        sessions = Session.where(@range).where(:is_mobile => true).group(:created_at_string).order("created_at_string ASC").count(:created_at_string)
      when 4 #campus=f
        sessions = Session.where(@range).where(:on_campus => false).group(:created_at_string).order("created_at_string ASC").count(:created_at_string)
      when 5 #campus=f, mobile=f
        sessions = Session.where(@range).where(:on_campus => false, :is_mobile => false).group(:created_at_string).order("created_at_string ASC").count(:created_at_string)
      when 6 #campus=f, mobile=t
        sessions = Session.where(@range).where(:on_campus => false, :is_mobile => true).group(:created_at_string).order("created_at_string ASC").count(:created_at_string)
      when 8 #campus=t
        sessions = Session.where(@range).where(:on_campus => true).group(:created_at_string).order("created_at_string ASC").count(:created_at_string)
      when 9 #campus=t, mobile=f
        sessions = Session.where(@range).where(:on_campus => true, :is_mobile => false).group(:created_at_string).order("created_at_string ASC").count(:created_at_string)
      when 10 #campus=t, mobile=t
        sessions = Session.where(@range).where(:on_campus => true, :is_mobile => true).group(:created_at_string).order("created_at_string ASC").count(:created_at_string)
      else
        sessions = Session.where(@range).group(:created_at_string).order("created_at_string ASC").count(:created_at_string)
      end

      @result = process_time_query(sessions)

      render_data
    end
In order to obtain all filter cases, an integer corresponding to the following truth table is formed:
 rowNumber   onCampus   offCampus    isMobile    notMobile | filters
 0           0          0            0           0         | Neither filter applied (default)
 1           0          0            0           1         | where(is_mobile=>false)
 2           0          0            1           0         | where(is_mobile=>true)
 3           0          0            1           1         | INVALID (isMobile & notMobile asserted)
 4           0          1            0           0         | where(on_campus=>false)
 5           0          1            0           1         | where(on_campus=>false, is_mobile=>false)
 6           0          1            1           0         | where(on_campus=>false, is_mobile=>true)
 7           0          1            1           1         | INVALID (isMobile & notMobile asserted)
 8           1          0            0           0         | where(on_campus=>true)
 9           1          0            0           1         | where(on_campus=>true, is_mobile=>false)
 10          1          0            1           0         | where(on_campus=>true, is_mobile=>true)
 11          1          0            1           1         | INVALID (isMobile & notMobile asserted)
 12          1          1            0           0         | INVALID (onCampus & offCampus asserted)
 13          1          1            0           1         | INVALID (onCampus & offCampus asserted)
 14          1          1            1           0         | INVALID (onCampus & offCampus asserted)
 15          1          1            1           1         | INVALID (onCampus & offCampus asserted)
 Thus, the integer filterCase, which corresponds to the rowNumber, can be formed by converting 4 bit
 binary term formed by the concatenation {onCampus, offCampus, isMobile, notMobile} into an integer.
 Note: This filtering cannot be obtained by passing two boolean values (one for on_campus and one for is_mobile)
 as this would fail to account for cases where no filter is applied to one variable (ie. where we don't care about
 either location or device)