Book a Demo

Author Topic: Effort.Update fails on SQL rep...  (Read 9288 times)

Tage Korsdal Nielsen

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Effort.Update fails on SQL rep...
« on: April 01, 2014, 12:51:58 am »
I have done an add-in for tracking effort and progress on elements. As I have earlier reported in the bug forum, EA multiplies Effort.Time with 1e6 each time I save an effort. I have added the following bugfix in my add-in. It works fine with .eap based repositories, but not my MySQL repository.

In both cases eff.Update() returns true (I never get the MessageBox).


Code: [Select]
           foreach ( Effort eff in efforts )
            {

                // EA bugfix
                float effTime = eff.Time;
                while( effTime > 999999 )
                {
                    effTime /= 1e6f;
                }

                // Sum of all efforts
                sum += effTime;
                if( eff.Name.StartsWith( "*" ) )
                {
                    // Sum of completed efforts
                    complete += effTime;
                }

                // Adjust time value to a sensible value
                // NOTE: Works fine on .eap repositories - not on MySQL rep? Why???
                eff.Time = effTime;
                if (!eff.Update())
                {
                    MessageBox.Show( "Effort update error:\r\n" + eaRepo.GetLastError() );
                }

                EffortTypeSum effsum = effSumList.Find( x => x.Equals( eff.Type));
                if (effsum == null)
                {
                    effsum = new EffortTypeSum(eff.Type);
                    effSumList.Add( effsum );
                }
                effsum.add(eff);
            }

Best regards
Tage