This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ==================================================== | |
| Foundation & Pre-Masters & Presessional = 15% fixed | |
| UG & PG First Year: | |
| 0-49 Students = 15% | |
| 50-99 students = 17.5% | |
| 100 + students = 20% | |
| ==================================================== | |
| ESL & Pre-Sess & Pre-Masters = 10% |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #========= Brackets Parser ================== | |
| # | |
| #---How to execute--- | |
| # Store the class Parse into a parse.rb file | |
| # Execute by typing $ ruby parse.rb | |
| # It will prompt for a value, enter the brackets, for example, "][]][[][[]][[[" | |
| # Press Enter, you will see the result | |
| #-------------------- | |
| # | |
| #---Logic Explained--- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def average_response_time(enquiries) | |
| total_response_time = enquiries.inject(0) do |time, enquiry| | |
| if enquiry.emails.size > 0 | |
| first_response = enquiry.emails.order('created_at DESC').first | |
| time += first_response.created_at - enquiry.created_at | |
| end | |
| end | |
| total_response_time / enquiries.count | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| irb(main):173:0* def average_response_time(enquiries) | |
| irb(main):174:1> enquiries_with_emails = enquiries.joins(:emails) | |
| irb(main):175:1> | |
| irb(main):176:1* total_response_time = enquiries_with_emails.inject(0) do |time, enquiry| | |
| irb(main):177:2* first_response = enquiry.emails.order('created_at DESC').first | |
| irb(main):178:2> time += first_response.created_at - enquiry.created_at | |
| irb(main):179:2> end | |
| irb(main):180:1> | |
| irb(main):181:1* total_response_time / enquiries.count | |
| irb(main):182:1> end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT `enquiries`.`id` AS t0_r0, `enquiries`.`first_name` AS t0_r1, `enquiries`.`surname` AS t0_r2, `enquiries`.`mobile1` AS t0_r3, `enquiries`.`mobile2` AS t0_r4, `enquiries`.`email1` AS t0_r5, `enquiries`.`email2` AS t0_r6, `enquiries`.`gender` AS t0_r7, `enquiries`.`date_of_birth` AS t0_r8, `enquiries`.`score` AS t0_r9, `enquiries`.`source_id` AS t0_r10, `enquiries`.`assigned_to` AS t0_r11, `enquiries`.`assigned_by` AS t0_r12, `enquiries`.`created_by` AS t0_r13, `enquiries`.`updated_by` AS t0_r14, `enquiries`.`created_at` AS t0_r15, `enquiries`.`updated_at` AS t0_r16, `enquiries`.`country_id` AS t0_r17, `enquiries`.`status_id` AS t0_r18, `enquiries`.`address` AS t0_r19, `enquiries`.`active` AS t0_r20, `enquiries`.`contact_type_id` AS t0_r21, `enquiries`.`registered` AS t0_r22, `enquiries`.`image` AS t0_r23, `enquiries`.`branch_id` AS t0_r24, `enquiries`.`registered_at` AS t0_r25, `enquiries`.`registered_by` AS t0_r26, `enquiries`.`impressions_count` AS t0_r27, `enquiries`.`response_time` AS t0_r28, `enqui |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def set_response_time | |
| unless auto | |
| enquiries.each do |enquiry| | |
| if enquiry.response_time.nil? | |
| response_hours = ((self.created_at - e.assigned_at) / 3600).round(2) | |
| enquiry.update_attribute(:response_time,response_hours) | |
| end | |
| end | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %w(enquiries registrations institutions).each do |action| | |
| define_method("#{action}_views") do |argument| | |
| Impression.where(user_id: argument.id,impressionable_type: action.singularize.camelize).size | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CoreStatistics | |
| attr_accessor :all | |
| def initialize(users,core) | |
| @core = core | |
| @users = users | |
| @all = Hash.new { |h, k| h[k] = Hash.new } | |
| send(@core) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <% if !@last_months.blank? || [email protected]? || [email protected]? %> | |
| <div class="row padAll10 green-well text-center modal-tab"> | |
| <span class="bold-subhead">Filtered By:</span> | |
| | |
| <%= @last_months.blank? ? nil : @last_months.to_s + "month(s)" %> | |
| | |
| <%= @from %> | |
| | |
| <%= @to %> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Ability | |
| include CanCan::Ability | |
| def initialize(user) | |
| user.permissions.each do |permission| | |
| if permission.subject_id.nil? | |
| if permission.subject_class == "All" | |
| can permission.action.to_sym, :all | |
| else | |
| can permission.action.to_sym, permission.subject_class.constantize |