Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix latest analayis report. #504

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions api/analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func (h AnalysisHandler) AppLatest(ctx *gin.Context) {
return
}
writer := AnalysisWriter{ctx: ctx}
path, err := writer.Create(id)
path, err := writer.Create(m.ID)
if err != nil {
_ = ctx.Error(err)
return
Expand All @@ -152,8 +152,16 @@ func (h AnalysisHandler) AppLatest(ctx *gin.Context) {
// @param id path string true "Application ID"
func (h AnalysisHandler) AppLatestReport(ctx *gin.Context) {
id := h.pk(ctx)
m := &model.Analysis{}
db := h.DB(ctx)
db = db.Where("ApplicationID", id)
err := db.Last(&m).Error
if err != nil {
_ = ctx.Error(err)
return
}
reportWriter := ReportWriter{ctx: ctx}
reportWriter.Write(id)
reportWriter.Write(m.ID)
}

// AppList godoc
Expand Down Expand Up @@ -2315,6 +2323,7 @@ func (r *ReportWriter) buildOutput(id uint) (path string, err error) {
r.begin()
r.field("id").write(strconv.Itoa(int(m.Application.ID)))
r.field("name").writeStr(m.Application.Name)
r.field("analysis").writeStr(strconv.Itoa(int(m.ID)))
Copy link
Contributor Author

@jortel jortel Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:hint: injecting this for troubleshooting. Ignored by the report js.

aWriter := AnalysisWriter{ctx: r.ctx}
aWriter.encoder = r.encoder
err = aWriter.addIssues(m)
Expand Down
Loading