mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
rrs: Maintainers add support for display statistics of recipe upgrades by week in Milestone.
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
This commit is contained in:
parent
e687e7a9f8
commit
5534515a8a
|
@ -37,20 +37,26 @@ class Milestone(models.Model):
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
""" Get month intervals between the start and the end of the milestone """
|
""" Get week intervals from start and end of Milestone """
|
||||||
def get_intervals(self):
|
def get_week_intervals(self):
|
||||||
intervals = []
|
from datetime import timedelta
|
||||||
previous_date = self.start_date
|
|
||||||
|
weeks = {}
|
||||||
|
|
||||||
|
week_delta = timedelta(weeks=1)
|
||||||
|
week_no = 1
|
||||||
current_date = self.start_date
|
current_date = self.start_date
|
||||||
while current_date < self.end_date+timedelta(days=28):
|
while True:
|
||||||
current_date += timedelta(days=1)
|
if current_date >= self.end_date:
|
||||||
if current_date.month != previous_date.month:
|
break;
|
||||||
interval_start = previous_date.replace(day=1)
|
|
||||||
interval_end = current_date.replace(day=1)
|
weeks[week_no] = {}
|
||||||
interval_end -= timedelta(days=1)
|
weeks[week_no]['start_date'] = current_date
|
||||||
intervals.append((interval_start, interval_end))
|
weeks[week_no]['end_date'] = current_date + week_delta
|
||||||
previous_date = current_date
|
current_date += week_delta
|
||||||
return intervals
|
week_no += 1
|
||||||
|
|
||||||
|
return weeks
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return '%s' % (self.name)
|
return '%s' % (self.name)
|
||||||
|
|
23
rrs/views.py
23
rrs/views.py
|
@ -310,6 +310,8 @@ class MaintainerList():
|
||||||
recipes_unknown = '0'
|
recipes_unknown = '0'
|
||||||
percentage_done = '0.00'
|
percentage_done = '0.00'
|
||||||
|
|
||||||
|
week_statistics = None
|
||||||
|
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
||||||
|
@ -317,11 +319,14 @@ class MaintainerListView(ListView):
|
||||||
context_object_name = 'maintainer_list'
|
context_object_name = 'maintainer_list'
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
|
from datetime import date
|
||||||
|
|
||||||
maintainer_list = []
|
maintainer_list = []
|
||||||
self.maintainer_count = 0
|
self.maintainer_count = 0
|
||||||
|
|
||||||
self.milestone_name = self.kwargs['milestone_name']
|
self.milestone_name = self.kwargs['milestone_name']
|
||||||
milestone = get_object_or_404(Milestone, name=self.milestone_name)
|
milestone = get_object_or_404(Milestone, name=self.milestone_name)
|
||||||
|
milestone_week_intervals = milestone.get_week_intervals()
|
||||||
|
|
||||||
self.milestone_statistics = _get_milestone_statistics(milestone)
|
self.milestone_statistics = _get_milestone_statistics(milestone)
|
||||||
|
|
||||||
|
@ -336,6 +341,9 @@ class MaintainerListView(ListView):
|
||||||
|
|
||||||
self.maintainer_count = len(maintainer_list)
|
self.maintainer_count = len(maintainer_list)
|
||||||
|
|
||||||
|
self.milestone_weeks = sorted(milestone_week_intervals.keys())
|
||||||
|
self.current_week = -1
|
||||||
|
current_date = date.today()
|
||||||
for ml in maintainer_list:
|
for ml in maintainer_list:
|
||||||
milestone_statistics = _get_milestone_statistics(milestone, ml.name)
|
milestone_statistics = _get_milestone_statistics(milestone, ml.name)
|
||||||
ml.recipes_all = milestone_statistics['all']
|
ml.recipes_all = milestone_statistics['all']
|
||||||
|
@ -344,6 +352,19 @@ class MaintainerListView(ListView):
|
||||||
ml.recipes_unknown = milestone_statistics['unknown']
|
ml.recipes_unknown = milestone_statistics['unknown']
|
||||||
ml.percentage_done = milestone_statistics['percentage']
|
ml.percentage_done = milestone_statistics['percentage']
|
||||||
|
|
||||||
|
ml.week_statistics = []
|
||||||
|
for week_no in milestone_week_intervals.keys():
|
||||||
|
start_date = milestone_week_intervals[week_no]['start_date']
|
||||||
|
end_date = milestone_week_intervals[week_no]['end_date']
|
||||||
|
|
||||||
|
if current_date >= start_date and current_date <= end_date:
|
||||||
|
self.current_week = week_no - 1 # used in template for loop
|
||||||
|
|
||||||
|
number = RecipeUpgrade.objects.filter(maintainer__name = ml.name,
|
||||||
|
commit_date__gte = start_date,
|
||||||
|
commit_date__lte = end_date).count()
|
||||||
|
ml.week_statistics.append(number)
|
||||||
|
|
||||||
return maintainer_list
|
return maintainer_list
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
|
@ -360,5 +381,7 @@ class MaintainerListView(ListView):
|
||||||
context['recipes_unknown'] = self.milestone_statistics['unknown']
|
context['recipes_unknown'] = self.milestone_statistics['unknown']
|
||||||
|
|
||||||
context['maintainer_count'] = self.maintainer_count
|
context['maintainer_count'] = self.maintainer_count
|
||||||
|
context['milestone_weeks'] = self.milestone_weeks
|
||||||
|
context['current_week'] = self.current_week
|
||||||
|
|
||||||
return context
|
return context
|
||||||
|
|
|
@ -42,10 +42,16 @@
|
||||||
<th>Not updated</th>
|
<th>Not updated</th>
|
||||||
<th class="muted">Unknown</th>
|
<th class="muted">Unknown</th>
|
||||||
<th>% done</th>
|
<th>% done</th>
|
||||||
<th class="current-wk">wk1</th>
|
|
||||||
<th class="muted">wk2</th>
|
{% for w in milestone_weeks %}
|
||||||
<th class="muted">wk3</th>
|
{% if current_week == forloop.counter0 %}
|
||||||
<th class="muted">wk4</th>
|
<th class="current-wk">
|
||||||
|
{% else %}
|
||||||
|
<th class="muted">
|
||||||
|
{% endif %}
|
||||||
|
wk{{ w }}
|
||||||
|
</th>
|
||||||
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -75,10 +81,15 @@
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ ml.percentage_done }}</td>
|
<td>{{ ml.percentage_done }}</td>
|
||||||
<td class="current-wk"></td>
|
{% for number in ml.week_statistics %}
|
||||||
<td></td>
|
{% if current_week == forloop.counter0 %}
|
||||||
<td></td>
|
<td class="current-wk">
|
||||||
<td></td>
|
{% else %}
|
||||||
|
<td class="muted">
|
||||||
|
{% endif %}
|
||||||
|
{{ number }}
|
||||||
|
</td>
|
||||||
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user