Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
From: wmorgan-sup@masanjin.net (William Morgan)
Subject: [sup-talk] [PATCH] return sources in id-order, with non-archived sources first
Date: Thu, 24 Jan 2008 21:27:14 -0800	[thread overview]
Message-ID: <1201238649-sup-7598@south> (raw)
In-Reply-To: <1200675726-sup-4860@spooky.local>

Reformatted excerpts from Grant Hollingworth's message of 2008-01-18:
> To speed up the user's view of polling, deal with sources that affect
> the inbox before (for example) large mailing lists. It seemed tidier
> to implement this in Index rather than PollManager.

Very nice. One minor comment below.

> I changed "@sources.values" to "sources" in some other methods for
> clarity, which I think in this case outweighs lost efficiency.

Sounds good. And efficiency is the least of our concerns!

> +  def sources
> +    ## favour the inbox by listing non-archived sources first
> +    @sources.values.sort_by {|s| s.id }.partition {|s| !s.archived? }.flatten
> +  end

Why bother sorting by id at all? Why not just something like:
  @sources.values.sort_by { |s| s.archived? ? 0 : 1 }


-- 
William <wmorgan-sup at masanjin.net>


  reply	other threads:[~2008-01-25  5:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-18 17:06 Grant Hollingworth
2008-01-25  5:27 ` William Morgan [this message]
2008-01-25 15:04   ` Grant Hollingworth
2008-02-03  0:58     ` William Morgan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1201238649-sup-7598@south \
    --to=wmorgan-sup@masanjin.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox