--- a/trac/versions.go Tue Sep 01 21:09:25 2020 -0500
+++ b/trac/versions.go Mon Sep 07 22:50:24 2020 -0500
@@ -8,29 +8,40 @@
+ Time sql.NullInt64 `db:"time"` Description sql.NullString `db:"description"`
func (e *environment) loadVersions() ([]youtrack.Version, error) {
- // we grab both the versions and the milestones as milestones are
- // essentially treated as the fix version in trac.
+ // we grab the values from the version and the milestone tables as well as + // the distinct values for version and milestone from each ticket to figure + // out what version are all here. In the Pidgin trac, milestones were + // essentially the fix version so it makes sense.
- a.name, a.time, a.description
- b.name, b.due as time, b.description
- trac_pidgin.milestone b
- (SELECT NULL FROM trac_pidgin.version c WHERE c.name = b.name)
+SELECT y.name, coalesce(y.time,0) AS time, y.description + SELECT x.name, x.time, x.description, row_number() OVER (PARTITION BY x.name ORDER BY rank) as rnum + SELECT a.name, a.time, a.description, 1 AS rank + FROM trac_pidgin.version a + SELECT b.name, b.due as time, b.description, 2 + FROM trac_pidgin.milestone b + SELECT t1.version, NULL, NULL, 3 + FROM trac_pidgin.ticket t1 + WHERE t1.version IS NOT NULL AND t1.version != '' + SELECT t1.milestone, NULL, NULL, 4 + FROM trac_pidgin.ticket t1 + WHERE t1.milestone IS NOT NULL AND t1.milestone != '' ytVersions := make([]youtrack.Version, len(versions))
@@ -47,9 +58,9 @@
Description: convertString(v.Description),
ytVersion.Released = true
- ytVersion.ReleaseDate = convertTime(v.Time)
+ ytVersion.ReleaseDate = convertTime(v.Time.Int64)