We missed a spot when fixing the bug B2016-081. When importing a transiition it was converting an internal transition to text. This has been fixed.

B2018-002 Updated code that tracks and displays Transition Refresh Statistics
Added Statistic tracking for invalid transitions converted to text
This commit is contained in:
Rich 2018-01-24 14:44:46 +00:00
parent 8818376ab9
commit 58c23de1ea
2 changed files with 46 additions and 21 deletions

View File

@ -2776,7 +2776,9 @@ namespace VEPROMS
if (TransitionInfo.Get(tt.TransitionID).MyItemToID.ActiveSection != null)
{
SectionConfig sc = TransitionInfo.Get(tt.TransitionID).MyItemToID.ActiveSection.MyConfig as SectionConfig;
forceConvertToText = (sc.SubSection_Edit == "N");
// Bug fix B2016-081 also check if transition is to a step element
// This was found when fixing B2018-002 but it actually applies to B2016-081
forceConvertToText = (sc.SubSection_Edit == "N" && TransitionInfo.Get(tt.TransitionID).MyItemToID.IsStep);
}
_DidProcessTransitions |= cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); // B2017-076 FixTransitionText will tell us if transitions were processed/changed
// B2017=003 make sure any grid changes are saved.
@ -2820,13 +2822,13 @@ namespace VEPROMS
cc.Text = cc.Text.Replace(lookfor, replacewith);
if (cc.MyGrid != null && cc.MyGrid.Data != "")
cc.MyGrid.Data = cc.MyGrid.Data.Replace(lookfor, replacewith);
if (TransitionInfo.Get(tt.TransitionID).MyItemToID.ActiveSection != null)
{
SectionConfig sc = TransitionInfo.Get(tt.TransitionID).MyItemToID.ActiveSection.MyConfig as SectionConfig;
forceConvertToText = (sc.SubSection_Edit == "N");
}
// B2016-176, B2016197 - external transitions should be convert to text
// B2016-176, B2016-197 - external transitions should be converted to text
forceConvertToText = true;
//if (TransitionInfo.Get(tt.TransitionID).MyItemToID.ActiveSection != null)
//{
// SectionConfig sc = TransitionInfo.Get(tt.TransitionID).MyItemToID.ActiveSection.MyConfig as SectionConfig;
// forceConvertToText = (sc.SubSection_Edit == "N");
//}
//if (!forceConvertToText) //check to see if external with internal format
//{
// TransitionInfo tran = TransitionInfo.Get(transitionid);

View File

