Skip to content

Commit

Permalink
community/: Add a webpage for Listing Issues
Browse files Browse the repository at this point in the history
This commit adds a general view for listing
all the issue objects for any model which
stores issue related details. The details
which are compulsory needed are Hoster,
Repository name, Issue title, Number and
the URl of it. using this, the commit adds
a webpage for displaying all the inactive
issues.

Closes #288
  • Loading branch information
KVGarg committed Aug 5, 2019
1 parent 737fc92 commit 2596359
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 79 deletions.
1 change: 0 additions & 1 deletion .moban.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package_module: community
packages:
- community
- activity
- inactive_issues
- data
- gci
- gsoc
Expand Down
1 change: 0 additions & 1 deletion .nocover.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ nocover_file_globs:
- ci_build/*.py
- meta_review/handler.py
# Optional coverage. Once off scripts.
- inactive_issues/inactive_issues_scraper.py
- unassigned_issues/unassigned_issues_scraper.py
# The following rules can remain here
# django db
Expand Down
9 changes: 4 additions & 5 deletions community/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@

from community.views import (
HomePageView, JoinCommunityView,
OrganizationTeams
OrganizationTeams, InactiveIssuesList
)
from gci.views import GCIStudentsList
from gci.feeds import LatestTasksFeed as gci_tasks_rss
from ci_build.view_log import BuildLogsView
from data.views import ContributorsListView
from gamification.views import GamificationResults
from meta_review.views import ContributorsMetaReview
from inactive_issues.inactive_issues_scraper import inactive_issues_json
from unassigned_issues.unassigned_issues_scraper import (
unassigned_issues_activity_json,
)
Expand Down Expand Up @@ -79,10 +78,10 @@ def get_index():
distill_file='meta-review/index.html',
),
distill_url(
r'static/inactive-issues.json', inactive_issues_json,
name='inactive_issues_json',
r'inactive-issues/', InactiveIssuesList.as_view(),
name='inactive-issues',
distill_func=get_index,
distill_file='static/inactive-issues.json',
distill_file='inactive-issues/index.html',
),
distill_url(
r'static/unassigned-issues.json', unassigned_issues_activity_json,
Expand Down
15 changes: 14 additions & 1 deletion community/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
NewcomerPromotion,
Feedback
)
from data.models import Team
from data.models import Team, InactiveIssue
from gamification.models import Participant as GamificationParticipant
from meta_review.models import Participant as MetaReviewer

Expand Down Expand Up @@ -221,3 +221,16 @@ def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context = get_header_and_footer(context)
return context


class InactiveIssuesList(ListView):

template_name = 'issues.html'
model = InactiveIssue
ordering = 'hoster'

def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context = get_header_and_footer(context)
context['page_name'] = 'Inactive Issues List'
return context
24 changes: 24 additions & 0 deletions data/migrations/0009_inactiveissue.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 2.1.7 on 2019-08-02 11:39

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('data', '0008_auto_20190802_0745'),
]

operations = [
migrations.CreateModel(
name='InactiveIssue',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('hoster', models.CharField(max_length=30)),
('title', models.CharField(max_length=500)),
('repository', models.CharField(max_length=100)),
('number', models.SmallIntegerField()),
('url', models.URLField()),
],
),
]
8 changes: 8 additions & 0 deletions data/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,11 @@ def get_closes_issues_object(self):
issue_object = issue_number.get_issue()
issues_object_list.append(issue_object)
return issues_object_list


class InactiveIssue(models.Model):
hoster = models.CharField(max_length=30)
title = models.CharField(max_length=500)
repository = models.CharField(max_length=100)
number = models.SmallIntegerField()
url = models.URLField()
67 changes: 0 additions & 67 deletions inactive_issues/inactive_issues_scraper.py

This file was deleted.

3 changes: 0 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ DJANGO_SETTINGS_MODULE = community.settings
testpaths =
community
activity
inactive_issues
data
gci
gsoc
Expand Down Expand Up @@ -63,7 +62,6 @@ plugins =
source =
community
activity
inactive_issues
data
gci
gsoc
Expand All @@ -80,7 +78,6 @@ omit =
gsoc/*.py
ci_build/*.py
meta_review/handler.py
inactive_issues/inactive_issues_scraper.py
unassigned_issues/unassigned_issues_scraper.py
*/migrations/*.py
*/management/commands/*.py
Expand Down
2 changes: 1 addition & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<li><a href="{% url 'community-data' %}">Contributors Information</a></li>
<li><a href="#">Mentors</a></li>
<li><a href="{% url 'community-gci' %}">Google Code-in Students</a></li>
<li><a href="{% url 'inactive_issues_json' %}" title="List of all the issues on organization's main repository on which assignee has not shown any activity for more than 2 months.">Inactive issues</a></li>
<li><a href="{% url 'inactive-issues' %}" title="List of all the issues on organization's main repository on which assignee has not shown any activity for more than 2 months.">Inactive issues</a></li>
<li><a href="{% url 'unassigned_issues_activity_json' %}" title="List of all the issues on organization main repository on which someone has opened a pull request without getting assigned to it.">Unassigned issues activity</a></li>
<li><a href="{% url 'ci_build' %}">Project CI Build</a></li>
{% if isTravis %}
Expand Down
48 changes: 48 additions & 0 deletions templates/issues.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{% extends 'base.html' %}
{% load staticfiles %}

{% block main-content %}
<div class="web-page-details apply-flex center-content">
<h3 style="padding-right: 15px">~</h3>
<h3 class="page-name">
{{ page_name }}
</h3>
<h3 style="padding-left: 15px">~</h3>
</div>
<div class="issues-list" style="margin: auto; width: 60%; min-width: 350px;
padding-bottom: 30px;">
{% if object_list.count > 0 %}
<table class="highlight centered">
<thead>
<tr class="custom-green-color-font">
<th>
<h5>Hoster</h5>
</th>
<th>
<h5>Title</h5>
</th>
<th>
<h5>Issue</h5>
</th>
</tr>
</thead>
<tbody>
{% for issue in object_list %}
<tr>
<td>{{ issue.hoster }}</td>
<td>{{ issue.title }}</td>
<td class="bold-text">
<a href="{{ issue.url }}">{{ issue.repository }}#{{ issue.number }}</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<h5 class="empty-list apply-flex center-content" style="min-height: 124px">
No Issues Found! <i class="fa fa-smile-o"></i>
</h5>
{% endif %}
</div>

{% endblock %}

0 comments on commit 2596359

Please sign in to comment.