remove creator field from top repo query

This commit is contained in:
Tan Jiang 2016-08-03 10:39:33 +08:00
parent 4a5b9bac39
commit a74cf7e68b
4 changed files with 9 additions and 8 deletions

View File

@ -184,7 +184,7 @@ func GetTopRepos(countNum int) ([]models.TopRepo, error) {
for i := 0; i < len(list); i++ { for i := 0; i < len(list); i++ {
for _, v := range usrnameList { for _, v := range usrnameList {
if v.RepoName == list[i].RepoName { if v.RepoName == list[i].RepoName {
list[i].Creator = v.Creator // list[i].Creator = v.Creator
break break
} }
} }

View File

@ -770,9 +770,11 @@ func TestGetTopRepos(t *testing.T) {
if topRepos[0].AccessCount != 1 { if topRepos[0].AccessCount != 1 {
t.Errorf("error occured in get top reop's access count, expected: %v, actual: %v", 1, topRepos[0].AccessCount) t.Errorf("error occured in get top reop's access count, expected: %v, actual: %v", 1, topRepos[0].AccessCount)
} }
if topRepos[0].Creator != currentUser.Username { /*
t.Errorf("error occured in get top reop's creator, expected: %v, actual: %v", currentUser.Username, topRepos[0].Creator) if topRepos[0].Creator != currentUser.Username {
} t.Errorf("error occured in get top reop's creator, expected: %v, actual: %v", currentUser.Username, topRepos[0].Creator)
}
*/
err = ToggleProjectPublicity(currentProject.ProjectID, publicityOff) err = ToggleProjectPublicity(currentProject.ProjectID, publicityOff)
if err != nil { if err != nil {
t.Errorf("Error occurred in ToggleProjectPublicity: %v", err) t.Errorf("Error occurred in ToggleProjectPublicity: %v", err)

View File

@ -19,5 +19,5 @@ package models
type TopRepo struct { type TopRepo struct {
RepoName string `json:"name"` RepoName string `json:"name"`
AccessCount int64 `json:"count"` AccessCount int64 `json:"count"`
Creator string `json:"creator"` // Creator string `json:"creator"`
} }

View File

@ -18,8 +18,7 @@
<table class="table table-pane table-header"> <table class="table table-pane table-header">
<thead> <thead>
<th width="60%">// 'repository_name' | tr //</th> <th width="60%">// 'repository_name' | tr //</th>
<th width="15%">// 'count' | tr //</th> <th width="40%">// 'count' | tr //</th>
<th width="25%">// 'creator' | tr //</th>
</thead> </thead>
</table> </table>
</div> </div>
@ -30,7 +29,7 @@
<td colspan="5" height="120px" class="empty-hint" ng-if="vm.top10Repositories.length === 0"><h4 class="text-muted">// 'no_top_repositories' | tr //</h4></td> <td colspan="5" height="120px" class="empty-hint" ng-if="vm.top10Repositories.length === 0"><h4 class="text-muted">// 'no_top_repositories' | tr //</h4></td>
</tr> </tr>
<tr ng-if="vm.top10Repositories.length > 0" ng-repeat="t in vm.top10Repositories"> <tr ng-if="vm.top10Repositories.length > 0" ng-repeat="t in vm.top10Repositories">
<td width="60%">//t.name//</td><td width="15%">//t.count//</td><td width="25%">//t.creator === '' ? '-' : t.creator //</td> <td width="60%">//t.name//</td><td width="40%">//t.count//</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>