Reputation: 1446
I am trying to write a query for all builds, but failed to understand the column [ScheduleTime] in the table [tbl_Schedule].
SELECT bd.DefinitionName 'Name', s.ScheduleTime 'ScheduleTime', s.ScheduleTime/1800 'Hour'
FROM [TFS_FTPDev].[dbo].[tbl_Schedule] s
inner join [TFS_FTPDev].[dbo].[tbl_BuildDefinition] bd on
bd.[DefinitionId]=s.[DefinitionId]
where ContinuousIntegrationType in (8,16)
order by s.ScheduleTime asc
If I divide by 3600, I get a sensible data, but it is not valid for all my builds... i.e. Build1 and build2 are scheduled for 13:00 for some days....
name ScheduleTime Hour
build1 43200 12
build2 43200 12
build3 68400 19
build4 77400 21.30
build5 79200 22
build6 82800 23
build7 84600 23.30
build8 84600 23.30
build9 84600 23.30
and the mapping is:
when 84600 then 23.30
when 79200 then 22
when 77400 then 21.30
when 68400 then 19
when 43200 then 12
UPDATE: [Using TFS API]
And this is the API results for a manually triggered/scheduled build...
And this is the subset of results
Upvotes: 1
Views: 476
Reputation: 8343
The documentation for ISchedule.StartTime Property says
Gets or sets the time as the number of seconds past midnight
So you should divide by 3600 to get the starting hour, the remainder divided by 60 is the starting minute within the hour. Am I missing anything?
Upvotes: 1
Reputation: 4787
I'm not really sure what you are asking but if you use 3,600 (60 seconds x 60 minutes) you get values as expected.
Your question regarding why some have schedules while being manual builds can be replicated by:
I would therefore suggest the builds that you are enquiring about have actually been cloned from another build and then the meta data changed, scheduled time seems not be cleared when a build is changed from scheduled to Non Scheduled. either that or at some point during their history they have had a scheduled time set, which has since been changed
Upvotes: 0
Reputation: 5223
Have you taken a look at the QueryBuilds method in the TFS Build API instead of reading from the database (which is unsupported)?
Upvotes: 1