Example #1
0
        private void gridSubs_TitleAddClick(object sender, EventArgs e)
        {
            FormBugSubmissions FormBS = new FormBugSubmissions(viewMode: FormBugSubmissionMode.SelectionMode);

            if (FormBS.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            _listBugSubs.AddRange(FormBS.ListSelectedSubs);
            FillGrid();
        }
Example #2
0
        private void gridCustomerSubs_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            if (e.Row == -1 || comboGrouping.SelectedIndex == 0)         //0=None
            {
                return;
            }
            List <BugSubmission> listSubGroup     = ((List <BugSubmission>)gridSubs.Rows[gridSubs.GetSelectedIndex()].Tag);
            FormBugSubmissions   formGroupBugSubs = new FormBugSubmissions(viewMode: FormBugSubmissionMode.ViewOnly);

            formGroupBugSubs.ListViewedSubs = listSubGroup;
            formGroupBugSubs.ShowDialog();
        }
Example #3
0
        private void butViewSubs_Click(object sender, EventArgs e)
        {
            if (_isLoading)
            {
                return;
            }
            FormBugSubmissions FormBugSubs = new FormBugSubmissions(_jobCur);

            if (FormBugSubs.ShowDialog() == DialogResult.OK && FormBugSubs.BugCur != null)         //Bug was created.
            {
                BugCur       = FormBugSubs.BugCur;
                DialogResult = DialogResult.OK;
            }
        }
Example #4
0
        ///<summary></summary>
        public static bool TryAssociateSimilarBugSubmissions(List <BugSubmission> listAllSubs, Point pointFormLocaiton)
        {
            List <BugSubmission> listUnattachedSubs = listAllSubs.Where(x => x.BugId == 0).ToList();

            if (listUnattachedSubs.Count == 0)
            {
                MsgBox.Show("FormBugSubmissions", "All submissions are associated to bugs already.");
                return(false);
            }
            //Dictionary where key is a BugId and the value is list of submissions associated to that BugID.
            //StackTraces are unique and if there are duplicate stack trace entries we select the one with the newest version.
            Dictionary <long, List <BugSubmission> > dictAttachedSubs = listAllSubs.Where(x => x.BugId != 0)
                                                                        .GroupBy(x => x.BugId)
                                                                        .ToDictionary(x => x.Key, x =>
                                                                                      x.GroupBy(y => y.ExceptionStackTrace)
                                                                                      //Sub dictionary of unique ExceptionStackStraces as the key and the value is the submission from the highest version.
                                                                                      .ToDictionary(y => y.Key, y => y.OrderByDescending(z => new Version(z.Info.DictPrefValues[PrefName.ProgramVersion])).First())
                                                                                      .Values.ToList()
                                                                                      );
            Dictionary <long, List <BugSubmission> > dictSimilarBugSubs = new Dictionary <long, List <BugSubmission> >();
            List <long> listOrderedKeys = dictAttachedSubs.Keys.OrderByDescending(x => x).ToList();

            foreach (long key in listOrderedKeys)             //Loop through submissions that are already attached to bugs
            {
                dictSimilarBugSubs[key] = new List <BugSubmission>();
                foreach (BugSubmission sub in dictAttachedSubs[key])                 //Loop through the unique exception text from the submission with thie highest reported version.
                {
                    List <BugSubmission> listSimilarBugSubs = listUnattachedSubs.Where(x =>
                                                                                       x.ExceptionStackTrace == sub.ExceptionStackTrace//Find submissions that are not attached to bugs with identical ExceptionStackTrace
                                                                                       ).ToList();
                    if (listSimilarBugSubs.Count == 0)
                    {
                        continue;                        //All submissions with this stack trace are attached to a bug.
                    }
                    listUnattachedSubs.RemoveAll(x => listSimilarBugSubs.Contains(x));
                    dictSimilarBugSubs[key].AddRange(listSimilarBugSubs);
                }
            }
            if (dictSimilarBugSubs.All(x => x.Value.Count == 0))
            {
                MsgBox.Show("FormBugSubmissions", "All similar submissions are already attached to bugs.  No action needed.");
                return(false);
            }
            dictSimilarBugSubs = dictSimilarBugSubs.Where(x => x.Value.Count != 0).ToDictionary(x => x.Key, x => x.Value);
            bool isAutoAssign = (MsgBox.Show("FormBugSubmissions", MsgBoxButtons.YesNo, "Click Yes to auto attach duplicate submissions to bugs with identical stack traces?"
                                             + "\r\nClick No to manually validate all groupings found."));
            List <long>    listBugIds = listAllSubs.Where(x => x.BugId != 0).Select(x => x.BugId).ToList();
            List <JobLink> listLinks  = JobLinks.GetManyForType(JobLinkType.Bug, listBugIds);
            List <Bug>     listBugs   = Bugs.GetMany(listBugIds);

            foreach (KeyValuePair <long, List <BugSubmission> > pair in dictSimilarBugSubs)
            {
                Bug bugFixed = listBugs.FirstOrDefault(x => x.BugId == pair.Key && !string.IsNullOrEmpty(x.VersionsFixed));
                if (bugFixed != null)
                {
                    List <BugSubmission> listIssueSubs = pair.Value.Where(x => new Version(x.Info.DictPrefValues[PrefName.ProgramVersion]) >= new Version(bugFixed.VersionsFixed.Split(';').Last())).ToList();
                    if (listIssueSubs.Count > 0)
                    {
                        MsgBox.Show("FormBugSubmissions", "There appears to be a submission on a version that is newer than the previous fixed bug version (BugId: " + POut.Long(bugFixed.BugId) + ").  "
                                    + "These will be excluded.");
                        //TODO: Allow user to view these excluded submissions somehow.
                        pair.Value.RemoveAll(x => listIssueSubs.Contains(x));
                        if (pair.Value.Count == 0)
                        {
                            continue;
                        }
                    }
                }
                if (!isAutoAssign)
                {
                    FormBugSubmissions formGroupBugSubs = new FormBugSubmissions(viewMode: FormBugSubmissionMode.ValidationMode);
                    formGroupBugSubs.ListViewedSubs = pair.Value;                         //Add unnattached submissions to grid
                    formGroupBugSubs.ListViewedSubs.AddRange(dictAttachedSubs[pair.Key]); //Add already attached submissions to grid
                    formGroupBugSubs.StartPosition = FormStartPosition.Manual;
                    Point newLoc = pointFormLocaiton;
                    newLoc.X += 10;                  //Offset
                    newLoc.Y += 10;
                    formGroupBugSubs.Location = newLoc;
                    if (formGroupBugSubs.ShowDialog() != DialogResult.OK)
                    {
                        continue;
                    }
                }
                BugSubmissions.UpdateBugIds(pair.Key, pair.Value.Select(x => x.BugSubmissionNum).ToList());
            }
            MsgBox.Show("FormBugSubmissions", "Done.");
            return(true);
        }
