class CrewDuty < Sequel::Model(:'crew duty') # NOTE - Count of instances as of 06/01/2009 => 61849 #### BEGIN GENERATED SECTION #### set_primary_key [:'kid - user', :'kid - mult', :'kid - comm', :'kid - date', :'kid - time'] column_alias :ap_2_tz_gmt_offset, :'a/p 2 tz gmt offset' column_alias :ap_tz_gmt_offset, :'a/p tz gmt offset' column_alias :ac_type_id, :'ac type id' column_alias :act_begin_date_gmt, :'act begin date gmt' column_alias :act_begin_date_home, :'act begin date home' column_alias :act_begin_time_gmt, :'act begin time gmt' column_alias :act_begin_time_home, :'act begin time home' column_alias :act_end_date_gmt, :'act end date gmt' column_alias :act_end_date_home, :'act end date home' column_alias :act_end_time_gmt, :'act end time gmt' column_alias :act_end_time_home, :'act end time home' column_alias :activity_type, :'activity type' column_alias :addl_day, :'addl day' column_alias :airport_1_dep_date, :'airport 1 dep date' column_alias :airport_1_dep_time, :'airport 1 dep time' column_alias :airport_1_fixed, :'airport 1 fixed' column_alias :airport_1_iata, :'airport 1 iata' column_alias :airport_1_icao, :'airport 1 icao' column_alias :airport_1_id, :'airport 1 id' column_alias :airport_1_prefix, :'airport 1 prefix' column_alias :airport_2_arr_date, :'airport 2 arr date' column_alias :airport_2_arr_time, :'airport 2 arr time' column_alias :airport_2_fixed, :'airport 2 fixed' column_alias :airport_2_iata, :'airport 2 iata' column_alias :airport_2_icao, :'airport 2 icao' column_alias :airport_2_id, :'airport 2 id' column_alias :airport_2_prefix, :'airport 2 prefix' column_alias :amended, :'amended' column_alias :amended_by, :'amended by' column_alias :amended_date, :'amended date' column_alias :amended_time, :'amended time' column_alias :approved, :'approved' column_alias :base, :'base' column_alias :beg_home_gmt_offset, :'beg home gmt offset' column_alias :begin_date_local, :'begin date local' column_alias :begin_time_fixed, :'begin time fixed' column_alias :begin_time_local, :'begin time local' column_alias :cancelled, :'cancelled' column_alias :company, :'company' column_alias :completed, :'completed' column_alias :cost, :'cost' column_alias :created_flag, :'created flag' column_alias :crew_act_kid_comm, :'crew act kid - comm' column_alias :crew_act_kid_date, :'crew act kid - date' column_alias :crew_act_kid_mult, :'crew act kid - mult' column_alias :crew_act_kid_time, :'crew act kid - time' column_alias :crew_act_kid_user, :'crew act kid - user' column_alias :day_off_rest_act, :'day off rest act' column_alias :day_trip_kid_comm, :'day trip kid - comm' column_alias :day_trip_kid_date, :'day trip kid - date' column_alias :day_trip_kid_mult, :'day trip kid - mult' column_alias :day_trip_kid_time, :'day trip kid - time' column_alias :day_trip_kid_user, :'day trip kid - user' column_alias :description, :'description' column_alias :duty_fixed, :'duty fixed' column_alias :duty_laov_aircraft, :'duty laov aircraft' column_alias :duty_time, :'duty time' column_alias :duty_time_approved, :'duty time approved' column_alias :duty_time_check_box, :'duty time check box' column_alias :duty_time_gmt, :'duty time gmt' column_alias :duty_time_home, :'duty time home' column_alias :emb_rest_no_prepost, :'emb rest no prepost' column_alias :employee_id, :'employee id' column_alias :end_date_local, :'end date local' column_alias :end_home_gmt_offset, :'end home gmt offset' column_alias :end_time_fixed, :'end time fixed' column_alias :end_time_local, :'end time local' column_alias :flex, :'flex' column_alias :flight_time, :'flight time' column_alias :has_comment, :'has comment' column_alias :holiday, :'holiday' column_alias :internal_1, :'internal 1' column_alias :internal_c1, :'internal c1' column_alias :internal01, :'internal01' column_alias :internal02, :'internal02' column_alias :kid_comm, :'kid - comm' column_alias :kid_date, :'kid - date' column_alias :kid_mult, :'kid - mult' column_alias :kid_time, :'kid - time' column_alias :kid_user, :'kid - user' column_alias :leg1_kid_comm, :'leg1 kid - comm' column_alias :leg1_kid_date, :'leg1 kid - date' column_alias :leg1_kid_mult, :'leg1 kid - mult' column_alias :leg1_kid_time, :'leg1 kid - time' column_alias :leg1_kid_user, :'leg1 kid - user' column_alias :leg2_kid_comm, :'leg2 kid - comm' column_alias :leg2_kid_date, :'leg2 kid - date' column_alias :leg2_kid_mult, :'leg2 kid - mult' column_alias :leg2_kid_time, :'leg2 kid - time' column_alias :leg2_kid_user, :'leg2 kid - user' column_alias :legality_violation, :'legality violation' column_alias :not_first_day, :'not first day' column_alias :note, :'note' column_alias :notified, :'notified' column_alias :per_diem_begin, :'per diem begin' column_alias :per_diem_end, :'per diem end' column_alias :ron, :'ron' column_alias :ron_fixed, :'ron fixed' column_alias :rest_after, :'rest after' column_alias :rest_after_fixed, :'rest after fixed' column_alias :rest_before, :'rest before' column_alias :rest_before_fixed, :'rest before fixed' column_alias :rest_computed, :'rest computed' column_alias :rest_during, :'rest during' column_alias :rest_during_fixed, :'rest during fixed' column_alias :single_day_activity, :'single day activity' column_alias :training_act, :'training act' column_alias :verified, :'verified' column_alias :verified_by, :'verified by' column_alias :verified_date, :'verified date' column_alias :verified_time, :'verified time' column_alias :key0, :'key0' column_alias :key1, :'key1' column_alias :key2, :'key2' column_alias :key3, :'key3' column_alias :key4, :'key4' column_alias :key5, :'key5' column_alias :key6, :'key6' column_alias :key7, :'key7' #### END GENERATED SECTION #### column_def_datetime :duty_start_time, :'act begin date home', :'act begin time home' column_def_datetime :duty_end_time, :'act end date home', :'act end time home' # Fetches the crew duty records in a given interval def self.find_crew_duty_in_time_range(from_date, to_date) # Fetching the records verified or amended in the time interval passed in filter( {:verified=>1, :amended=>0, :verified_date=>from_date.to_fos_days..to_date.to_fos_days} | {:verified=>1, :amended=>1, :amended_date=>from_date.to_fos_days..to_date.to_fos_days} ).all end end