fetching capacity of team - rally

I am working on report that shows the Velocity - vs. Capacity in % of scrum team using rally app2.0 SDK.
I have looked for a way to get the Capacity of team but fail to find! any one can help?
Thanks in advance

For the user's sprint capacity you'll want to query on UserIterationCapacity. While the following example's code pertains to AppSDK 1.0, the query syntax is going to be fairly similar to that outlined in this posting:
How to query team member name and capacity in Rally developer depending upon iteration?
Following is an example of a query for UserIterationCapacity corresponding to a particular Sprint within a specific Project of interest.
var queryConfig = null;
var projectOID = "12345678910";
var selectedIteration = "My Iteration";
var capacityQueryString = '((Iteration.Name = ' + '"' +
selectedIteration +
'") AND (Project.ObjectID = "' +
projectOID +
'"))';
console.log(capacityQueryString);
queryConfig = {
key: "usercapacities",
type: "UserIterationCapacity",
fetch: "Capacity,User,Role,EmailAddress,DisplayName,UserName",
query: capacityQueryString
};
rallyDataSource.findAll(queryConfig, processResults);

Related

How to query metadata of an OData action?

I want to query metadata of an OData action in order to find out, which parameters are expected and how they are named.
I am aware, that I can figure this out by typing link-to-service-root.com/service.svc/$metadata. However, in this case I have to dig through the complete metadata output.
Instead I am looking for an elegant way to do this. Maybe there exists a query link-to-service-root.com/service.svc/$metadata/Action('Namespace.NameOfAction') (inspired by blog post on queryable odata metadata).
Thanks for your input!
You can get the Action (or Actions) from the EDM and then play with parameters. Let me know if this helps.
String serviceRoot = "http://services.odata.org/V4/TripPinServiceRW/";
EdmMetadataRequest request = ODataClientFactory.getClient().getRetrieveRequestFactory().getMetadataRequest(serviceRoot);
ODataRetrieveResponse<Edm> response = request.execute();
Edm edm = response.getBody();
List<EdmAction> edmActions = edm.getSchemas().get(0).getActions(); //get the first schema
for (EdmAction action : edmActions) {
System.out.println("Action name: " + action.getName());
List<String> actionParamNames = action.getParameterNames();
System.out.println("Parameters: ");
for (String actionParamName : actionParamNames) {
EdmParameter param = action.getParameter(actionParamName);
System.out.println(param.getName() + " (" + param.getType().getName() + ")");
//getMaxLength //getPrecision //isNullable //isCollection //etc.
}
System.out.println("---------------------");
}

Is there a way to seperate with a <br> each time the order property finds a change?

