private TreeViewItem GetUserOneTopicSummary(ArgPointReport report, bool totalUser) { var txt = " No. of points " + report.numPoints + "\r\n"; txt += " No. of points with description " + report.numPointsWithDescriptions + "\r\n"; txt += " No. of media attachments " + report.numMediaAttachments + "\r\n"; txt += " No. of sources " + report.numSources + "\r\n"; txt += " No. of comments " + report.numComments; var tb = new TextBlock(); tb.Text = txt; var tvi = new TreeViewItem(); tvi.Items.Add(tb); if (!totalUser) { var usrId = report.user.Id; foreach (var ap in report.topic.ArgPoint.Where(ap0 => ap0.Person.Id == usrId)) { tvi.Items.Add(GetPointReport(ap)); } } if (report.topic != null && !totalUser) { tvi.Header = report.topic.Name; } else { tvi.Header = "<total user, all topics>"; } return(tvi); }
private TreeViewItem GetUserOneTopicSummary(ArgPointReport report, bool totalUser) { var txt = " No. of points " + report.numPoints + "\r\n"; txt += " No. of points with description " + report.numPointsWithDescriptions + "\r\n"; txt += " No. of media attachments " + report.numMediaAttachments + "\r\n"; txt += " No. of sources " + report.numSources + "\r\n"; txt += " No. of comments " + report.numComments; var tb = new TextBlock(); tb.Text = txt; var tvi = new TreeViewItem(); tvi.Items.Add(tb); if (!totalUser) { var usrId = report.user.Id; foreach (var ap in report.topic.ArgPoint.Where(ap0 => ap0.Person.Id == usrId)) tvi.Items.Add(GetPointReport(ap)); } if (report.topic != null && !totalUser) tvi.Header = report.topic.Name; else tvi.Header = "<total user, all topics>"; return tvi; }
private void prepareArgPointReports() { foreach (var topic in topics) foreach (var ap in topic.ArgPoint) { //comments can be by different users foreach (var c in ap.Comment) { if (c.Person == null) continue; //for placeholders if (!_reportParams.requiredUsers.Contains(c.Person.Id)) continue; if (!ArgPointReports.ContainsKey(c.Person.Id)) ArgPointReports.Add(c.Person.Id, new List<ArgPointReport>()); var reportsOfCommenter = ArgPointReports[c.Person.Id]; if (c.Text != "New feedback") { var topicReportOfCommenter = FindTopicArgPointReport(reportsOfCommenter, ap.Topic.Id); if (topicReportOfCommenter == null) { topicReportOfCommenter = new ArgPointReport(0, 0, 0, 0, 0, c.Person, topic); reportsOfCommenter.Add(topicReportOfCommenter); } topicReportOfCommenter.numComments += 1; } } foreach (var at in ap.Attachment) { if (!_reportParams.requiredUsers.Contains(at.Person.Id)) continue; switch ((AttachmentFormat) at.Format) { case AttachmentFormat.Bmp: ++_numImagesInSession; break; case AttachmentFormat.Jpg: ++_numImagesInSession; break; case AttachmentFormat.Png: ++_numImagesInSession; break; case AttachmentFormat.Pdf: ++_numPdfInSession; break; case AttachmentFormat.PngScreenshot: ++_numScreenshotsInSession; break; case AttachmentFormat.Youtube: ++_numYoutubeInSession; break; default: throw new NotSupportedException(); } } if (!_reportParams.requiredUsers.Contains(ap.Person.Id)) continue; if (!ArgPointReports.ContainsKey(ap.Person.Id)) ArgPointReports.Add(ap.Person.Id, new List<ArgPointReport>()); var reportsInTopic = ArgPointReports[ap.Person.Id]; var topicReportOfSelf = FindTopicArgPointReport(reportsInTopic, ap.Topic.Id); if (topicReportOfSelf == null) { topicReportOfSelf = new ArgPointReport(0, 0, 0, 0, 0, ap.Person, topic); reportsInTopic.Add(topicReportOfSelf); } topicReportOfSelf.numMediaAttachments += ap.Attachment.Count(); topicReportOfSelf.numPoints += 1; if (ap.Description.Text != "Description") topicReportOfSelf.numPointsWithDescriptions++; topicReportOfSelf.numSources += ap.Description.Source.Count(); } //fill out users who don't have points foreach (var topic in topics) { foreach (var p in topic.Person) { if (!_reportParams.requiredUsers.Contains(p.Id)) continue; if (!ArgPointReports.ContainsKey(p.Id)) ArgPointReports.Add(p.Id, new List<ArgPointReport>()); var topicReports = ArgPointReports[p.Id]; var topicReportOfPers = FindTopicArgPointReport(topicReports, topic.Id); if (topicReportOfPers == null) { topicReports.Add(new ArgPointReport(0, 0, 0, 0, 0, p, topic)); } } } //total over all users foreach (var apReport in ArgPointReports.Values) foreach (var userTopicReport in apReport) { TotalArgPointReport.numComments += userTopicReport.numComments; TotalArgPointReport.numMediaAttachments += userTopicReport.numMediaAttachments; TotalArgPointReport.numPoints += userTopicReport.numPoints; TotalArgPointReport.numPointsWithDescriptions += userTopicReport.numPointsWithDescriptions; TotalArgPointReport.numSources += userTopicReport.numSources; } //avg var n = ArgPointReports.Count(); AvgArgPointReport.numComments = (double) TotalArgPointReport.numComments/n; AvgArgPointReport.numMediaAttachments = (double) TotalArgPointReport.numMediaAttachments/n; AvgArgPointReport.numPoints = (double) TotalArgPointReport.numPoints/n; AvgArgPointReport.numPointsWithDescriptions = (double) TotalArgPointReport.numPointsWithDescriptions/n; AvgArgPointReport.numSources = (double) TotalArgPointReport.numSources/n; }
private void prepareArgPointReports() { foreach (var topic in topics) { foreach (var ap in topic.ArgPoint) { //comments can be by different users foreach (var c in ap.Comment) { if (c.Person == null) { continue; //for placeholders } if (!_reportParams.requiredUsers.Contains(c.Person.Id)) { continue; } if (!ArgPointReports.ContainsKey(c.Person.Id)) { ArgPointReports.Add(c.Person.Id, new List <ArgPointReport>()); } var reportsOfCommenter = ArgPointReports[c.Person.Id]; if (c.Text != "New feedback") { var topicReportOfCommenter = FindTopicArgPointReport(reportsOfCommenter, ap.Topic.Id); if (topicReportOfCommenter == null) { topicReportOfCommenter = new ArgPointReport(0, 0, 0, 0, 0, c.Person, topic); reportsOfCommenter.Add(topicReportOfCommenter); } topicReportOfCommenter.numComments += 1; } } foreach (var at in ap.Attachment) { if (!_reportParams.requiredUsers.Contains(at.Person.Id)) { continue; } switch ((AttachmentFormat)at.Format) { case AttachmentFormat.Bmp: ++_numImagesInSession; break; case AttachmentFormat.Jpg: ++_numImagesInSession; break; case AttachmentFormat.Png: ++_numImagesInSession; break; case AttachmentFormat.Pdf: ++_numPdfInSession; break; case AttachmentFormat.PngScreenshot: ++_numScreenshotsInSession; break; case AttachmentFormat.Youtube: ++_numYoutubeInSession; break; default: throw new NotSupportedException(); } } if (!_reportParams.requiredUsers.Contains(ap.Person.Id)) { continue; } if (!ArgPointReports.ContainsKey(ap.Person.Id)) { ArgPointReports.Add(ap.Person.Id, new List <ArgPointReport>()); } var reportsInTopic = ArgPointReports[ap.Person.Id]; var topicReportOfSelf = FindTopicArgPointReport(reportsInTopic, ap.Topic.Id); if (topicReportOfSelf == null) { topicReportOfSelf = new ArgPointReport(0, 0, 0, 0, 0, ap.Person, topic); reportsInTopic.Add(topicReportOfSelf); } topicReportOfSelf.numMediaAttachments += ap.Attachment.Count(); topicReportOfSelf.numPoints += 1; if (ap.Description.Text != "Description") { topicReportOfSelf.numPointsWithDescriptions++; } topicReportOfSelf.numSources += ap.Description.Source.Count(); } } //fill out users who don't have points foreach (var topic in topics) { foreach (var p in topic.Person) { if (!_reportParams.requiredUsers.Contains(p.Id)) { continue; } if (!ArgPointReports.ContainsKey(p.Id)) { ArgPointReports.Add(p.Id, new List <ArgPointReport>()); } var topicReports = ArgPointReports[p.Id]; var topicReportOfPers = FindTopicArgPointReport(topicReports, topic.Id); if (topicReportOfPers == null) { topicReports.Add(new ArgPointReport(0, 0, 0, 0, 0, p, topic)); } } } //total over all users foreach (var apReport in ArgPointReports.Values) { foreach (var userTopicReport in apReport) { TotalArgPointReport.numComments += userTopicReport.numComments; TotalArgPointReport.numMediaAttachments += userTopicReport.numMediaAttachments; TotalArgPointReport.numPoints += userTopicReport.numPoints; TotalArgPointReport.numPointsWithDescriptions += userTopicReport.numPointsWithDescriptions; TotalArgPointReport.numSources += userTopicReport.numSources; } } //avg var n = ArgPointReports.Count(); AvgArgPointReport.numComments = (double)TotalArgPointReport.numComments / n; AvgArgPointReport.numMediaAttachments = (double)TotalArgPointReport.numMediaAttachments / n; AvgArgPointReport.numPoints = (double)TotalArgPointReport.numPoints / n; AvgArgPointReport.numPointsWithDescriptions = (double)TotalArgPointReport.numPointsWithDescriptions / n; AvgArgPointReport.numSources = (double)TotalArgPointReport.numSources / n; }