1

对于 Rally 项目中的每个故事,我希望能够计算在修订历史中对“描述”或“接受标准”字段进行更改的次数。我们正在尝试对我们项目中的需求流失量进行定量估计。

4

1 回答 1

2

这是一位同事编写的一个简单示例 - 它解析修订历史集合,匹配“DESCRIPTION changed”并将结果添加到表中以供显示。它应该很容易以显示计数而不是修订摘要的方式进行修改,并且也可以与您的接受标准字段匹配。您可能还想添加 IterationDropdown 和其他细节。

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <!-- Copyright (c) 2012  Rally Software Development Corp.  All rights reserved -->
    <html>
    <head>
        <title>Revision History Example</title>
        <meta name="Name"    content="App Example: Revision History" />
        <meta name="Version" content="2012.2" />
        <meta name="Vendor"  content="Rally Labs" />
        <script type="text/javascript" src="https://rally1.rallydev.com/apps/1.30/sdk.js?showHeader=false"></script>
        <script type="text/javascript">

            function revHistoryExample() {
                var rallyDataSource = new rally.sdk.data.RallyDataSource(
                                            '__WORKSPACE_OID__',
                                            '__PROJECT_OID__',
                                            '__PROJECT_SCOPING_UP__',
                                            '__PROJECT_SCOPING_DOWN__');
                function itemQuery() {
                    var queryObject = {
                        key: 'stories',
                        type: 'HierarchicalRequirement',
                        fetch: 'Name,ObjectID,FormattedID,RevisionHistory,Revisions,RevisionDescription,CreationDate,LastUpdateDate,Iteration'
                        query: '(Iteration.Name = "My Iteration")',
                    };
                    rallyDataSource.findAll(queryObject, populateTable);
                }

                function populateTable(results) {
                    var tableDiv = document.getElementById('aDiv');

                var config = { columns:
                            [{key: 'FormattedIDLink', header: 'Formatted ID', width: 100},
                             {key: 'Name'},
                             {key: 'RevisionDescription', header: 'Revision Description'},
                             {key: 'CreationDate', header: 'Creation Date'}] };

                var table = new rally.sdk.ui.Table(config);

                // Revision condition to match/look for within Revision history
                var revCondition = "DESCRIPTION changed";

                for ( i=0 ; i<results.stories.length ; i++ ) { 
                    for ( j=0 ; j<results.stories[i].RevisionHistory.Revisions.length ; j++ ) {

                        myStory = results.stories[i];
                        myRevision = myStory.RevisionHistory.Revisions[j];

                        if (myRevision.Description.indexOf(revCondition)>=0){

                            myFormattedID = myStory.FormattedID; 
                            myDescription = myRevision.Description;

                            myCreationDate = myStory.CreationDate;
                            myFormattedIDLink = new rally.sdk.ui.basic.Link(
                                {item: myStory, text: results.stories[i].FormattedID}
                            )

                            // Clobber fields on Story with info from the matching Revision for easy inclusion in table

                            results.stories[i].CreationDate = myCreationDate;
                            results.stories[i].RevisionDescription = myDescription;
                            results.stories[i].FormattedIDLink = new rally.sdk.ui.basic.Link({item:results.stories[i], text: results.stories[i].FormattedID});
                            table.addRow(results.stories[i]);

                        }
                    }
                }

                    table.display(tableDiv);

                };
                itemQuery();
            }

            rally.addOnLoad(revHistoryExample);
        </script>
    </head>
    <body>
       <div id="aDiv"></div>
    </body>
    </html>
于 2012-07-13T20:31:42.990 回答