<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Teach dashboard code to compare non-integer revisions."
   href="https://bugs.webkit.org/show_bug.cgi?id=152345#c9">Comment # 9</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Teach dashboard code to compare non-integer revisions."
   href="https://bugs.webkit.org/show_bug.cgi?id=152345">bug 152345</a>
              from <span class="vcard"><a class="email" href="mailto:jmarcell&#64;apple.com" title="Jason Marcell &lt;jmarcell&#64;apple.com&gt;"> <span class="fn">Jason Marcell</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=152345#c7">comment #7</a>)
<span class="quote">&gt; Comment on <span class=""><a href="attachment.cgi?id=267593&amp;action=diff" name="attach_267593" title="Patch">attachment 267593</a> <a href="attachment.cgi?id=267593&amp;action=edit" title="Patch">[details]</a></span>
&gt; Patch
&gt; 
&gt; View in context:
&gt; <a href="https://bugs.webkit.org/attachment.cgi?id=267593&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=267593&amp;action=review</a>
&gt; 
&gt; Looks good overall. Few things, but otherwise nice work... I know a lot of
&gt; people will be happy to see these changes merged. :)
&gt; 
&gt; Also, thanks for adding QUnit! It's awesome that we have a way to test our
&gt; front-end now.
&gt; 
&gt; &gt; Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueue.js:301
&gt; &gt;          var sortedRepositories = Dashboard.sortedRepositories;
&gt; &gt;          for (var i = 0; i &lt; sortedRepositories.length; ++i) {
&gt; &gt;              var repositoryName = sortedRepositories[i].name;
&gt; &gt; -            var result = b.revision[repositoryName] - a.revision[repositoryName];
&gt; &gt; +            var trac = sortedRepositories[i].trac;
&gt; &gt; +            if (!trac || b.revision[repositoryName] === undefined || a.revision[repositoryName] === undefined)
&gt; &gt; +                return undefined;
&gt; &gt; +            var result = trac.compareRevisions(b.revision[repositoryName], a.revision[repositoryName]);
&gt; &gt;              if (result)
&gt; &gt;                  return result;
&gt; &gt;          }
&gt; 
&gt; Could compareIterations and compareIterationsByRevisions share this piece of
&gt; code? It looks identical.</span >

Yes, both compareIterations and compareIterationsByRevisions are very similar. The latter was introduced here:
<a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - build.webkit.org/dashboard still shows obsolete results for out of order builds sometimes"
   href="show_bug.cgi?id=143885">https://bugs.webkit.org/show_bug.cgi?id=143885</a>

We should probably find a way to collapse these into a single function if possible so that we are not duplicating code.

<span class="quote">&gt; 
&gt; &gt; Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Trac.js:272
&gt; &gt; +    compareRevisions: function(a, b)
&gt; &gt; +    {
&gt; &gt; +        var indexA = this.recordedCommits.objectIndexOf(a, &quot;revisionNumber&quot;);
&gt; &gt; +        var indexB = this.recordedCommits.objectIndexOf(b, &quot;revisionNumber&quot;);
&gt; &gt; +        if (indexA === undefined || indexB === undefined) {
&gt; &gt; +            this.loadMoreHistoricalData();
&gt; &gt; +            return undefined;
&gt; &gt; +        }
&gt; &gt; +        return indexA - indexB;
&gt; &gt; +    },
&gt; 
&gt; This seems to make the assumption that a &gt; b. Is it ever possible that b &gt;
&gt; a? If so, maybe use indexA as max(IndexA, indexB) and indexB as min(indexA,
&gt; indexB).</span >

This does not make the assumption that a &gt; b.

This is a pretty common pattern used for things like sort functions. The expected API is as follows: negative return value if the first parameter is less than the second, zero if they’re equal, a positive return value otherwise.

See, for examples of this pattern, the following:
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort</a> 

<span class="quote">&gt; 
&gt; &gt; Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Utilities.js:170
&gt; &gt; +{
&gt; 
&gt; I think this may make more sense as something like:
&gt; indexOfObjectWithProperty. I don't like how verbose that is necessarily
&gt; though, but it does seem a bit confusing without reading the function code.
&gt; Ideas?</span >

That doesn't seem like a bad name, but I'm open to other suggestions. I'll use that if there are no better suggestions.

<span class="quote">&gt; 
&gt; &gt; Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Utilities.js:172
&gt; &gt; +        if (this[i][property] === searchTerm) return i;
&gt; 
&gt; Nit: I think this would look a little nicer on two lines.</span >

I'll add a line break.

<span class="quote">&gt; 
&gt; &gt; Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/tests/MockOverrides.js:5
&gt; &gt; +        if (x) {
&gt; 
&gt; What is x? Could we use a better variable?</span >

x is actually the value that the user passes to the setter. Should we use 'value' as the variable name instead?

Some background: My intention for the MockOverrides.js file was to provide a place where we would override class methods (rather than creating a derived Mock subclass). The idea is that you want to cherry-pick some functionality in a particular method of some class while leaving some other functionality out. To that end, I copied this code from the original setter (bad variable name and all) while leaving out some code that getting in the way of my testing. I know copy/paste code is usually a bad idea, but it's going to help with testing :/

And if you're wondering why I overrode the method in the original class instead of just creating a Mock subclass that overrides the method, this is a class that I'm not directly instantiating myself, so I'm not in a position to provide a Mock class as a substitute.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>