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 coala#288
  • Loading branch information
KVGarg committed Aug 3, 2019
1 parent 8f01987 commit 0a2f538
Show file tree
Hide file tree
Showing 10 changed files with 87 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 @@ -13,7 +13,6 @@ nocover_file_globs:
- openhub/*.py
- twitter/*.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,7 +9,7 @@

from community.views import (
HomePageView, JoinCommunityView,
OrganizationTeams
OrganizationTeams, InactiveIssuesList
)
from gci.views import GCIStudentsList
from gci.feeds import LatestTasksFeed as gci_tasks_rss
Expand All @@ -18,7 +18,6 @@
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 @@ -86,10 +85,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 @@ -218,3 +218,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 @@ -64,7 +63,6 @@ plugins =
source =
community
activity
inactive_issues
data
gci
gsoc
Expand All @@ -84,7 +82,6 @@ omit =
meta_review/handler.py
openhub/*.py
twitter/*.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 @@ -78,7 +78,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
36 changes: 36 additions & 0 deletions templates/issues.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{% 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;">
<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>
</div>

{% endblock %}

0 comments on commit 0a2f538

Please sign in to comment.