Commit b393d50e authored by zauberstuhl's avatar zauberstuhl

Fix order in Build.FindLastByProjectID

parent f1638589
......@@ -75,7 +75,7 @@ func reportsBadge(fqdn, slug string, w http.ResponseWriter, r *http.Request) {
return
}
reports, err := build.GetReport()
reports, err := build.GetReports()
if err != nil {
logger.Println(err)
http.NotFound(w, r)
......
......@@ -139,7 +139,7 @@ func (build *Build) get(method, path string, values url.Values) (raw []byte, err
return raw, nil
}
func (build *Build) GetReport() (reports []string, err error) {
func (build *Build) GetReports() (reports []string, err error) {
jobs := []struct {ID int `json:"id"`}{}
raw, err := build.get("GET", fmt.Sprintf("/projects/%d/pipelines/%d/jobs",
confd.IntDefault("gitlab.project.id", 102), build.PipelineID), url.Values{})
......
......@@ -160,5 +160,6 @@ func (build *Build) FindLastByProjectID(id uint) error {
}
defer db.Close()
return db.Where("project_id = ?", id).First(build).Order("id desc").Error
return db.Where("project_id = ?", id).
Order("pipeline_id desc").First(build).Error
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment