Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
09a8d714
Commit
09a8d714
authored
Oct 22, 2015
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Count changes in given project
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
e3e9aae2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
weblate/billing/admin.py
weblate/billing/admin.py
+1
-0
weblate/billing/models.py
weblate/billing/models.py
+22
-1
No files found.
weblate/billing/admin.py
View file @
09a8d714
...
...
@@ -35,6 +35,7 @@ class BillingAdmin(admin.ModelAdmin):
list_display
=
(
'user'
,
'plan'
,
'list_projects'
,
'count_changes_1m'
,
'count_changes_1q'
,
'count_changes_1y'
,
'count_repositories'
,
'count_strings'
,
'count_words'
,
'count_languages'
,
'in_limits'
,
...
...
weblate/billing/models.py
View file @
09a8d714
...
...
@@ -21,8 +21,11 @@
from
django.db
import
models
from
django.contrib.auth.models
import
User
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils
import
timezone
from
weblate.trans.models
import
Project
,
SubProject
from
datetime
import
timedelta
from
weblate.trans.models
import
Project
,
SubProject
,
Change
from
weblate.lang.models
import
Language
...
...
@@ -50,6 +53,24 @@ class Billing(models.Model):
def
__unicode__
(
self
):
return
u'{0} ({1})'
.
format
(
self
.
user
,
self
.
plan
)
def
count_changes
(
self
,
interval
):
return
Change
.
objects
.
filter
(
subproject__project__in
=
self
.
projects
.
all
(),
timestamp__gt
=
timezone
.
now
()
-
interval
,
).
count
()
def
count_changes_1m
(
self
):
return
self
.
count_changes
(
timedelta
(
days
=
31
))
count_changes_1m
.
short_description
=
_
(
'Changes in last month'
)
def
count_changes_1q
(
self
):
return
self
.
count_changes
(
timedelta
(
days
=
93
))
count_changes_1q
.
short_description
=
_
(
'Changes in last quarter'
)
def
count_changes_1y
(
self
):
return
self
.
count_changes
(
timedelta
(
days
=
365
))
count_changes_1y
.
short_description
=
_
(
'Changes in last year'
)
def
count_repositories
(
self
):
return
SubProject
.
objects
.
filter
(
project__in
=
self
.
projects
.
all
(),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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