mirror of
https://github.com/taigrr/gico.git
synced 2026-04-02 03:09:07 -07:00
fix incorrect offset
This commit is contained in:
@@ -138,29 +138,11 @@ func YearFreqFromChan(cc chan types.Commit, year int) types.YearFreq {
|
|||||||
yearLength++
|
yearLength++
|
||||||
}
|
}
|
||||||
freq := make([]int, yearLength)
|
freq := make([]int, yearLength)
|
||||||
data := types.NewDataSet()
|
|
||||||
for commit := range cc {
|
for commit := range cc {
|
||||||
ts := commit.TimeStamp
|
if commit.TimeStamp.Year() != year {
|
||||||
roundedTS := ts.Round(time.Hour * 24)
|
|
||||||
wd, ok := data[roundedTS]
|
|
||||||
if !ok {
|
|
||||||
wd = types.WorkDay{}
|
|
||||||
wd.Commits = []types.Commit{}
|
|
||||||
}
|
|
||||||
wd.Commits = append(wd.Commits, commit)
|
|
||||||
wd.Count++
|
|
||||||
wd.Day = roundedTS
|
|
||||||
data[roundedTS] = wd
|
|
||||||
}
|
|
||||||
for k, v := range data {
|
|
||||||
if k.Year() != year {
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// this is equivalent to adding len(commits) to the freq total, but
|
freq[commit.TimeStamp.YearDay()-1]++
|
||||||
// it's a stub for later when we do more here
|
|
||||||
for range v.Commits {
|
|
||||||
freq[k.YearDay()-1]++
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return freq
|
return freq
|
||||||
}
|
}
|
||||||
@@ -241,7 +223,7 @@ func (cs CommitSet) ToYearFreq() types.YearFreq {
|
|||||||
// this is equivalent to adding len(commits) to the freq total, but
|
// this is equivalent to adding len(commits) to the freq total, but
|
||||||
// it's a stub for later when we do more here
|
// it's a stub for later when we do more here
|
||||||
for range v.Commits {
|
for range v.Commits {
|
||||||
freq[k.YearDay()-1]++
|
freq[k.YearDay()]++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return freq
|
return freq
|
||||||
|
|||||||
Reference in New Issue
Block a user