Coder Social home page Coder Social logo

Comments (17)

giuliov avatar giuliov commented on June 26, 2024

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.

jessehouwing avatar jessehouwing commented on June 26, 2024

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.

ASolovyev avatar ASolovyev commented on June 26, 2024

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.

jessehouwing avatar jessehouwing commented on June 26, 2024

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.

ASolovyev avatar ASolovyev commented on June 26, 2024

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.

jessehouwing avatar jessehouwing commented on June 26, 2024

Have you tried the code above? have you looked at the Eventlog to see if a warning is being created?

from tfsaggregator.

ASolovyev avatar ASolovyev commented on June 26, 2024

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.

giuliov avatar giuliov commented on June 26, 2024

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.

ASolovyev avatar ASolovyev commented on June 26, 2024

I am using 2.0.71 (2.0 Beta4)

from tfsaggregator.

giuliov avatar giuliov commented on June 26, 2024

Try using the latest code from develop branch. You will find updated docs and some fixes.

from tfsaggregator.

jessehouwing avatar jessehouwing commented on June 26, 2024

@giuliov,any specific change we can quickly cherry pick to master?

from tfsaggregator.

giuliov avatar giuliov commented on June 26, 2024

@jessehouwing bbf697f fix logging bug and 57405e7 for docs but not so sure of the result

from tfsaggregator.

jessehouwing avatar jessehouwing commented on June 26, 2024

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.

ASolovyev avatar ASolovyev commented on June 26, 2024

Ok i will try this at week and post results here!

from tfsaggregator.

jessehouwing avatar jessehouwing commented on June 26, 2024

Do you have an update for us?

from tfsaggregator.

ASolovyev avatar ASolovyev commented on June 26, 2024

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.

giuliov avatar giuliov commented on June 26, 2024

Great! Closing this and looking forward for your continued adoption.

from tfsaggregator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.