I'm working on a defect list custom app that uses a queryConfig to populate results of a defect. I'm currently sorting the results using the order property.
My question is: is it possible to somehow detect when the criteria of the order sort changes and to make a break?
For example- let's say the list that is populating is a list of food sorted by categorization. In our order property we will sort these DESC. It may look like this:
Apples
Bananas
Strawberries
Carrots
Lettuce
Now within the food categorization, there is a Fruits category and a Vegetables category. The question again, can I somehow know when the Vegetables sort is happening and then perform a to make the results look grouped?
Using the example from above, we would want to achieve:
Apples
Bananas
Strawberries
Carrots
Lettuce
Any help would be greatly appreciated.
Sorting via the Order parameter is done server-side, so I don't think there's a way to identify changes in groupings client-side without inspecting the data.
Since you're using AppSDK 1.x, this may be a situation where using an Array of queryConfig's could be useful to attain groupings of results that match your desired groupings. Then you could do something similar to the following:
var queryConfig = [];
queryConfig[0] = {
type : 'HierarchicalRequirement',
key : 'fruit_stories',
query: '(c_FoodCategory = "Fruits")',
fetch: 'Name,FormattedID,Description,c_FoodCategory'
};
queryConfig[1] = {
type : 'HierarchicalRequirement',
key : 'veggie_stories',
query: '(c_FoodCategory = "Vegetables")',
fetch: 'Name,FormattedID,Description,c_FoodCategory'
};
var rallyDataSource;
rallyDataSource = new rally.sdk.data.RallyDataSource('__WORKSPACE_OID__',
'__PROJECT_OID__',
'__PROJECT_SCOPING_UP__',
'__PROJECT_SCOPING_DOWN__');
rallyDataSource.findAll(queryConfig, processResults);
}
var processResults = function(results) {
var fruit_stories = results['fruit_stories'];
var veggie_stories = results['veggie_stories'];
var aDiv = document.getElementById("aDiv");
// Output fruit stories
for (var i=0; i<fruit_stories.length; i++) {
story = fruit_stories[i];
storyInfo += story.Name +
', ' + story.FormattedID +
', ' + story.c_FoodCategory + '<br>';
}
aDiv.innerHTML = '<strong>Name, State, Food Category</strong><br/>';
aDiv.innerHTML += storyInfo;
// Add break
aDiv.innerHTML += "<br/>
// Output veggie stories
for (var i=0; i<veggie_stories.length; i++) {
story = veggie_stories[i];
storyInfo += story.Name +
', ' + story.FormattedID +
', ' + story.c_FoodCategory + '<br>';
}
aDiv.innerHTML = '<strong>Name, State, Food Category</strong><br/>';
aDiv.innerHTML += storyInfo;
// Add break
aDiv.innerHTML += "<br/>
};
You may wish to consider using rally.sdk.ui.Table for displaying your output results - it provides a much cleaner visual display of columnar information.
Also, if you're interested in considering AppSDK 2.0, its Grid component contains a configuration attribute for automated grouping. See this example:
https://help.rallydev.com/apps/2.0/doc/#!/example/groupable-grid

Speed Up Retrieving View Data?

The database I am trying to pull data from has approximately 50,000 documents. Currently it takes around 90 seconds for an iOS or Android device to query and display the data to the mobile device in a view. My code is posted below. Is there something I could be doing differently to speed this up? Thanks for any tips.
function updateAllPoliciesTable() {
try {
var db = Alloy.Globals.dbPolicyInquiry;
var view = db.getView("AllRecordsByInsured");
var vec = view.getAllEntriesBySQL("Agent like ? OR MasterAgent like ?", [Ti.App.agentNumber, Ti.App.agentNumber], true);
var ve = vec.getFirstEntry();
var data = [];
while (ve) {
var unid = ve.getColumnValue("id");
var row = Ti.UI.createTableViewRow({
unid : unid,
height: '45dp',
rowData: ve.getColumnValue("Insured") + " " + ve.getColumnValue("PolicyNumber")
});
var viewLabel = Ti.UI.createLabel({
color : '#333',
font : {
fontSize : '16dp'
},
text: toTitleCase(ve.getColumnValue("Insured")) + " " + ve.getColumnValue("PolicyNumber"),
left: '10dp'
});
row.add(viewLabel);
data.push(row);
ve = vec.getNextEntry();
}
//Ti.API.log("# of policies= " + data.length);
if(data.length == 0) {
var row = Ti.UI.createTableViewRow({
title : "No policies found"
});
data.push(row);
}
$.AllPoliciesTable.setData(data);
Alloy.Globals.refreshAllPolicies = false;
Alloy.Globals.loading.hide();
} catch (e) {
DTG.exception("updateAllPoliciesTable -> ", e);
}
}
Create an index on the appropriate table, that should speed up things.
The SQLite table for your view should be named "view_AllRecordsByInsured".
Create an index for that table, check SQLite documentation about "CREATE INDEX" for more details.
To execute the appropriate SQL, you could use the DTGDatabase class like
var sqldb = new DTGDatabase(Alloy.Globals.dbPolicyInquiry.localdbname);
sqldb.execute("CREATE INDEX IF NOT EXISTS ON view_AllRecordsByInsured (Agent,MasterAgent)")
If that does give enough speed, look at full text search for SQLite dbs.
Here is some example code regarding full text indexes to give you a starting point:
CREATE VIRTUAL TABLE ft_view__mobile_companies_ USING fts4(id, customername, customercity)
INSERT INTO ft_view__mobile_companies_(id, customername, customercity) SELECT id, customername, customercity FROM view__mobile_companies_
To query the index you need to execute SQL with the MATCH operator (see SQLite documentation). In one app I have well over 100.000 datasets synchronized from a Domino view, and searching using a fulltext search in SQLite works instantly.
Well, unlike big database engines, the SQLite database engine is more limited, and so are the devices that it's run on.
What I would try to do is check the query that pulls the data - are you using indexes in your table? do you use them to query? is there unnecessary joins or pulls?
I you fail to tweet the query you should maybe consider checking out a mobile noSQL solution - I know there are some on the appcelerator marketplace - check if it suits your needs and if it speeds up things.

