lib/reports_generator.rb
# Accepts the following parameters:
# when_start..when_end - Display results between specific dates both inclusive
# logged_in - Display logged in
# not_logged_in - Display _NOT_ logged in
# answered - Display those who answered questionnaire

Accepts the following parameters:
when_start..when_end - Display results between specific dates both inclusive
logged_in - Display logged in
not_logged_in - Display _NOT_ logged in
answered - Display those who answered questionnaire
Accepts the following parameters : when_start .. when_end - Display results between specific dates both inclusive logged_in - Display logged in not_logged_in - Display _NOT_ logged in answered - Display those who answered questionnaire
def questionnaire_report_by_users
      range = @when_start .. @when_end
      activity_id = Activity.get_activity('submit questionnaire_answer').id
      user_activities = UserActivity.where(:activity_id => activity_id).where(:created_at => range).joins(:user).all
      users = {}
      user_activities.each do |au|
        unless users[au.user.email]
          users[au.user.email] = {:user => "#{au.user.email} #{au.user.first_name} #{au.user.last_name}", attendance: {}}
        end
        users[au.user.email][:attendance][au.created_at.to_date] = true
      end
      users
    end
def questionnaire_report_by_users range = @when_start .. @when_end activity_id = Activity . get_activity ( 'submit questionnaire_answer' ) . id user_activities = UserActivity . where ( :activity_id => activity_id ) . where ( :created_at => range ) . joins ( :user ) . all users = { } user_activities . each do | au | unless users [ au . user . email ] users [ au . user . email ] = { :user => "#{au.user.email} #{au.user.first_name} #{au.user.last_name}" , attendance : { } } end users [ au . user . email ] [ :attendance ] [ au . created_at . to_date ] = true end users end
Accepts the following parameters:
when_start..when_end - Display results between specific dates both inclusive
logged_in - Display logged in
not_logged_in - Display _NOT_ logged in
answered - Display those who answered questionnaire
Accepts the following parameters : when_start .. when_end - Display results between specific dates both inclusive logged_in - Display logged in not_logged_in - Display _NOT_ logged in answered - Display those who answered questionnaire