@ -254,11 +254,21 @@ namespace VEPROMS
}
this.Cursor = Cursors.Default;
}
// B2018-002 - Invalid Transitions - Define Transition Refresh Statistics
private int numTransProcessed = 0;
private int numTransFixed = 0;
private int numTransConverted = 0;
// B2018-002 - Invalid Transitions - Initialize Transition Refresh Statistics
private void ResetTransNumbers()
{
numTransProcessed = 0;
numTransFixed = 0;
numTransConverted = 0;
}
private void RefreshTransitions()
{
int numTransProcessed = 0;
int numTransFixed = 0;
// B2018-002 - Invalid Transitions - Initialize Transition Refresh Statistics
ResetTransNumbers();
this.Cursor = Cursors.WaitCursor;
List<ProcedureInfo> pil = new List<ProcedureInfo>();
foreach (TreeNode tn in myProcedures.Keys)
@ -296,16 +306,16 @@ namespace VEPROMS
else
{
myFixes = new StringBuilder();
myFixesCount = 0;
int lastFixedCount = myFixesCount;
RefreshProcedureTransitions(pq);
// B2018-002 - Invalid Transitions - Update Transition Refresh Statistics
numTransConverted += ProcedureInfo.TranConvertCount;
numTransProcessed += ProcedureInfo.TranCheckCount;
numTransFixed += ProcedureInfo.TranFixCount = myFixesCount - lastFixedCount;
numTransFixed += ProcedureInfo.TranFixCount;
pbProcess.PerformStep();
Application.DoEvents();
}
}
if (numTransFixed == 0)
if (numTransFixed == 0 && numTransConverted ==0)
{
txtResults.AppendText("No Transitions Needed Updated.");
txtResults.AppendText(Environment.NewLine);
@ -316,7 +326,12 @@ namespace VEPROMS
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(string.Format("Transitions Checked: {0}",numTransProcessed));
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(string.Format("Transitions Fixed: {0}",numTransFixed));
// B2018-002 - Invalid Transitions - Display Transition Refresh Statistics
txtProcess.AppendText(string.Format("Transitions Correct As Is: {0}",numTransProcessed - (numTransConverted + numTransFixed)));
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(string.Format("Transitions Modified: {0}", numTransFixed));
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(string.Format("Transitions Converted to text: {0}", numTransConverted));
Application.DoEvents();
if (pil.Count > 0)
{
@ -340,10 +355,11 @@ namespace VEPROMS
}
}
this.Cursor = Cursors.Default;
if (numTransFixed == 0)
MessageBox.Show(string.Format("{0} Transitions Checked.\n\nNo Transitions needed fixed.",numTransProcessed), "Refresh Transitions Completed");
// B2018-002 - Invalid Transitions - Display Transition Refresh Statisitic
if (numTransFixed == 0 && numTransConverted ==0)
MessageBox.Show(string.Format("{0} Transitions Checked.\n\nNo Transitions Modified.",numTransProcessed), "Refresh Transitions Completed");
else
MessageBox.Show(string.Format("{0} Transitions Checked.\n\n {1} Transitions needed fixed.", numTransProcessed, numTransFixed), "Refresh Transitions Completed");
MessageBox.Show(string.Format("{0} Transitions Checked.\n\n {1} Correct as is.\n\n {2} Transitions modified.\n\n {3} Transitions converted to text.", numTransProcessed, numTransProcessed - (numTransFixed + numTransConverted),numTransFixed, numTransConverted), "Refresh Transitions Completed");
}
// C2017-030 - new Admin Tools user interface
@ -760,11 +776,12 @@ namespace VEPROMS
private void RefreshProcedureTransitions(ProcedureInfo pq)
{
DateTime start = DateTime.Now;
int lastFixesCount = myFixesCount;
ProcedureInfo.ResetTranCounters();
ProcedureInfo.RefreshTransitions(pq);//, transitionsToDisconnected, transitionsToNonEditable);
TimeSpan ts = DateTime.Now - start;
txtProcess.AppendText(string.Format("Procedure: {1}{0}Checked {2} Transitions{0}Fixed {3} Transitions{0}Elapsed Seconds:{4}{0}{0}", Environment.NewLine, pq.DisplayNumber, ProcedureInfo.TranCheckCount,myFixesCount - lastFixesCount, ts.TotalSeconds));
// B2018-002 - Invalid Transitions - Display Transition Refresh Statistics
txtProcess.AppendText(string.Format("Procedure: {1}{0}Checked {2} Transitions{0}Fixed {3} Transitions{0}Converted to Text {4} Transitions{0}Elapsed Seconds:{5}{0}{0}", Environment.NewLine, pq.DisplayNumber, ProcedureInfo.TranCheckCount, ProcedureInfo.TranFixCount, ProcedureInfo.TranConvertCount, ts.TotalSeconds));
//Console.WriteLine("\"{0}\"\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}", pq.DisplayNumber, ProcedureInfo.TranCheckCount, ProcedureInfo.TranFixCount, ProcedureInfo.TranConvertCount, ts.TotalSeconds, numTransProcessed, numTransFixed, numTransConverted);
if (myFixes.Length > 0)
{
txtResults.AppendText(myFixes.ToString());
@ -814,9 +831,11 @@ namespace VEPROMS
StringBuilder myFixes;
int myFixesCount = 0;
int myConvertCount = 0;
// show the changes made in the Results pannel, include the ItemId of the step element
void ContentInfo_StaticContentInfoChange(object sender, StaticContentInfoEventArgs args)
{
if (args.Type == "TX")
{
myFixesCount++;
@ -827,10 +846,14 @@ namespace VEPROMS
}
else if (args.Type == "RO")
{
txtResults.AppendText(string.Format("Fixed Referenced Object for {1}({4}){0}Old Text: {2}{0}New Text: {3}{0}{0}", Environment.NewLine, (sender as ItemInfo).ShortPath, args.OldValue, args.NewValue,(sender as ItemInfo).ItemID));
txtResults.AppendText(string.Format("Fixed Referenced Object for {1}({4}){0}Old Text: {2}{0}New Text: {3}{0}{0}", Environment.NewLine, (sender as ItemInfo).ShortPath, args.OldValue, args.NewValue, (sender as ItemInfo).ItemID));
Application.DoEvents();
//myFixes.AppendLine(string.Format("Fixed Referenced Object for {1}{0}Old Text: {2}{0}New Text: {3}{0}", Environment.NewLine, (sender as ItemInfo).ShortPath, args.OldValue, args.NewValue));
}
else // B2018-002 - Invalid Transitions - Display Transition Cconversion Statistics
{
myFixes.AppendLine(string.Format("Converted Transition to text for {0}({1})", (sender as ItemInfo).ShortPath, (sender as ItemInfo).ItemID));
}
}
private void btnClear_Click(object sender, EventArgs e)