def calculate(strategy, halffare)
      @halfprice = 0
      @fullprice = 0

      if halffare
        log_info "assuming order prices as half-fare"
      else
        log_info "assuming order prices as full"
      end

      log_notice "please note that you are using a strategy that involves guessing the real price" if ['guess', 'sbbguess'].include? strategy

      strategy = price_factory(strategy)
      strategy.halffare = halffare
      log_info "using price strategy: #{strategy.class}"
      price = Price.new(strategy)
      log_info "calculating prices..."

      @date_min = false
      @date_max = false
      @orders.each do |order|

        if Halffare.debug
          log_order(order)
        end

        halfprice, fullprice = price.get(order)

        if Halffare.debug
          if halfprice != 0 && fullprice != 0
            log_result "FOUND: #{order.description} (#{order.price}): half=#{currency(halfprice)}, full=#{currency(fullprice)}"

            if halffare
              log_emphasize "You would pay (full price): #{currency(fullprice)}, you save #{currency(fullprice - order.price)}"
            else
              log_emphasize "You would pay (half-fare): #{currency(halfprice)}, you pay #{currency(order.price - halfprice)} more"
            end
          end
        end

        @halfprice += halfprice
        @fullprice += fullprice

        @date_min = order.travel_date if !@date_min || order.travel_date < @date_min
        @date_max = order.travel_date if !@date_max || order.travel_date > @date_max
      end
    end
def calculate(strategy, halffare)
      @halfprice = 0
      @fullprice = 0

      if halffare
        log_info "assuming order prices as half-fare"
      else
        log_info "assuming order prices as full"
      end

      log_notice "please note that you are using a strategy that involves guessing the real price" if ['guess', 'sbbguess'].include? strategy

      strategy = price_factory(strategy)
      strategy.halffare = halffare
      log_info "using price strategy: #{strategy.class}"
      price = Price.new(strategy)
      log_info "calculating prices..."

      @date_min = false
      @date_max = false
      @orders.each do |order|

        if Halffare.debug
          log_order(order)
        end

        halfprice, fullprice = price.get(order)

        if Halffare.debug
          if halfprice != 0 && fullprice != 0
            log_result "FOUND: #{order.description} (#{order.price}): half=#{currency(halfprice)}, full=#{currency(fullprice)}"

            if halffare
              log_emphasize "You would pay (full price): #{currency(fullprice)}, you save #{currency(fullprice - order.price)}"
            else
              log_emphasize "You would pay (half-fare): #{currency(halfprice)}, you pay #{currency(order.price - halfprice)} more"
            end
          end
        end

        @halfprice += halfprice
        @fullprice += fullprice

        @date_min = order.travel_date if !@date_min || order.travel_date < @date_min
        @date_max = order.travel_date if !@date_max || order.travel_date > @date_max
      end
    end
Calculates prices according to given strategy.

 @param strategy [String] Strategy name
 @param halffare [true, false] True if tickets were bought with a halffare card