Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Gepetto
dashboard
Commits
9fb7363d
Commit
9fb7363d
authored
Feb 08, 2018
by
Guilhem Saurel
Browse files
list numbers of opened issues & PR in project tables
parent
cdea649e
Changes
2
Hide whitespace changes
Inline
Side-by-side
rainboard/models.py
View file @
9fb7363d
...
...
@@ -12,7 +12,7 @@ import git
import
requests
from
autoslug
import
AutoSlugField
from
ndh.models
import
Links
,
NamedModel
,
TimeStampedModel
from
ndh.utils
import
enum_to_choices
from
ndh.utils
import
enum_to_choices
,
query_sum
from
.utils
import
SOURCES
,
TARGETS
,
slugify_with_dots
,
api_next
...
...
@@ -243,6 +243,13 @@ class Project(Links, NamedModel, TimeStampedModel):
commits
=
self
.
git
().
git
.
rev_list
(
f
'
{
self
.
version
}
..
{
self
.
main_branch
()
}
'
)
return
len
(
commits
.
split
(
'
\n
'
))
if
commits
else
0
def
open_issues
(
self
):
return
query_sum
(
self
.
repo_set
,
'open_issues'
)
def
open_pr
(
self
):
return
query_sum
(
self
.
repo_set
,
'open_pr'
)
class
Repo
(
TimeStampedModel
):
name
=
models
.
CharField
(
max_length
=
200
)
...
...
rainboard/tables.py
View file @
9fb7363d
...
...
@@ -31,6 +31,8 @@ class NamespaceTable(StrippedTable):
class
ProjectTable
(
StrippedTable
):
commits_since
=
tables
.
Column
(
accessor
=
'commits_since'
,
orderable
=
False
)
repos
=
tables
.
Column
(
accessor
=
'repos'
,
orderable
=
False
)
issues
=
tables
.
Column
(
accessor
=
'open_issues'
,
orderable
=
False
)
pr
=
tables
.
Column
(
accessor
=
'open_pr'
,
orderable
=
False
)
rpkgs
=
tables
.
Column
(
accessor
=
'rpkgs'
,
orderable
=
False
)
class
Meta
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment