mirror of
https://github.com/hanzoai/forge.git
synced 2026-10-30 15:00:39 +00:00
Source files keep their SPDX-License-Identifier and Hanzo copyright line; the Gitea, Gogs and LFS Test Server copyrights they used to repeat now live once in NOTICE, alongside LICENSE. The header lint accepts any copyright line above the SPDX line, so it no longer demands an upstream one. Co-authored-by: Hanzo Dev <[email protected]>
25 lines
737 B
Go
25 lines
737 B
Go
// Copyright 2026 Hanzo AI, Inc. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package v1_26
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/hanzoai/git/models/db"
|
|
)
|
|
|
|
func FixClosedMilestoneCompleteness(x db.EngineMigration) error {
|
|
// Update all milestones to recalculate completeness with the new logic:
|
|
// - Closed milestones with 0 issues should show 100%
|
|
// - All other milestones should calculate based on closed/total ratio
|
|
_, err := x.Exec("UPDATE `milestone` SET completeness=(CASE WHEN is_closed = ? AND num_issues = 0 THEN 100 ELSE 100*num_closed_issues/(CASE WHEN num_issues > 0 THEN num_issues ELSE 1 END) END)",
|
|
true,
|
|
)
|
|
if err != nil {
|
|
return fmt.Errorf("error updating milestone completeness: %w", err)
|
|
}
|
|
|
|
return nil
|
|
}
|