[1844] in Kerberos_V5_Development

home help back first fref pref prev next nref lref last post

Re: handy gnats elisp

daemon@ATHENA.MIT.EDU (Ken Raeburn)
Wed Oct 2 19:36:50 1996

To: "Barry Jaspan" <bjaspan@MIT.EDU>
Cc: krbdev@MIT.EDU
From: Ken Raeburn <raeburn@cygnus.com>
Date: 02 Oct 1996 19:36:19 -0400
In-Reply-To: "Barry Jaspan"'s message of Wed, 2 Oct 1996 18:47:11 -0400


It's also easy to sort based on a ranking determined by combining the
state, severity, and priority.  (The priority and/or severity fields
might be another way to indicate how quickly a problem should be
fixed.  Say, the release goes out after all critical and serious/high
bugs are fixed.)

I use some large numbers for each field's value and add them.  I also
factor in the age, as approximated by the PR number.  Mark has a
different set of numbers (probably more reasonable) but basically the
same idea.

(defconst pr-state-rank '((open . 900000)
			  (analyzed . 880000)
			  (feedback . 200000)
			  (suspended . 0)
			  (closed . -100000)))
(defconst pr-severity-rank '((critical . 90000)
			     (serious . 60000)
			     (non-critical . 30000)))
(defconst pr-priority-rank '((high . 9000) (medium . 6000) (low . 3000)))
(defun my-pr-rank (pr)
  (+ (cdr (assq (prms:::fieldval pr 'severity) pr-severity-rank))
     (cdr (assq (prms:::fieldval pr 'priority) pr-priority-rank))
     (cdr (assq (prms:::fieldval pr 'state) pr-state-rank))
     (- (prms:::fieldval pr 'number))))

(defun my-pr-filter-function (prs)
  (sort prs (function
	     (lambda (a b)
	       (let ((a-value (my-pr-rank a))
		     (b-value (my-pr-rank b)))
		 (or (< b-value a-value)
		     (and (= b-value a-value)
			  (< (prms:::fieldval b 'number)
			     (prms:::fieldval a 'number)))))))))

I haven't looked at the gnats net release, but in the Cygnus sources,
prms:::fieldval does the assoc/cdr bit.

Some of us use this at Cygnus, where the customer-assigned priority
and severity are important, as is the lifetime of a PR.


As with Barry's version, there's room for optimization....

home help back first fref pref prev next nref lref last post