我目前正在从拉力赛中手动取出以下报告
正在进行(Q2-1)发布(当前)
这个版本的14个功能,其中4个由开发团队处理。 1完成。 1阻止等待进一步信息。休息尚未分配/等待进一步发现
随着(Q1-2)的发布(上一篇)
这个版本中有12个功能,其中2个仍由开发团队处理,8个完成。休息尚未分配/等待进一步发现
o团队能够以13.5分关闭9个美国和4个缺陷。 4美国分裂到下一个冲刺8 DE
我正在尝试使用我可以手动运行的控制台应用程序或设置为每周运行的任务来自动执行此操作。我想知道以下内容:
我已经编写了代码来进行身份验证,我目前正在进行所有正在发布的工作
答案 0 :(得分:0)
确保输入输入的人员保持一致。如果人类输入不一致,这段代码不会给出好的结果。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
namespace ConsoleApplication1
{
class Program
{
const string FILENAME = @"c:\temp\test.txt";
static void Main(string[] args)
{
Report report = new Report(FILENAME);
report.Print();
Console.ReadLine();
}
}
public class Report
{
public static List<Report> reports = new List<Report>();
public static int numberClosed { get; set; }
public static int defects { get; set; }
public static decimal points { get; set; }
public string quarter { get; set; }
public string release { get; set; }
public int numberFeatures { get; set; }
public int worked { get; set; }
public int completed { get; set; }
string patternWith = @"With the ongoing of \((?'quarter'[^\)]+)\) release \((?'release'[^\)]+)\)";
string patternFeature = "features";
string patternClose = "Team was able to close";
string patternNumbers = @"\d+(.\d+)?";
Match match = null;
MatchCollection matches = null;
public Report() { }
public Report(string filename)
{
StreamReader reader = new StreamReader(filename);
Report report = null;
string inputLine = "";
while((inputLine = reader.ReadLine()) != null)
{
inputLine = inputLine.Trim();
if(inputLine.Length > 0)
{
match = Regex.Match(inputLine, patternWith);
if(match.Success)
{
report = new Report();
reports.Add(report);
report.quarter = match.Groups["quarter"].Value;
report.release = match.Groups["release"].Value;
continue;
}
match = Regex.Match(inputLine, patternFeature);
if (match.Success)
{
matches = Regex.Matches(inputLine, patternNumbers);
report.numberFeatures = int.Parse(matches[0].Value);
report.worked = int.Parse(matches[1].Value);
report.completed = int.Parse(matches[2].Value);
continue;
}
match = Regex.Match(inputLine, patternClose);
if (match.Success)
{
matches = Regex.Matches(inputLine, patternNumbers);
Report.numberClosed = int.Parse(matches[0].Value);
Report.defects = int.Parse(matches[1].Value);
Report.points = decimal.Parse(matches[2].Value);
break;
}
}
}
reader.Close();
}
public void Print()
{
Console.WriteLine("Summary : Reports = '{0}', Closed = '{1}', Defects = '{2}', Points = '{3}'",
Report.reports.Count,
Report.numberClosed,
Report.defects,
Report.points);
foreach (Report report in Report.reports)
{
Console.WriteLine("Quarter : '{0}', Release : '{1}', Features : '{2}', Worked : '{3}', Completed : '{4}'",
report.quarter,
report.release,
report.numberFeatures,
report.worked,
report.completed);
}
}
}
}
答案 1 :(得分:0)
我写了一个超级糟糕的代码来完成这项工作。由于这只是我在空闲时间尝试做的事情,以自动化我正在做的手工工作,我没有花太多时间遵循标准。但它的确有效。以下网站对我帮助很大。它有一些示例项目可以帮助您开始。
https://github.com/nmusaelian-rally/rally-dot-net-rest-apps
如果有人想要我提出的问题的具体答案,请在这里发表评论,我一定会帮助你