Rally Analytics set the startindex for a query

I have a query for the Rally Analytics which returns a data set larger than the pagesize. So I want to do another query to return the remainder data set. I tried setting a startindex value but that does not work, StartIndex stays at 0.
this.query = {
find:Ext.encode(requestedQuery.find),
StartIndex:20000,
pagesize:20000 //MAX_PAGESIZE
};
_queryAnalyticsApi:function () {
Ext.Ajax.request({
url:"https://rally1.rallydev.com/analytics/1.27/" + this.workspace + "/artifact/snapshot/query.js?" + Ext.Object.toQueryString(this.query) +
"&fields=" + JSON.stringify(this.requestedFields) + "&sort={_ValidFrom:1}",
method:"GET",
//need to change this to a POST
success:function (response) {
this._afterQueryReturned(JSON.parse(response.responseText));
},
scope:this
});
},
that works, it was confusing because the attribute of the result set is called StartIndex. It would be nice if the granularity (i.e. day, week) could be defined and handled on the server first, so it wouldn't have to return such a large dataset.
The parameter you'll want to use is called start. Also, on subsequent pages it is important to include a filter using the ETLDate returned from the first page of data so your results are consistent in time. We have created a SnapshotStore in the AppSDK 2.0 that handles all this complexity for you. Look for it soon!

Sort Google Custom Search Results by Date

I'm in the middle of migrating Google Custom Search Engine to use the CustomSearchControl to replace the deprecated WebSearch API, and one of the requirement is to sort the suggestion results by date. But so far, I couldn't figure out how to tell Google to sort results by latest date before returning the suggestion. The sample code is as follows:
var refinement="Support";
.....
switch(product)
{
case "10000":
refinement = "Support1";
break;
case "10002":
refinement = "Support1";
break;
case "10001":
refinement = "Support2";
break;
default:
break;
}
var customSearchControl = new google.search.CustomSearchControl('cseId');
customSearchControl.setSearchStartingCallback(this, function(control, searcher, query) {
searcher.setQueryAddition('more:' + refinement);
});
customSearchControl.setResultSetSize(7);
customSearchControl.draw('entries');
......
I've tried the recency label to sort the results, but it doesn't work:
customSearchControl.setSearchStartingCallback(this, function(control, searcher, query) {
//searcher.setQueryAddition('more:recent3');
searcher.setQueryAddition('more:' + refinement + ', more:recent3');
});
And I also tried sorting by attributes but it's not working either:
var options = {};
options[google.search.Search.RESTRICT_EXTENDED_ARGS] = {'sort': 'date-sdate:d:s'}; //Tried to use other date format but it doesn't help
var customSearchControl = new google.search.CustomSearchControl('cseId', options);
Perhaps sorting by attributes will not work because we don't have attributes declared in our web documentations. Thus, is there any other way that allows us to tell Google to sort the search results by date?
I came across the following:
http://code.google.com/intl/nl-NL/apis/customsearch/docs/js/cselement-reference.html
options[google.search.Search.RESTRICT_EXTENDED_ARGS] = {
'lr': 'lang_it',
'sort': 'date'
};
var customSearchControl = new google.search.CustomSearchControl(id, options);
Hope this will help if the problem is still there.