A fork of Gitea (see branch `mj`) adding Majority Judgment Polls 𐄷 over Issues and Merge Requests. https://git.mieuxvoter.fr
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

653 lines
16 KiB

Shows total tracked time in issue and milestone list (#3341) * Show total tracked time in issue and milestone list Show total tracked time at issue page Signed-off-by: Jonas Franz <info@jonasfranz.software> * Optimizing TotalTimes by using SumInt Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fixing wrong total times for milestones caused by a missing JOIN Adding unit tests for total times Signed-off-by: Jonas Franz <info@jonasfranz.software> * Logging error instead of ignoring it Signed-off-by: Jonas Franz <info@jonasfranz.software> * Correcting spelling mistakes Signed-off-by: Jonas Franz <info@jonasfranz.software> * Change error message to a short version Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add error handling to TotalTimes Add variable for totalTimes Signed-off-by: Jonas Franz <info@jonasfranz.de> * Introduce TotalTrackedTimes as variable of issue Load TotalTrackedTimes by loading attributes of IssueList Load TotalTrackedTimes by loading attributes of single issue Add Sec2Time as helper to use it in templates Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fixed test + gofmt Signed-off-by: Jonas Franz <info@jonasfranz.software> * Load TotalTrackedTimes via MilestoneList instead of single requests Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add documentation for MilestoneList Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add documentation for MilestoneList Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix test Signed-off-by: Jonas Franz <info@jonasfranz.software> * Change comment from SQL query to description Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix unit test by using int64 instead of int Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix unit test by using int64 instead of int Signed-off-by: Jonas Franz <info@jonasfranz.software> * Check if timetracker is enabled Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix test by enabling timetracking Signed-off-by: Jonas Franz <info@jonasfranz.de>
4 years ago
  1. // Copyright 2017 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package models
  5. import (
  6. "fmt"
  7. "strings"
  8. "code.gitea.io/gitea/modules/setting"
  9. api "code.gitea.io/gitea/modules/structs"
  10. "code.gitea.io/gitea/modules/timeutil"
  11. "xorm.io/builder"
  12. "xorm.io/xorm"
  13. )
  14. // Milestone represents a milestone of repository.
  15. type Milestone struct {
  16. ID int64 `xorm:"pk autoincr"`
  17. RepoID int64 `xorm:"INDEX"`
  18. Repo *Repository `xorm:"-"`
  19. Name string
  20. Content string `xorm:"TEXT"`
  21. RenderedContent string `xorm:"-"`
  22. IsClosed bool
  23. NumIssues int
  24. NumClosedIssues int
  25. NumOpenIssues int `xorm:"-"`
  26. Completeness int // Percentage(1-100).
  27. IsOverdue bool `xorm:"-"`
  28. DeadlineString string `xorm:"-"`
  29. DeadlineUnix timeutil.TimeStamp
  30. ClosedDateUnix timeutil.TimeStamp
  31. TotalTrackedTime int64 `xorm:"-"`
  32. }
  33. // BeforeUpdate is invoked from XORM before updating this object.
  34. func (m *Milestone) BeforeUpdate() {
  35. if m.NumIssues > 0 {
  36. m.Completeness = m.NumClosedIssues * 100 / m.NumIssues
  37. } else {
  38. m.Completeness = 0
  39. }
  40. }
  41. // AfterLoad is invoked from XORM after setting the value of a field of
  42. // this object.
  43. func (m *Milestone) AfterLoad() {
  44. m.NumOpenIssues = m.NumIssues - m.NumClosedIssues
  45. if m.DeadlineUnix.Year() == 9999 {
  46. return
  47. }
  48. m.DeadlineString = m.DeadlineUnix.Format("2006-01-02")
  49. if timeutil.TimeStampNow() >= m.DeadlineUnix {
  50. m.IsOverdue = true
  51. }
  52. }
  53. // State returns string representation of milestone status.
  54. func (m *Milestone) State() api.StateType {
  55. if m.IsClosed {
  56. return api.StateClosed
  57. }
  58. return api.StateOpen
  59. }
  60. // NewMilestone creates new milestone of repository.
  61. func NewMilestone(m *Milestone) (err error) {
  62. sess := x.NewSession()
  63. defer sess.Close()
  64. if err = sess.Begin(); err != nil {
  65. return err
  66. }
  67. m.Name = strings.TrimSpace(m.Name)
  68. if _, err = sess.Insert(m); err != nil {
  69. return err
  70. }
  71. if _, err = sess.Exec("UPDATE `repository` SET num_milestones = num_milestones + 1 WHERE id = ?", m.RepoID); err != nil {
  72. return err
  73. }
  74. return sess.Commit()
  75. }
  76. func getMilestoneByRepoID(e Engine, repoID, id int64) (*Milestone, error) {
  77. m := new(Milestone)
  78. has, err := e.ID(id).Where("repo_id=?", repoID).Get(m)
  79. if err != nil {
  80. return nil, err
  81. } else if !has {
  82. return nil, ErrMilestoneNotExist{ID: id, RepoID: repoID}
  83. }
  84. return m, nil
  85. }
  86. // GetMilestoneByRepoID returns the milestone in a repository.
  87. func GetMilestoneByRepoID(repoID, id int64) (*Milestone, error) {
  88. return getMilestoneByRepoID(x, repoID, id)
  89. }
  90. // GetMilestoneByRepoIDANDName return a milestone if one exist by name and repo
  91. func GetMilestoneByRepoIDANDName(repoID int64, name string) (*Milestone, error) {
  92. var mile Milestone
  93. has, err := x.Where("repo_id=? AND name=?", repoID, name).Get(&mile)
  94. if err != nil {
  95. return nil, err
  96. }
  97. if !has {
  98. return nil, ErrMilestoneNotExist{Name: name, RepoID: repoID}
  99. }
  100. return &mile, nil
  101. }
  102. // GetMilestoneByID returns the milestone via id .
  103. func GetMilestoneByID(id int64) (*Milestone, error) {
  104. var m Milestone
  105. has, err := x.ID(id).Get(&m)
  106. if err != nil {
  107. return nil, err
  108. } else if !has {
  109. return nil, ErrMilestoneNotExist{ID: id, RepoID: 0}
  110. }
  111. return &m, nil
  112. }
  113. // UpdateMilestone updates information of given milestone.
  114. func UpdateMilestone(m *Milestone, oldIsClosed bool) error {
  115. sess := x.NewSession()
  116. defer sess.Close()
  117. if err := sess.Begin(); err != nil {
  118. return err
  119. }
  120. if m.IsClosed && !oldIsClosed {
  121. m.ClosedDateUnix = timeutil.TimeStampNow()
  122. }
  123. if err := updateMilestone(sess, m); err != nil {
  124. return err
  125. }
  126. if err := updateMilestoneCompleteness(sess, m.ID); err != nil {
  127. return err
  128. }
  129. // if IsClosed changed, update milestone numbers of repository
  130. if oldIsClosed != m.IsClosed {
  131. if err := updateRepoMilestoneNum(sess, m.RepoID); err != nil {
  132. return err
  133. }
  134. }
  135. return sess.Commit()
  136. }
  137. func updateMilestone(e Engine, m *Milestone) error {
  138. m.Name = strings.TrimSpace(m.Name)
  139. _, err := e.ID(m.ID).AllCols().
  140. SetExpr("num_issues", builder.Select("count(*)").From("issue").Where(
  141. builder.Eq{"milestone_id": m.ID},
  142. )).
  143. SetExpr("num_closed_issues", builder.Select("count(*)").From("issue").Where(
  144. builder.Eq{
  145. "milestone_id": m.ID,
  146. "is_closed": true,
  147. },
  148. )).
  149. Update(m)
  150. return err
  151. }
  152. func updateMilestoneCompleteness(e Engine, milestoneID int64) error {
  153. _, err := e.Exec("UPDATE `milestone` SET completeness=100*num_closed_issues/(CASE WHEN num_issues > 0 THEN num_issues ELSE 1 END) WHERE id=?",
  154. milestoneID,
  155. )
  156. return err
  157. }
  158. // ChangeMilestoneStatusByRepoIDAndID changes a milestone open/closed status if the milestone ID is in the repo.
  159. func ChangeMilestoneStatusByRepoIDAndID(repoID, milestoneID int64, isClosed bool) error {
  160. sess := x.NewSession()
  161. defer sess.Close()
  162. if err := sess.Begin(); err != nil {
  163. return err
  164. }
  165. m := &Milestone{
  166. ID: milestoneID,
  167. RepoID: repoID,
  168. }
  169. has, err := sess.ID(milestoneID).Where("repo_id = ?", repoID).Get(m)
  170. if err != nil {
  171. return err
  172. } else if !has {
  173. return ErrMilestoneNotExist{ID: milestoneID, RepoID: repoID}
  174. }
  175. if err := changeMilestoneStatus(sess, m, isClosed); err != nil {
  176. return err
  177. }
  178. return sess.Commit()
  179. }
  180. // ChangeMilestoneStatus changes the milestone open/closed status.
  181. func ChangeMilestoneStatus(m *Milestone, isClosed bool) (err error) {
  182. sess := x.NewSession()
  183. defer sess.Close()
  184. if err = sess.Begin(); err != nil {
  185. return err
  186. }
  187. if err := changeMilestoneStatus(sess, m, isClosed); err != nil {
  188. return err
  189. }
  190. return sess.Commit()
  191. }
  192. func changeMilestoneStatus(e Engine, m *Milestone, isClosed bool) error {
  193. m.IsClosed = isClosed
  194. if isClosed {
  195. m.ClosedDateUnix = timeutil.TimeStampNow()
  196. }
  197. count, err := e.ID(m.ID).Where("repo_id = ? AND is_closed = ?", m.RepoID, !isClosed).Cols("is_closed", "closed_date_unix").Update(m)
  198. if err != nil {
  199. return err
  200. }
  201. if count < 1 {
  202. return nil
  203. }
  204. return updateRepoMilestoneNum(e, m.RepoID)
  205. }
  206. func changeMilestoneAssign(e *xorm.Session, doer *User, issue *Issue, oldMilestoneID int64) error {
  207. if err := updateIssueCols(e, issue, "milestone_id"); err != nil {
  208. return err
  209. }
  210. if oldMilestoneID > 0 {
  211. if err := updateMilestoneTotalNum(e, oldMilestoneID); err != nil {
  212. return err
  213. }
  214. if issue.IsClosed {
  215. if err := updateMilestoneClosedNum(e, oldMilestoneID); err != nil {
  216. return err
  217. }
  218. }
  219. }
  220. if issue.MilestoneID > 0 {
  221. if err := updateMilestoneTotalNum(e, issue.MilestoneID); err != nil {
  222. return err
  223. }
  224. if issue.IsClosed {
  225. if err := updateMilestoneClosedNum(e, issue.MilestoneID); err != nil {
  226. return err
  227. }
  228. }
  229. }
  230. if oldMilestoneID > 0 || issue.MilestoneID > 0 {
  231. if err := issue.loadRepo(e); err != nil {
  232. return err
  233. }
  234. var opts = &CreateCommentOptions{
  235. Type: CommentTypeMilestone,
  236. Doer: doer,
  237. Repo: issue.Repo,
  238. Issue: issue,
  239. OldMilestoneID: oldMilestoneID,
  240. MilestoneID: issue.MilestoneID,
  241. }
  242. if _, err := createComment(e, opts); err != nil {
  243. return err
  244. }
  245. }
  246. return nil
  247. }
  248. // ChangeMilestoneAssign changes assignment of milestone for issue.
  249. func ChangeMilestoneAssign(issue *Issue, doer *User, oldMilestoneID int64) (err error) {
  250. sess := x.NewSession()
  251. defer sess.Close()
  252. if err = sess.Begin(); err != nil {
  253. return err
  254. }
  255. if err = changeMilestoneAssign(sess, doer, issue, oldMilestoneID); err != nil {
  256. return err
  257. }
  258. if err = sess.Commit(); err != nil {
  259. return fmt.Errorf("Commit: %v", err)
  260. }
  261. return nil
  262. }
  263. // DeleteMilestoneByRepoID deletes a milestone from a repository.
  264. func DeleteMilestoneByRepoID(repoID, id int64) error {
  265. m, err := GetMilestoneByRepoID(repoID, id)
  266. if err != nil {
  267. if IsErrMilestoneNotExist(err) {
  268. return nil
  269. }
  270. return err
  271. }
  272. repo, err := GetRepositoryByID(m.RepoID)
  273. if err != nil {
  274. return err
  275. }
  276. sess := x.NewSession()
  277. defer sess.Close()
  278. if err = sess.Begin(); err != nil {
  279. return err
  280. }
  281. if _, err = sess.ID(m.ID).Delete(new(Milestone)); err != nil {
  282. return err
  283. }
  284. numMilestones, err := countRepoMilestones(sess, repo.ID)
  285. if err != nil {
  286. return err
  287. }
  288. numClosedMilestones, err := countRepoClosedMilestones(sess, repo.ID)
  289. if err != nil {
  290. return err
  291. }
  292. repo.NumMilestones = int(numMilestones)
  293. repo.NumClosedMilestones = int(numClosedMilestones)
  294. if _, err = sess.ID(repo.ID).Cols("num_milestones, num_closed_milestones").Update(repo); err != nil {
  295. return err
  296. }
  297. if _, err = sess.Exec("UPDATE `issue` SET milestone_id = 0 WHERE milestone_id = ?", m.ID); err != nil {
  298. return err
  299. }
  300. return sess.Commit()
  301. }
  302. // MilestoneList is a list of milestones offering additional functionality
  303. type MilestoneList []*Milestone
  304. func (milestones MilestoneList) getMilestoneIDs() []int64 {
  305. var ids = make([]int64, 0, len(milestones))
  306. for _, ms := range milestones {
  307. ids = append(ids, ms.ID)
  308. }
  309. return ids
  310. }
  311. // GetMilestonesOption contain options to get milestones
  312. type GetMilestonesOption struct {
  313. ListOptions
  314. RepoID int64
  315. State api.StateType
  316. Name string
  317. SortType string
  318. }
  319. // GetMilestones returns milestones filtered by GetMilestonesOption's
  320. func GetMilestones(opts GetMilestonesOption) (MilestoneList, error) {
  321. sess := x.Where("repo_id = ?", opts.RepoID)
  322. switch opts.State {
  323. case api.StateClosed:
  324. sess = sess.And("is_closed = ?", true)
  325. case api.StateAll:
  326. break
  327. // api.StateOpen:
  328. default:
  329. sess = sess.And("is_closed = ?", false)
  330. }
  331. if len(opts.Name) != 0 {
  332. sess = sess.And(builder.Like{"name", opts.Name})
  333. }
  334. if opts.Page != 0 {
  335. sess = opts.setSessionPagination(sess)
  336. }
  337. switch opts.SortType {
  338. case "furthestduedate":
  339. sess.Desc("deadline_unix")
  340. case "leastcomplete":
  341. sess.Asc("completeness")
  342. case "mostcomplete":
  343. sess.Desc("completeness")
  344. case "leastissues":
  345. sess.Asc("num_issues")
  346. case "mostissues":
  347. sess.Desc("num_issues")
  348. case "id":
  349. sess.Asc("id")
  350. default:
  351. sess.Asc("deadline_unix").Asc("id")
  352. }
  353. miles := make([]*Milestone, 0, opts.PageSize)
  354. return miles, sess.Find(&miles)
  355. }
  356. // SearchMilestones search milestones
  357. func SearchMilestones(repoCond builder.Cond, page int, isClosed bool, sortType string) (MilestoneList, error) {
  358. miles := make([]*Milestone, 0, setting.UI.IssuePagingNum)
  359. sess := x.Where("is_closed = ?", isClosed)
  360. if repoCond.IsValid() {
  361. sess.In("repo_id", builder.Select("id").From("repository").Where(repoCond))
  362. }
  363. if page > 0 {
  364. sess = sess.Limit(setting.UI.IssuePagingNum, (page-1)*setting.UI.IssuePagingNum)
  365. }
  366. switch sortType {
  367. case "furthestduedate":
  368. sess.Desc("deadline_unix")
  369. case "leastcomplete":
  370. sess.Asc("completeness")
  371. case "mostcomplete":
  372. sess.Desc("completeness")
  373. case "leastissues":
  374. sess.Asc("num_issues")
  375. case "mostissues":
  376. sess.Desc("num_issues")
  377. default:
  378. sess.Asc("deadline_unix")
  379. }
  380. return miles, sess.Find(&miles)
  381. }
  382. // GetMilestonesByRepoIDs returns a list of milestones of given repositories and status.
  383. func GetMilestonesByRepoIDs(repoIDs []int64, page int, isClosed bool, sortType string) (MilestoneList, error) {
  384. return SearchMilestones(
  385. builder.In("repo_id", repoIDs),
  386. page,
  387. isClosed,
  388. sortType,
  389. )
  390. }
  391. // ____ _ _
  392. // / ___|| |_ __ _| |_ ___
  393. // \___ \| __/ _` | __/ __|
  394. // ___) | || (_| | |_\__ \
  395. // |____/ \__\__,_|\__|___/
  396. //
  397. // MilestonesStats represents milestone statistic information.
  398. type MilestonesStats struct {
  399. OpenCount, ClosedCount int64
  400. }
  401. // Total returns the total counts of milestones
  402. func (m MilestonesStats) Total() int64 {
  403. return m.OpenCount + m.ClosedCount
  404. }
  405. // GetMilestonesStatsByRepoCond returns milestone statistic information for dashboard by given conditions.
  406. func GetMilestonesStatsByRepoCond(repoCond builder.Cond) (*MilestonesStats, error) {
  407. var err error
  408. stats := &MilestonesStats{}
  409. sess := x.Where("is_closed = ?", false)
  410. if repoCond.IsValid() {
  411. sess.And(builder.In("repo_id", builder.Select("id").From("repository").Where(repoCond)))
  412. }
  413. stats.OpenCount, err = sess.Count(new(Milestone))
  414. if err != nil {
  415. return nil, err
  416. }
  417. sess = x.Where("is_closed = ?", true)
  418. if repoCond.IsValid() {
  419. sess.And(builder.In("repo_id", builder.Select("id").From("repository").Where(repoCond)))
  420. }
  421. stats.ClosedCount, err = sess.Count(new(Milestone))
  422. if err != nil {
  423. return nil, err
  424. }
  425. return stats, nil
  426. }
  427. func countRepoMilestones(e Engine, repoID int64) (int64, error) {
  428. return e.
  429. Where("repo_id=?", repoID).
  430. Count(new(Milestone))
  431. }
  432. func countRepoClosedMilestones(e Engine, repoID int64) (int64, error) {
  433. return e.
  434. Where("repo_id=? AND is_closed=?", repoID, true).
  435. Count(new(Milestone))
  436. }
  437. // CountRepoClosedMilestones returns number of closed milestones in given repository.
  438. func CountRepoClosedMilestones(repoID int64) (int64, error) {
  439. return countRepoClosedMilestones(x, repoID)
  440. }
  441. // CountMilestonesByRepoCond map from repo conditions to number of milestones matching the options`
  442. func CountMilestonesByRepoCond(repoCond builder.Cond, isClosed bool) (map[int64]int64, error) {
  443. sess := x.Where("is_closed = ?", isClosed)
  444. if repoCond.IsValid() {
  445. sess.In("repo_id", builder.Select("id").From("repository").Where(repoCond))
  446. }
  447. countsSlice := make([]*struct {
  448. RepoID int64
  449. Count int64
  450. }, 0, 10)
  451. if err := sess.GroupBy("repo_id").
  452. Select("repo_id AS repo_id, COUNT(*) AS count").
  453. Table("milestone").
  454. Find(&countsSlice); err != nil {
  455. return nil, err
  456. }
  457. countMap := make(map[int64]int64, len(countsSlice))
  458. for _, c := range countsSlice {
  459. countMap[c.RepoID] = c.Count
  460. }
  461. return countMap, nil
  462. }
  463. func updateRepoMilestoneNum(e Engine, repoID int64) error {
  464. _, err := e.Exec("UPDATE `repository` SET num_milestones=(SELECT count(*) FROM milestone WHERE repo_id=?),num_closed_milestones=(SELECT count(*) FROM milestone WHERE repo_id=? AND is_closed=?) WHERE id=?",
  465. repoID,
  466. repoID,
  467. true,
  468. repoID,
  469. )
  470. return err
  471. }
  472. func updateMilestoneTotalNum(e Engine, milestoneID int64) (err error) {
  473. if _, err = e.Exec("UPDATE `milestone` SET num_issues=(SELECT count(*) FROM issue WHERE milestone_id=?) WHERE id=?",
  474. milestoneID,
  475. milestoneID,
  476. ); err != nil {
  477. return
  478. }
  479. return updateMilestoneCompleteness(e, milestoneID)
  480. }
  481. func updateMilestoneClosedNum(e Engine, milestoneID int64) (err error) {
  482. if _, err = e.Exec("UPDATE `milestone` SET num_closed_issues=(SELECT count(*) FROM issue WHERE milestone_id=? AND is_closed=?) WHERE id=?",
  483. milestoneID,
  484. true,
  485. milestoneID,
  486. ); err != nil {
  487. return
  488. }
  489. return updateMilestoneCompleteness(e, milestoneID)
  490. }
  491. // _____ _ _ _____ _
  492. // |_ _| __ __ _ ___| | _____ __| |_ _(_)_ __ ___ ___ ___
  493. // | || '__/ _` |/ __| |/ / _ \/ _` | | | | | '_ ` _ \ / _ \/ __|
  494. // | || | | (_| | (__| < __/ (_| | | | | | | | | | | __/\__ \
  495. // |_||_| \__,_|\___|_|\_\___|\__,_| |_| |_|_| |_| |_|\___||___/
  496. //
  497. func (milestones MilestoneList) loadTotalTrackedTimes(e Engine) error {
  498. type totalTimesByMilestone struct {
  499. MilestoneID int64
  500. Time int64
  501. }
  502. if len(milestones) == 0 {
  503. return nil
  504. }
  505. var trackedTimes = make(map[int64]int64, len(milestones))
  506. // Get total tracked time by milestone_id
  507. rows, err := e.Table("issue").
  508. Join("INNER", "milestone", "issue.milestone_id = milestone.id").
  509. Join("LEFT", "tracked_time", "tracked_time.issue_id = issue.id").
  510. Where("tracked_time.deleted = ?", false).
  511. Select("milestone_id, sum(time) as time").
  512. In("milestone_id", milestones.getMilestoneIDs()).
  513. GroupBy("milestone_id").
  514. Rows(new(totalTimesByMilestone))
  515. if err != nil {
  516. return err
  517. }
  518. defer rows.Close()
  519. for rows.Next() {
  520. var totalTime totalTimesByMilestone
  521. err = rows.Scan(&totalTime)
  522. if err != nil {
  523. return err
  524. }
  525. trackedTimes[totalTime.MilestoneID] = totalTime.Time
  526. }
  527. for _, milestone := range milestones {
  528. milestone.TotalTrackedTime = trackedTimes[milestone.ID]
  529. }
  530. return nil
  531. }
  532. func (m *Milestone) loadTotalTrackedTime(e Engine) error {
  533. type totalTimesByMilestone struct {
  534. MilestoneID int64
  535. Time int64
  536. }
  537. totalTime := &totalTimesByMilestone{MilestoneID: m.ID}
  538. has, err := e.Table("issue").
  539. Join("INNER", "milestone", "issue.milestone_id = milestone.id").
  540. Join("LEFT", "tracked_time", "tracked_time.issue_id = issue.id").
  541. Where("tracked_time.deleted = ?", false).
  542. Select("milestone_id, sum(time) as time").
  543. Where("milestone_id = ?", m.ID).
  544. GroupBy("milestone_id").
  545. Get(totalTime)
  546. if err != nil {
  547. return err
  548. } else if !has {
  549. return nil
  550. }
  551. m.TotalTrackedTime = totalTime.Time
  552. return nil
  553. }
  554. // LoadTotalTrackedTimes loads for every milestone in the list the TotalTrackedTime by a batch request
  555. func (milestones MilestoneList) LoadTotalTrackedTimes() error {
  556. return milestones.loadTotalTrackedTimes(x)
  557. }
  558. // LoadTotalTrackedTime loads the tracked time for the milestone
  559. func (m *Milestone) LoadTotalTrackedTime() error {
  560. return m.loadTotalTrackedTime(x)
  561. }