Example #5
0
        public static bool TryAssociateSimilarBugSubmissions(Point pointFormLocaiton)
        {
            List <BugSubmission> listAllSubs        = BugSubmissions.GetAll();
            List <BugSubmission> listUnattachedSubs = listAllSubs.Where(x => x.BugId == 0).ToList();

            if (listUnattachedSubs.Count == 0)
            {
                MsgBox.Show("FormBugSubmissions", "All submissions are associated to bugs already.");
                return(false);
            }
            //Dictionary where key is a BugId and the value is list of submissions associated to that BugID.
            //StackTraces are unique and if there are duplicate stack trace entries we select the one with the newest version.
            Dictionary <long, List <BugSubmission> > dictAttachedSubs = listAllSubs.Where(x => x.BugId != 0)
                                                                        .GroupBy(x => x.BugId)
                                                                        .ToDictionary(x => x.Key, x =>
                                                                                      x.GroupBy(y => y.ExceptionStackTrace)
                                                                                      //Sub dictionary of unique ExceptionStackStraces as the key and the value is the submission from the highest version.
                                                                                      .ToDictionary(y => y.Key, y => y.OrderByDescending(z => new Version(z.Info.DictPrefValues[PrefName.ProgramVersion])).First())
                                                                                      .Values.ToList()
                                                                                      );
            Dictionary <long, List <BugSubmission> > dictSimilarBugSubs = new Dictionary <long, List <BugSubmission> >();
            List <long> listOrderedKeys = dictAttachedSubs.Keys.OrderByDescending(x => x).ToList();

            foreach (long key in listOrderedKeys)             //Loop through submissions that are already attached to bugs
            {
                dictSimilarBugSubs[key] = new List <BugSubmission>();
                foreach (BugSubmission sub in dictAttachedSubs[key])                 //Loop through the unique exception text from the submission with thie highest reported version.
                {
                    List <BugSubmission> listSimilarBugSubs = listUnattachedSubs.Where(x =>
                                                                                       x.ExceptionStackTrace == sub.ExceptionStackTrace//Find submissions that are not attached to bugs with identical ExceptionStackTrace
                                                                                       ).ToList();
                    if (listSimilarBugSubs.Count == 0)
                    {
                        continue;                        //All submissions with this stack trace are attached to a bug.
                    }
                    listUnattachedSubs.RemoveAll(x => listSimilarBugSubs.Contains(x));
                    dictSimilarBugSubs[key].AddRange(listSimilarBugSubs);
                }
            }
            if (dictSimilarBugSubs.All(x => x.Value.Count == 0))
            {
                MsgBox.Show("FormBugSubmissions", "All similar submissions are already attached to bugs.  No action needed.");
                return(false);
            }
            dictSimilarBugSubs = dictSimilarBugSubs.Where(x => x.Value.Count != 0).ToDictionary(x => x.Key, x => x.Value);
            bool isAutoAssign = (MsgBox.Show("FormBugSubmissions", MsgBoxButtons.YesNo, "Click Yes to auto attach duplicate submissions to bugs with identical stack traces?"
                                             + "\r\nClick No to manually validate all groupings found."));
            List <long>    listBugIds            = listAllSubs.Where(x => x.BugId != 0).Select(x => x.BugId).ToList();
            List <JobLink> listLinks             = JobLinks.GetManyForType(JobLinkType.Bug, listBugIds);
            List <Bug>     listBugs              = Bugs.GetMany(listBugIds);
            StringBuilder  issueSubmissionPrompt = new StringBuilder();

            foreach (KeyValuePair <long, List <BugSubmission> > pair in dictSimilarBugSubs)
            {
                Bug bugFixed = listBugs.FirstOrDefault(x => x.BugId == pair.Key && !string.IsNullOrEmpty(x.VersionsFixed));
                if (bugFixed != null)
                {
                    List <BugSubmission> listIssueSubs = pair.Value.Where(x => new Version(x.Info.DictPrefValues[PrefName.ProgramVersion]) >= new Version(bugFixed.VersionsFixed.Split(';').Last())).ToList();
                    if (listIssueSubs.Count > 0)
                    {
                        List <JobLink> listBugJobLinks = listLinks.FindAll(x => x.FKey == bugFixed.BugId);
                        List <Job>     listBugJobs     = Jobs.GetMany(listBugJobLinks.Select(x => x.JobNum).ToList());
                        if (issueSubmissionPrompt.Length == 0)
                        {
                            issueSubmissionPrompt.AppendLine("The following completed jobs have submissions from newer versions then the jobs reported fixed version: ");
                        }
                        listBugJobs.ForEach(x => issueSubmissionPrompt.AppendLine("- " + " (" + x.Category.ToString().Substring(0, 1) + x.JobNum + ")" + x.Title));
                        pair.Value.RemoveAll(x => listIssueSubs.Contains(x));
                        if (pair.Value.Count == 0)
                        {
                            continue;
                        }
                    }
                }
                if (!isAutoAssign)
                {
                    FormBugSubmissions formGroupBugSubs = new FormBugSubmissions(viewMode: FormBugSubmissionMode.ValidationMode);
                    formGroupBugSubs.ListViewedSubs = pair.Value;                         //Add unnattached submissions to grid
                    formGroupBugSubs.ListViewedSubs.AddRange(dictAttachedSubs[pair.Key]); //Add already attached submissions to grid
                    formGroupBugSubs.StartPosition = FormStartPosition.Manual;
                    Point newLoc = pointFormLocaiton;
                    newLoc.X += 10;                  //Offset
                    newLoc.Y += 10;
                    formGroupBugSubs.Location = newLoc;
                    if (formGroupBugSubs.ShowDialog() != DialogResult.OK)
                    {
                        continue;
                    }
                }
                BugSubmissions.UpdateBugIds(pair.Key, pair.Value.Select(x => x.BugSubmissionNum).ToList());
            }
            string msg = "";

            dictSimilarBugSubs.Keys.ToList().FindAll(x => dictSimilarBugSubs[x].Count > 0)
            .ForEach(x => msg += "Bug: " + x + " Found submissions: " + dictSimilarBugSubs[x].Count + "\r\n");
            msg += issueSubmissionPrompt.ToString();
            new MsgBoxCopyPaste(msg)
            {
                Text = "Done"
            }.ShowDialog();
            return(true);
        }