Comments (17)
Try this
if (self.Parent["Microsoft.VSTS.Scheduling.OriginalEstimate"].Status == FieldStatus.Valid) {
self.Parent["Microsoft.VSTS.Scheduling.OriginalEstimate"] = (double)self.Parent["Microsoft.VSTS.Scheduling.OriginalEstimate"] +(double)self["Microsoft.VSTS.Scheduling.OriginalEstimate"];
}
Alternative form
var parentField = self.Parent["Microsoft.VSTS.Scheduling.OriginalEstimate"];
if (parentField.Status == FieldStatus.Valid) {
parentField.Value += (double)self["Microsoft.VSTS.Scheduling.OriginalEstimate"];
}
from tfsaggregator.
using (double)(self.Parent["Microsoft.VSTS.Scheduling.OriginalEstimate"] ?? 0d)
probably works as well. The case to double will fail as the value will be null
unless the field has a default value rule on it.
from tfsaggregator.
Well. As i see we cant even set a value to the field with null value. Am i right? In that case i will just make a workitem rule to set estimate values to 0 when wit is creating.
from tfsaggregator.
I do not believe the issue is that you can't set the value. The issue is that the cast to double will fail. You could cast it to double?
or do the null check before casting:
if (self.HasParent())
{
self.Parent["Microsoft.VSTS.Scheduling.OriginalEstimate"] = ((double?)self.Parent["Microsoft.VSTS.Scheduling.OriginalEstimate"]??0d) +((double?)self["Microsoft.VSTS.Scheduling.OriginalEstimate"]??0d);
}
or
if (self.HasParent())
{
self.Parent["Microsoft.VSTS.Scheduling.OriginalEstimate"] = ((double)(self.Parent["Microsoft.VSTS.Scheduling.OriginalEstimate"]??0d)) +((double)(self["Microsoft.VSTS.Scheduling.OriginalEstimate"]??0d));
}
from tfsaggregator.
Yes. The issue that that if field have empty value - we can not set value in it.
I saw, that in that case we can make the aggregator do not work with this fields.
But in the case when i created, for example, a User story with emty estimate fields and made a link to task - when i put a value into task's estimate fields it will not added to User story fields.
from tfsaggregator.
Have you tried the code above? have you looked at the Eventlog to see if a warning is being created?
from tfsaggregator.
yes, i tried. First Case ((double?)) works like a regular rule. Second one is the same. :(
Eventlog is silent. It shows that rule is applyuing at child WI, and that is all. Logging level is diagnostic.
Maybe i should debug it?
By the way, one more question if you dont mean:
When i changing remaining work or original estimate in child from 6 to 2 for example aggregator makes +2 in parent WI and also adding all other estimate fields. What rule can help with this?
from tfsaggregator.
There was a bug regarding EventLog messages; it is fixed in the develop branch. Could be that you are using a version without that fix.
Please use the console app to validate your rules as suggested in the docs.
from tfsaggregator.
I am using 2.0.71 (2.0 Beta4)
from tfsaggregator.
Try using the latest code from develop branch. You will find updated docs and some fixes.
from tfsaggregator.
@giuliov,any specific change we can quickly cherry pick to master?
from tfsaggregator.
@jessehouwing bbf697f fix logging bug and 57405e7 for docs but not so sure of the result
from tfsaggregator.
Wrote a unit test specific for this case and updated the RollUp.Policies
file:
if (self.HasParent())
{
self.Parent["Total Work Remaining"] = (double)(self["Remaining Dev Work"]??0d) + (double)(self["Remaining Test Work"]??0d);
self.Parent["Total Estimate"] = (double)(self["Estimated Dev Work"]??0d) + (double)(self["Estimated Test Work"]??0d);
// Sum up all estimates to the sprint
if ((System.DateTime)self["Finish Date"] > System.DateTime.Now) {
// Log("Updating grand parent");
self.Parent.Parent["Dev Estimate"] = self["Estimated Dev Work"]??0d;
self.Parent.Parent["Test Estimate"] = self["Estimated Test Work"]??0d;
}
}
This syntax works for me in the test suite. If you can create a failing test from your code, it would help us debug this further.
from tfsaggregator.
Ok i will try this at week and post results here!
from tfsaggregator.
Do you have an update for us?
from tfsaggregator.
Yes!I have updates.
The case with ??0d works fine! Thank
My bad was in wrong brackets placement.
((double)self.Parent["Original Estimate"]??0d) instead of (double)(self.Parent["Original Estimate"]??0d)
from tfsaggregator.
Great! Closing this and looking forward for your continued adoption.
from tfsaggregator.
Related Issues (20)
- Condition that enforces separation of duties HOT 1
- Error when calling the tool HOT 4
- Error while using TFSAggregator2.ConsoleApp with DevOps Server 2020 HOT 3
- Not automatically processing rules HOT 1
- Timeline for 2.6 HOT 4
- Not processing rules HOT 9
- Generaton of duplicities HOT 3
- Aggregator 2 HTTP 500 when using impersonation HOT 3
- Release for DevOps Server 2020.1 RTW HOT 2
- TfsAggregator 2 - use TransitionToState change the Assigned To field also HOT 7
- Auto generate tasks creation failing when customized tag is added for work items using TFS aggregator plugin HOT 3
- my transitionToState function spams HOT 6
- multiple selection checkbox HOT 1
- No aggregator instances found. HOT 1
- Migration guide HOT 5
- TFSaggregator is not working after upgrading TFS2018 to azuredevops 2020. kindly help , i have uninstall and install TFS aggregator HOT 12
- XML configuration arrays can contain leading spaces
- security update HOT 5
- Azure DevOps 2022.1 RTW HOT 9
- Console_app: what-if warning even if not using the flag & Error: Object reference not set to an instance of an object. HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tfsaggregator.