4
4
"net/http"
5
5
"time"
6
6
7
- activities_model "code.gitea.io/gitea/models/activities"
8
7
contributors_model "code.gitea.io/gitea/models/contributors"
9
- "code.gitea.io/gitea/models/unit"
10
8
"code.gitea.io/gitea/modules/base"
11
9
"code.gitea.io/gitea/modules/context"
12
10
)
@@ -26,30 +24,18 @@ func Contributors(ctx *context.Context) {
26
24
}
27
25
ctx .PageData ["contributionType" ] = ctx .Data ["ContributionType" ]
28
26
29
- timeUntil := time .Now ()
30
- var timeFrom time.Time
31
-
32
- timeFrom = timeUntil .Add (- time .Hour * 24 )
33
- ctx .Data ["DateFrom" ] = timeFrom .UTC ().Format (time .RFC3339 )
34
- ctx .Data ["DateUntil" ] = timeUntil .UTC ().Format (time .RFC3339 )
35
27
ctx .Data ["ContributionTypeText" ] = ctx .Tr ("repo.contributors.contribution_type." + ctx .Data ["ContributionType" ].(string ))
36
28
37
- var err error
38
- if ctx .Data ["Activity" ], err = activities_model .GetActivityStats (ctx , ctx .Repo .Repository , timeFrom ,
39
- ctx .Repo .CanRead (unit .TypeReleases ),
40
- ctx .Repo .CanRead (unit .TypeIssues ),
41
- ctx .Repo .CanRead (unit .TypePullRequests ),
42
- ctx .Repo .CanRead (unit .TypeCode )); err != nil {
43
- ctx .ServerError ("GetActivityStats" , err )
44
- return
45
- }
46
-
47
-
48
29
if contributor_stats , err := contributors_model .GetContributorStats (ctx , ctx .Repo .Repository ); err != nil {
49
30
ctx .ServerError ("GetContributorStats" , err )
50
31
return
51
32
} else {
52
33
ctx .PageData ["repoContributorsCommitStats" ] = contributor_stats
34
+ timeUntil := time .Now ()
35
+ timeFrom := time .UnixMilli (contributor_stats ["" ].Weeks [0 ].Week )
36
+
37
+ ctx .Data ["DateFrom" ] = timeFrom .UTC ().Format (time .RFC3339 )
38
+ ctx .Data ["DateUntil" ] = timeUntil .UTC ().Format (time .RFC3339 )
53
39
// contributor_stats[""].Weeks.(map[string]interface{})
54
40
}
55
41
0 commit comments