コード例 #1
0
ファイル: Utilities.cs プロジェクト: joewstroman/monkeywrench
		public static TimeSpan GetDurationFromWorkView (DBWorkView2 step)
		{
			DateTime starttime = step.starttime.ToLocalTime ();
			DateTime endtime = step.endtime.ToLocalTime ();
			int duration = (int) (endtime - starttime).TotalSeconds;

			if (step.endtime.Year < DateTime.Now.Year - 1 && step.duration == 0) {// Not ended, endtime defaults to year 2000
				duration = (int) (DateTime.Now - starttime).TotalSeconds;
			} else if (step.endtime == DateTime.MinValue) {
				duration = step.duration;
			}

			return TimeSpan.FromSeconds (duration);
		}
コード例 #2
0
ファイル: GetData.cs プロジェクト: MSylvia/monkeywrench
		bool isValid(DBWorkView2 w)
		{
			bool hasUploadStep = w.command.Contains("upload-to-storage");
			bool isSuccessful  = (w.State == DBState.Success);
			bool hasContent    = (w.summary != null && w.summary.Contains(Filename));

			return new bool [] { hasUploadStep, isSuccessful, hasContent }.All(i => i == true);
		}
コード例 #3
0
		private Dictionary<String, Object> BuildStepStatus(int idx, DBWorkView2 step, List<DBWorkFileView> files, IEnumerable<DBFileLink> links)
		{
			var d = new Dictionary<String, Object>();
			var fs = BuildStepFilesAndLinks (files, links);

			d.Add ("duration", MonkeyWrench.Utilities.GetDurationFromWorkView (step).TotalSeconds);
			if (fs.Count != 0) {
				d.Add ("files", fs);
			}
			d.Add ("order", idx);
			d.Add ("step", step.command);
			d.Add ("status", step.State.ToString ().ToLowerInvariant ());

			return d;
		}