diff --git a/.nocover.yaml b/.nocover.yaml index 4757eb64..c75cba69 100644 --- a/.nocover.yaml +++ b/.nocover.yaml @@ -10,7 +10,6 @@ nocover_file_globs: - gsoc/*.py - ci_build/*.py - meta_review/handler.py - - model/*.py - openhub/*.py # Optional coverage. Once off scripts. - inactive_issues/inactive_issues_scraper.py diff --git a/model/__init__.py b/model/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/model/apps.py b/model/apps.py deleted file mode 100644 index 5c0fd6b5..00000000 --- a/model/apps.py +++ /dev/null @@ -1,5 +0,0 @@ -from django.apps import AppConfig - - -class ModelConfig(AppConfig): - name = 'model' diff --git a/model/migrations/__init__.py b/model/migrations/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/model/urls.py b/model/urls.py deleted file mode 100644 index a3780aa2..00000000 --- a/model/urls.py +++ /dev/null @@ -1,7 +0,0 @@ -from django.conf.urls import url - -from . import views - -urlpatterns = [ - url(r'^$', views.index, name='index'), -] diff --git a/model/views.py b/model/views.py deleted file mode 100644 index 151b8f66..00000000 --- a/model/views.py +++ /dev/null @@ -1,76 +0,0 @@ -from django.shortcuts import render -from django.views import generic - -from openhub.models import ( - PortfolioProject, - OutsideProject, - OutsideCommitter, - AffiliatedCommitter, - Organization, - ) - - -def index(request): - args = { - 'portfolioprojects': 'portfolio_projects', - 'outsidecommitters': 'outside_committers', - 'affiliatedcommitters': 'affiliated_committers', - 'outsideprojects': 'outside_projects', - 'organization': 'organization', - } - return render(request, 'model.html', args) - - -class PortfolioProjectListView(generic.ListView): - model = PortfolioProject - context_object_name = 'portfolio_project_list' - template_name = 'model/templates/portfolio_project_list.html' - - -class PortfolioProjectDetailView(generic.DetailView): - model = PortfolioProject - template_name = 'model/templates/portfolio_project_detail.html' - - -class OutsideProjectListView(generic.ListView): - model = OutsideProject - context_object_name = 'outside_project_list' - template_name = 'model/templates/outside_project_list.html' - - -class OutsideProjectDetailView(generic.DetailView): - model = OutsideProject - template_name = 'model/templates/outside_project_detail.html' - - -class OutsideCommitterListView(generic.ListView): - model = OutsideCommitter - context_object_name = 'outside_committer_list' - template_name = 'model/templates/outside_committer_list.html' - - -class OutsideCommitterDetailView(generic.DetailView): - model = OutsideCommitter - template_name = 'model/templates/outside_committer_detail.html' - - -class AffiliatedCommitterListView(generic.ListView): - model = AffiliatedCommitter - context_object_name = 'affiliated_committer_list' - template_name = 'model/templates/affiliated_committer_list.html' - - -class AffiliatedCommitterDetailView(generic.DetailView): - model = AffiliatedCommitter - template_name = 'model/templates/affiliated_committer_detail.html' - - -class OrganizationListView(generic.ListView): - model = Organization - context_object_name = 'organization_list' - template_name = 'model/templates/organization_list.html' - - -class OrganizationDetailView(generic.DetailView): - model = Organization - template_name = 'model/templates/organization_detail.html' diff --git a/openhub/affiliated_committers.py b/openhub/affiliated_committers.py deleted file mode 100644 index 0071107d..00000000 --- a/openhub/affiliated_committers.py +++ /dev/null @@ -1,41 +0,0 @@ -import logging - -from community.git import get_org_name -from openhub.models import MostCommit, MostRecentCommit, AffiliatedCommitter - - -def get_affiliated_committers_data(json_object): - data = json_object['response']['result' - ]['affiliated_committers']['affiliator'] - return data - - -def import_data(affiliator): - logger = logging.getLogger(__name__) - name = affiliator.get('name', None) - - try: - (cr1, create1) = MostCommit.objects.get_or_create( - **affiliator['most_commits'] - ) - if create1: - cr1.save() - (cr2, create2) = MostRecentCommit.objects.get_or_create( - **affiliator['most_recent_commit'] - ) - if create2: - cr2.save() - affiliator['most_commits'] = cr1 - affiliator['most_recent_commit'] = cr2 - affiliator['org'] = get_org_name() - (c, created) = AffiliatedCommitter.objects.get_or_create( - **affiliator - ) - if created: - c.save() - logger.info( - '\nAffiliatedCommitter %s has been saved' % c) - except Exception as ex: - logger.error( - '\n\nSomething went wrong saving this AffiliatedCommitter %s: %s' - % (name, ex)) diff --git a/openhub/apps.py b/openhub/apps.py deleted file mode 100644 index da68b6ce..00000000 --- a/openhub/apps.py +++ /dev/null @@ -1,8 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.apps import AppConfig - - -class OpenhubConfig(AppConfig): - name = 'openhub' diff --git a/openhub/data.py b/openhub/data.py deleted file mode 100644 index bc197be5..00000000 --- a/openhub/data.py +++ /dev/null @@ -1,55 +0,0 @@ -import json -import logging - -import requests -import xmltodict - -from community.git import get_org_name -from openhub.oh_token import OH_TOKEN -from openhub.outside_projects import get_outside_projects_data -from openhub.portfolio_projects import get_portfolio_projects_data -from openhub.outside_committers import get_outside_committers_data -from openhub.affiliated_committers import get_affiliated_committers_data - - -def get_data(for_what): - n = 100 - data_list = [] - logger = logging.getLogger(__name__) - for i in range(1, n): - import_url = ('https://www.openhub.net/orgs/' - + get_org_name() + '/' + for_what + '.xml?api_key=' - + OH_TOKEN + '&page=' + str(i)) - try: - resp = requests.get(import_url) - jsonString = json.dumps(xmltodict.parse(resp.content), indent=4) - json_object = json.loads(jsonString) - except Exception as ex: - logger.error(ex) - break - if for_what == 'affiliated_committers': - try: - data = get_affiliated_committers_data(json_object) - except Exception as ex: - logger.error(ex) - break - elif for_what == 'outside_committers': - try: - data = get_outside_committers_data(json_object) - except Exception as ex: - logger.error(ex) - break - elif for_what == 'outside_projects': - try: - data = get_outside_projects_data(json_object) - except Exception as ex: - logger.error(ex) - break - elif for_what == 'projects': - try: - data = get_portfolio_projects_data(json_object) - except Exception as ex: - logger.error(ex) - break - data_list = data_list + data - return data_list diff --git a/openhub/management/commands/import_affiliated_committers_data.py b/openhub/management/commands/import_affiliated_committers_data.py deleted file mode 100644 index 6d56a78e..00000000 --- a/openhub/management/commands/import_affiliated_committers_data.py +++ /dev/null @@ -1,15 +0,0 @@ -from django.core.management.base import BaseCommand - -from openhub.data import get_data -from openhub.affiliated_committers import import_data - - -class Command(BaseCommand): - help = 'Import AffiliatorCommitters data' - - COLLECTIONS = 'affiliated_committers' - IMPORT_DATA = staticmethod(import_data) - - def handle(self, *args, **options): - for collection in get_data(self.COLLECTIONS): - self.IMPORT_DATA(collection) diff --git a/openhub/management/commands/import_openhub_data.py b/openhub/management/commands/import_openhub_data.py deleted file mode 100644 index 74925ddb..00000000 --- a/openhub/management/commands/import_openhub_data.py +++ /dev/null @@ -1,33 +0,0 @@ -import logging - -from django.core.management import BaseCommand -from django.core.management import call_command - - -class Command(BaseCommand): - help = 'This command invoke all the importing data command' - - def handle(self, *args, **options): - logger = logging.getLogger(__name__) - try: - call_command('import_organization_data') - except Exception as ex: - logger.error(ex) - try: - call_command('import_affiliated_committers_data') - except Exception as ex: - logger.error(ex) - try: - call_command('import_outside_committers_data') - except Exception as ex: - logger.error(ex) - try: - call_command('import_outside_projects_data') - except Exception as ex: - logger.error(ex) - try: - call_command('import_portfolio_projects_data') - except Exception as ex: - logger.error(ex) - return - logger.info('All OpenHub data is imported') diff --git a/openhub/management/commands/import_organization_data.py b/openhub/management/commands/import_organization_data.py deleted file mode 100644 index 239e380b..00000000 --- a/openhub/management/commands/import_organization_data.py +++ /dev/null @@ -1,20 +0,0 @@ -import logging - -from django.core.management.base import BaseCommand - -from openhub.organization import get_organization_data, import_data - - -class Command(BaseCommand): - help = 'Import Organization data' - - COLLECTIONS = staticmethod(get_organization_data) - IMPORT_DATA = staticmethod(import_data) - - def handle(self, *args, **options): - logger = logging.getLogger(__name__) - try: - self.IMPORT_DATA(self.COLLECTIONS()) - except Exception as ex: - logger.error(ex) - return diff --git a/openhub/management/commands/import_outside_committers_data.py b/openhub/management/commands/import_outside_committers_data.py deleted file mode 100644 index cb85ccb7..00000000 --- a/openhub/management/commands/import_outside_committers_data.py +++ /dev/null @@ -1,15 +0,0 @@ -from django.core.management.base import BaseCommand - -from openhub.data import get_data -from openhub.outside_committers import import_data - - -class Command(BaseCommand): - help = 'Import OutsideCommitters data' - - COLLECTIONS = 'outside_committers' - IMPORT_DATA = staticmethod(import_data) - - def handle(self, *args, **options): - for collection in get_data(self.COLLECTIONS): - self.IMPORT_DATA(collection) diff --git a/openhub/management/commands/import_outside_projects_data.py b/openhub/management/commands/import_outside_projects_data.py deleted file mode 100644 index 5b636118..00000000 --- a/openhub/management/commands/import_outside_projects_data.py +++ /dev/null @@ -1,15 +0,0 @@ -from django.core.management.base import BaseCommand - -from openhub.data import get_data -from openhub.outside_projects import import_data - - -class Command(BaseCommand): - help = 'Import OutsideProject data' - - COLLECTIONS = 'outside_projects' - IMPORT_DATA = staticmethod(import_data) - - def handle(self, *args, **options): - for collection in get_data(self.COLLECTIONS): - self.IMPORT_DATA(collection) diff --git a/openhub/management/commands/import_portfolio_projects_data.py b/openhub/management/commands/import_portfolio_projects_data.py deleted file mode 100644 index c46c0bb4..00000000 --- a/openhub/management/commands/import_portfolio_projects_data.py +++ /dev/null @@ -1,15 +0,0 @@ -from django.core.management.base import BaseCommand - -from openhub.data import get_data -from openhub.portfolio_projects import import_data - - -class Command(BaseCommand): - help = 'Import PortfolioProjects data' - - COLLECTIONS = 'projects' - IMPORT_DATA = staticmethod(import_data) - - def handle(self, *args, **options): - for collection in get_data(self.COLLECTIONS): - self.IMPORT_DATA(collection) diff --git a/openhub/migrations/0001_initial.py b/openhub/migrations/0001_initial.py deleted file mode 100644 index dfd7d698..00000000 --- a/openhub/migrations/0001_initial.py +++ /dev/null @@ -1,173 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.11 on 2018-03-18 14:50 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ] - - operations = [ - migrations.CreateModel( - name='AffiliatedCommitter', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('org', models.CharField(max_length=100)), - ('name', models.CharField(max_length=100)), - ('kudos', models.IntegerField(null=True)), - ('level', models.IntegerField()), - ], - ), - migrations.CreateModel( - name='ContributionsToPortfolioProject', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('projects', models.TextField()), - ('twelve_mo_commits', models.IntegerField()), - ], - ), - migrations.CreateModel( - name='InfographicDetail', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('outside_committers', models.IntegerField(null=True)), - ('outside_committers_commits', models.IntegerField(null=True)), - ('projects_having_outside_commits', models.IntegerField(null=True)), - ('portfolio_projects', models.IntegerField(null=True)), - ('affiliators', models.IntegerField(null=True)), - ('affiliators_committing_to_portfolio_projects', models.IntegerField(null=True)), - ('affiliator_commits_to_portfolio_projects', models.IntegerField(null=True)), - ('affiliators_commiting_projects', models.IntegerField(null=True)), - ('outside_projects', models.IntegerField(null=True)), - ('outside_projects_commits', models.IntegerField(null=True)), - ('affiliators_committing_to_outside_projects', models.IntegerField(null=True)), - ], - ), - migrations.CreateModel( - name='MostCommit', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('project', models.CharField(max_length=100)), - ('commits', models.IntegerField()), - ], - ), - migrations.CreateModel( - name='MostRecentCommit', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('project', models.CharField(max_length=100)), - ('date', models.CharField(max_length=100)), - ], - ), - migrations.CreateModel( - name='OpenhubOrganization', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=100)), - ('url', models.URLField(null=True)), - ('html_url', models.URLField(null=True)), - ('created_at', models.DateTimeField(null=True)), - ('updated_at', models.DateTimeField(null=True)), - ('description', models.TextField(null=True)), - ('homepage_url', models.URLField(null=True)), - ('vanity_url', models.CharField(blank=True, max_length=200, null=True)), - ('org_type', models.CharField(max_length=100)), - ('medium_logo_url', models.URLField(null=True)), - ('small_logo_url', models.URLField(null=True)), - ('projects_count', models.IntegerField(default=0)), - ('affiliated_committers', models.IntegerField(default=0)), - ], - options={ - 'ordering': ['name'], - }, - ), - migrations.CreateModel( - name='Organization', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=100)), - ('url', models.URLField(null=True)), - ('html_url', models.URLField(null=True)), - ('created_at', models.DateTimeField(null=True)), - ('updated_at', models.DateTimeField(null=True)), - ('description', models.TextField(null=True)), - ('homepage_url', models.URLField(null=True)), - ('url_name', models.CharField(blank=True, max_length=100, null=True)), - ('org_type', models.CharField(max_length=100, null=True)), - ('medium_logo_url', models.URLField(null=True)), - ('small_logo_url', models.URLField(null=True)), - ('infographic_details', models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, to='openhub.InfographicDetail')), - ], - ), - migrations.CreateModel( - name='OutsideCommitter', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=100)), - ('kudos', models.IntegerField(null=True)), - ('level', models.IntegerField()), - ('affiliated_with', models.CharField(max_length=100)), - ('org', models.CharField(max_length=100)), - ('contributions_to_portfolio_projects', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='openhub.ContributionsToPortfolioProject')), - ], - ), - migrations.CreateModel( - name='OutsideProject', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=100)), - ('activity', models.CharField(max_length=100)), - ('claimed_by', models.CharField(max_length=100, null=True)), - ('i_use_this', models.IntegerField(null=True)), - ('community_rating', models.FloatField(null=True)), - ('affiliates_contributing', models.IntegerField(null=True)), - ('commits_by_current_affiliates', models.IntegerField(null=True)), - ('org', models.CharField(max_length=100)), - ], - ), - migrations.CreateModel( - name='PortfolioProject', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=100)), - ('activity', models.CharField(max_length=100)), - ('i_use_this', models.IntegerField()), - ('community_rating', models.FloatField(null=True)), - ('primary_language', models.CharField(max_length=100)), - ('org', models.CharField(max_length=200)), - ], - ), - migrations.CreateModel( - name='PortfolioProjectActivity', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('commits', models.IntegerField(null=True)), - ('change_in_commits', models.IntegerField(null=True)), - ('percentage_change_in_commits', models.IntegerField(null=True)), - ('contributors', models.IntegerField(null=True)), - ('change_in_contributors', models.IntegerField(null=True)), - ('percentage_change_in_committers', models.IntegerField(null=True)), - ], - ), - migrations.AddField( - model_name='portfolioproject', - name='twelve_mo_activity_and_year_on_year_change', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='openhub.PortfolioProjectActivity'), - ), - migrations.AddField( - model_name='affiliatedcommitter', - name='most_commits', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='openhub.MostCommit'), - ), - migrations.AddField( - model_name='affiliatedcommitter', - name='most_recent_commit', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='openhub.MostRecentCommit'), - ), - ] diff --git a/openhub/migrations/__init__.py b/openhub/migrations/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/openhub/models.py b/openhub/models.py deleted file mode 100644 index a82f603b..00000000 --- a/openhub/models.py +++ /dev/null @@ -1,187 +0,0 @@ -from django.db import models -from django.urls import reverse - - -class OpenhubOrganization(models.Model): - - name = models.CharField(max_length=100) - url = models.URLField(null=True) - html_url = models.URLField(null=True) - created_at = models.DateTimeField(null=True) - updated_at = models.DateTimeField(null=True) - description = models.TextField(null=True) - homepage_url = models.URLField(null=True) - vanity_url = models.CharField(null=True, max_length=200, blank=True) - org_type = models.CharField(max_length=100) - medium_logo_url = models.URLField(null=True) - small_logo_url = models.URLField(null=True) - projects_count = models.IntegerField(default=0) - affiliated_committers = models.IntegerField(default=0) - - def __str__(self): - return self.name - - class Meta: - - ordering = ['name'] - - -class PortfolioProjectActivity(models.Model): - - commits = models.IntegerField(null=True) - change_in_commits = models.IntegerField(null=True) - percentage_change_in_commits = models.IntegerField(null=True) - contributors = models.IntegerField(null=True) - change_in_contributors = models.IntegerField(null=True) - percentage_change_in_committers = models.IntegerField(null=True) - - def __str__(self): - return str(self.commits) - - -class PortfolioProject(models.Model): - - name = models.CharField(max_length=100) - activity = models.CharField(max_length=100) - i_use_this = models.IntegerField() - community_rating = models.FloatField(null=True) - primary_language = models.CharField(max_length=100) - org = models.CharField(max_length=200) - twelve_mo_activity_and_year_on_year_change = ( - models.ForeignKey(PortfolioProjectActivity, - on_delete=models.CASCADE)) - - def __str__(self): - return self.name - - def get_absolute_url(self): - """ - Returns the url to access a particular portfolio project instance. - """ - return reverse('portfolioproject-detail', args=[str(self.id)]) - - -class OutsideProject(models.Model): - - name = models.CharField(max_length=100) - activity = models.CharField(max_length=100) - claimed_by = models.CharField(max_length=100, null=True) - i_use_this = models.IntegerField(null=True) - community_rating = models.FloatField(null=True) - affiliates_contributing = models.IntegerField(null=True) - commits_by_current_affiliates = models.IntegerField(null=True) - org = models.CharField(max_length=100) - - def __str__(self): - return self.name - - def get_absolute_url(self): - return reverse('outsideproject-detail', args=[str(self.id)]) - - -class ContributionsToPortfolioProject(models.Model): - - projects = models.TextField() - twelve_mo_commits = models.IntegerField() - - def __str__(self): - return self.projects - - -class OutsideCommitter(models.Model): - - name = models.CharField(max_length=100) - kudos = models.IntegerField(null=True) - level = models.IntegerField() - affiliated_with = models.CharField(max_length=100) - org = models.CharField(max_length=100) - contributions_to_portfolio_projects = ( - models.ForeignKey(ContributionsToPortfolioProject, - on_delete=models.CASCADE)) - - def __str__(self): - return self.name - - def get_absolute_url(self): - return reverse('outsidecommitter-detail', args=[str(self.id)]) - - -class MostCommit(models.Model): - - project = models.CharField(max_length=100) - commits = models.IntegerField() - - def __str__(self): - return self.project - - -class MostRecentCommit(models.Model): - - project = models.CharField(max_length=100) - date = models.CharField(max_length=100) - - def __str__(self): - return self.project - - -class AffiliatedCommitter(models.Model): - - org = models.CharField(max_length=100) - name = models.CharField(max_length=100) - kudos = models.IntegerField(null=True) - level = models.IntegerField() - most_commits = ( - models.ForeignKey(MostCommit, on_delete=models.CASCADE)) - most_recent_commit = ( - models.ForeignKey(MostRecentCommit, on_delete=models.CASCADE)) - - def __str__(self): - return self.org - - def get_absolute_url(self): - return reverse('affiliatedcommitter-detail', args=[str(self.id)]) - - -class InfographicDetail(models.Model): - - outside_committers = models.IntegerField(null=True) - outside_committers_commits = models.IntegerField(null=True) - projects_having_outside_commits = models.IntegerField(null=True) - portfolio_projects = models.IntegerField(null=True) - affiliators = models.IntegerField(null=True) - affiliators_committing_to_portfolio_projects = ( - models.IntegerField(null=True)) - affiliator_commits_to_portfolio_projects = ( - models.IntegerField(null=True)) - affiliators_commiting_projects = models.IntegerField(null=True) - outside_projects = models.IntegerField(null=True) - outside_projects_commits = models.IntegerField(null=True) - affiliators_committing_to_outside_projects = ( - models.IntegerField(null=True)) - - def __str__(self): - return str(self.outside_committers) - - -class Organization(models.Model): - - name = models.CharField(max_length=100) - url = models.URLField(null=True) - html_url = models.URLField(null=True) - created_at = models.DateTimeField(null=True) - updated_at = models.DateTimeField(null=True) - description = models.TextField(null=True) - homepage_url = models.URLField(null=True) - url_name = models.CharField(max_length=100, null=True, blank=True) - org_type = models.CharField(max_length=100, null=True) - medium_logo_url = models.URLField(null=True) - small_logo_url = models.URLField(null=True) - infographic_details = ( - models.OneToOneField(InfographicDetail, - on_delete=models.CASCADE, null=True)) - - def __str__(self): - return self.name - - def get_absolute_url(self): - return reverse('org-detail', args=[str(self.id)]) diff --git a/openhub/oh_token.py b/openhub/oh_token.py deleted file mode 100644 index e16db3c2..00000000 --- a/openhub/oh_token.py +++ /dev/null @@ -1,10 +0,0 @@ -import logging - -from gci.config import get_api_key - -try: - OH_TOKEN = get_api_key('OH') -except Exception as ex: - OH_TOKEN = None - logger = logging.getLogger(__name__) - logger.critical('OH_TOKEN can not be obtained: %s' % ex) diff --git a/openhub/organization.py b/openhub/organization.py deleted file mode 100644 index 894ac99f..00000000 --- a/openhub/organization.py +++ /dev/null @@ -1,48 +0,0 @@ -import json -import logging - -import requests -import xmltodict - -from community.git import get_org_name -from openhub.oh_token import OH_TOKEN -from openhub.models import InfographicDetail, Organization - - -def get_organization_data(): - import_url = ('https://www.openhub.net/orgs/' - + get_org_name() + '.xml?api_key=' + OH_TOKEN) - resp = requests.get(import_url) - jsonString = json.dumps(xmltodict.parse(resp.content), indent=4) - json_object = json.loads(jsonString) - jdict = json_object['response']['result']['org'] - data = json.dumps(jdict) - org = json.loads(data) - - return org - - -def import_data(org): - logger = logging.getLogger(__name__) - name = org['name'] - - try: - (cr, create) = InfographicDetail.objects.get_or_create( - **org['infographic_details'] - ) - if create: - cr.save() - org['infographic_details'] = cr - org['org_type'] = org.pop('type') - org.pop('portfolio_projects') - org.pop('vanity_url') - (c, created) = Organization.objects.get_or_create( - **org - ) - if created: - c.save() - logger.info('\nOrganization %s has been saved' % name) - except Exception as ex: - logger.error( - 'Something went wrong saving this Organization %s: %s' - % (name, ex)) diff --git a/openhub/outside_committers.py b/openhub/outside_committers.py deleted file mode 100644 index fafa18a4..00000000 --- a/openhub/outside_committers.py +++ /dev/null @@ -1,33 +0,0 @@ -import logging - -from community.git import get_org_name -from openhub.models import OutsideCommitter, ContributionsToPortfolioProject - - -def get_outside_committers_data(json_object): - data = json_object['response']['result' - ]['outside_committers']['contributor'] - return data - - -def import_data(contributor): - logger = logging.getLogger(__name__) - name = contributor.get('name', None) - - try: - (cr, create) = ContributionsToPortfolioProject.objects.get_or_create( - **contributor['contributions_to_portfolio_projects']) - if create: - cr.save() - contributor['contributions_to_portfolio_projects'] = cr - contributor['org'] = get_org_name() - (c, created) = OutsideCommitter.objects.get_or_create( - **contributor - ) - if created: - c.save() - logger.info('\nOutsideCommitter %s has been saved' % name) - except Exception as ex: - logger.error( - 'Something went wrong saving this OutsideCommitter %s: %s' - % (name, ex)) diff --git a/openhub/outside_projects.py b/openhub/outside_projects.py deleted file mode 100644 index c9a3a068..00000000 --- a/openhub/outside_projects.py +++ /dev/null @@ -1,28 +0,0 @@ -import logging - -from community.git import get_org_name -from openhub.models import OutsideProject - - -def get_outside_projects_data(json_object): - data = json_object['response']['result' - ]['outside_projects']['project'] - return data - - -def import_data(project): - logger = logging.getLogger(__name__) - name = project.get('name', None) - - try: - project['org'] = get_org_name() - (c, created) = OutsideProject.objects.get_or_create( - **project - ) - if created: - c.save() - logger.info('\nOutsideProject %s has been saved' % c) - except Exception as ex: - logger.error( - 'Something went wrong saving this OutsideProject %s: %s' - % (name, ex)) diff --git a/openhub/portfolio_projects.py b/openhub/portfolio_projects.py deleted file mode 100644 index 74508742..00000000 --- a/openhub/portfolio_projects.py +++ /dev/null @@ -1,34 +0,0 @@ -import logging - -from community.git import get_org_name -from openhub.models import PortfolioProject, PortfolioProjectActivity - - -def get_portfolio_projects_data(json_object): - data = json_object['response']['result' - ]['portfolio_projects']['project'] - return data - - -def import_data(project): - logger = logging.getLogger(__name__) - name = project.get('name', None) - - try: - (cr, create) = PortfolioProjectActivity.objects.get_or_create( - **project['twelve_mo_activity_and_year_on_year_change'] - ) - if create: - cr.save() - project['twelve_mo_activity_and_year_on_year_change'] = cr - project['org'] = get_org_name() - (c, created) = PortfolioProject.objects.get_or_create( - **project - ) - if created: - c.save() - logger.info('\nPortfolioProject %s has been saved' % name) - except Exception as ex: - logger.error( - 'Something went wrong saving this PortfolioProject %s: %s' - % (name, ex)) diff --git a/openhub/urls.py b/openhub/urls.py index a3780aa2..e69de29b 100644 --- a/openhub/urls.py +++ b/openhub/urls.py @@ -1,7 +0,0 @@ -from django.conf.urls import url - -from . import views - -urlpatterns = [ - url(r'^$', views.index, name='index'), -] diff --git a/openhub/views.py b/openhub/views.py index 9b9feed4..e69de29b 100644 --- a/openhub/views.py +++ b/openhub/views.py @@ -1,20 +0,0 @@ -from django.shortcuts import render - -from openhub.models import PortfolioProject -from openhub.oh_token import OH_TOKEN - - -def index(request): - errors = [] - projects = [] - if OH_TOKEN is None: - errors.append(""" - OH_TOKEN is not specified as an environment variable.
- You can get an OpenHub token by signing up at - openhub.net. - """) - else: - projects = PortfolioProject.objects.all() - - args = {'projects': projects, 'errors': errors} - return render(request, 'openhub.html', args) diff --git a/setup.cfg b/setup.cfg index 60da3717..f14e311e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -82,7 +82,6 @@ omit = gsoc/*.py ci_build/*.py meta_review/handler.py - model/*.py openhub/*.py inactive_issues/inactive_issues_scraper.py unassigned_issues/unassigned_issues_scraper.py diff --git a/templates/model/templates/affiliated_committer_detail.html b/templates/model/templates/affiliated_committer_detail.html deleted file mode 100644 index eacf4334..00000000 --- a/templates/model/templates/affiliated_committer_detail.html +++ /dev/null @@ -1,15 +0,0 @@ -{% extends "model/templates/base.html" %} -{% block title %} -{{ affiliatedcommitter.name }} -{% endblock %} -{% block content %} -

Details of: {{ affiliatedcommitter.name }}

-

name:{{ affiliatedcommitter.name }}

-

org: {{ affiliatedcommitter.org }}

-

kudos: {{ affiliatedcommitter.kudos }}

-

level: {{ affiliatedcommitter.level }}

-

most commits project:{{ affiliatedcommitter.most_commits.project }}

-

most commits date:{{ affiliatedcommitter.most_commits.date }}

-

most recent commits project:{{ affiliatedcommitter.most_recent_commit.project }}

-

most recent commits data:{{ affiliatedcommitter.most_recent_commit.date }}

-{% endblock %} diff --git a/templates/model/templates/affiliated_committer_list.html b/templates/model/templates/affiliated_committer_list.html deleted file mode 100644 index f2d47aba..00000000 --- a/templates/model/templates/affiliated_committer_list.html +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "model/templates/base.html" %} -{% block title %} -Affiliated Contributors List -{% endblock %} -{% block content %} -

Affiliated Contributors List

-{% if affiliated_committer_list %} - -{% else %} -

There are no contributor.

-{% endif %}{# if affiliated_committer_list #} -{% endblock %} diff --git a/templates/model/templates/base.html b/templates/model/templates/base.html deleted file mode 100644 index f9e50e25..00000000 --- a/templates/model/templates/base.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - {% block title %} - {% endblock %} - - - - - -
-
- {% block content %}{% endblock %} -
-
- - - diff --git a/templates/model/templates/organization_detail.html b/templates/model/templates/organization_detail.html deleted file mode 100644 index 616b1aa4..00000000 --- a/templates/model/templates/organization_detail.html +++ /dev/null @@ -1,28 +0,0 @@ -{% extends "model/templates/base.html" %} -{% block title %} -{{ organization.name }} -{% endblock %} -{% block content %} -

Details of: {{ organization.name }}

-

name:{{ organization.name }}

-

url: {{ organization.url }}

-

html_url: {{ organization.html_url }}

-

created_at: {{ organization.created_at }}

-

updated_at:{{ organization.updated_at }}

-

description:{{ organization.description }}

-

homepage_url:{{ organization.homepage_url }}

-

url_name:{{ organization.url_name }}

-

org_type:{{ organization.org_type }}

-

medium_logo_url:{{ organization.medium_logo_url }}

-

small_logo_url:{{ organization.small_logo_url }}

-

outside_committers:{{ organization.infographic_details.outside_committers }}

-

outside_committers_commits:{{ organization.infographic_details.outside_committers_commits }}

-

projects_having_outside_commits:{{ organization.infographic_details.projects_having_outside_commits }}

-

portfolio_projects:{{ organization.infographic_details.portfolio_projects }}

-

affiliators:{{ organization.infographic_details.affiliators }}

-

affiliators_committing_to_portfolio_projects:{{ organization.infographic_details.affiliators_committing_to_portfolio_projects }}

-

affiliator_commits_to_portfolio_projects:{{ organization.infographic_details.affiliator_commits_to_portfolio_projects }}

-

outside_projects:{{ organization.infographic_details.affiliators_commiting_projects.outside_projects }}

-

outside_projects_commits:{{ organization.infographic_details.outside_projects_commits }}

-

affiliators_committing_to_outside_projects:{{ organization.infographic_details.affiliators_committing_to_outside_projects }}

-{% endblock %} diff --git a/templates/model/templates/organization_list.html b/templates/model/templates/organization_list.html deleted file mode 100644 index 1fa8a000..00000000 --- a/templates/model/templates/organization_list.html +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "model/templates/base.html" %} -{% block title %} -Organization -{% endblock %} -{% block content %} -

Organization

-{% if organization_list %} - -{% else %} -

There are no organization.

-{% endif %}{# if organization_list #} -{% endblock %} diff --git a/templates/model/templates/outside_committer_detail.html b/templates/model/templates/outside_committer_detail.html deleted file mode 100644 index 86feaf44..00000000 --- a/templates/model/templates/outside_committer_detail.html +++ /dev/null @@ -1,14 +0,0 @@ -{% extends "model/templates/base.html" %} -{% block title %} -{{ outsidecommitter.name }} -{% endblock %} -{% block content %} -

Details of: {{ outsidecommitter.name }}

-

name:{{ outsidecommitter.name }}

-

org: {{ outsidecommitter.org }}

-

kudos: {{ outsidecommitter.kudos }}

-

level: {{ outsidecommitter.level }}

-

affiliated with:{{ affiliated_committer.affiliated_with }}

-

projects:{{ affiliated_committer.contributions_to_portfolio_projects.projects }}

-

twelve_mo_commits:{{ affiliated_committer.contributions_to_portfolio_projects.twelve_mo_commits }}

-{% endblock %} diff --git a/templates/model/templates/outside_committer_list.html b/templates/model/templates/outside_committer_list.html deleted file mode 100644 index c600817f..00000000 --- a/templates/model/templates/outside_committer_list.html +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "model/templates/base.html" %} -{% block title %} -Outside Committer List -{% endblock %} -{% block content %} -

Outside Committer List

-{% if outside_committer_list %} - -{% else %} -

There are no outside committers.

-{% endif %}{# if outside_committer_list #} -{% endblock %} diff --git a/templates/model/templates/outside_project_detail.html b/templates/model/templates/outside_project_detail.html deleted file mode 100644 index de127f34..00000000 --- a/templates/model/templates/outside_project_detail.html +++ /dev/null @@ -1,14 +0,0 @@ -{% extends "model/templates/base.html" %} -{% block title %} -{{ outsideproject.name }} -{% endblock %} -{% block content %} -

Details of: {{ outsideproject.name }}

-

name:{{ outsideproject.name }}

-

activity: {{ outsideproject.activity }}

-

i_use_this: {{ outsideproject.i_use_this }}

-

community_rating: {{ outsideproject.community_rating }}

-

affiliates_contributing:{{ outsideproject.affiliates_contributing }}

-

commits_by_current_affiliates:{{ outsideproject.commits_by_current_affiliates }}

-

org:{{ outsideproject.org }}

-{% endblock %} diff --git a/templates/model/templates/outside_project_list.html b/templates/model/templates/outside_project_list.html deleted file mode 100644 index 73e574b8..00000000 --- a/templates/model/templates/outside_project_list.html +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "model/templates/base.html" %} -{% block title %} -Outside Project List -{% endblock %} -{% block content %} -

Outside Project List

-{% if outside_project_list %} - -{% else %} -

There are no outside projects.

-{% endif %}{# if outside_project_list #} -{% endblock %} diff --git a/templates/model/templates/portfolio_project_detail.html b/templates/model/templates/portfolio_project_detail.html deleted file mode 100644 index 1d893b41..00000000 --- a/templates/model/templates/portfolio_project_detail.html +++ /dev/null @@ -1,19 +0,0 @@ -{% extends "model/templates/base.html" %} -{% block title %} -{{ portfolioproject.name }} -{% endblock %} -{% block content %} -

Details of: {{ portfolioproject.name }}

-

name:{{ portfolioproject.name }}

-

activity: {{ portfolioproject.activity }}

-

i_use_this: {{ portfolioproject.i_use_this }}

-

primary_language: {{ portfolioproject.primary_language }}

-

community_rating:{{ portfolioproject.community_rating }}

-

org:{{ portfolioproject.org }}

-

commits:{{ portfolioproject.twelve_mo_activity_and_year_on_year_change.commits }}

-

change_in_commits:{{ portfolioproject.twelve_mo_activity_and_year_on_year_change.change_in_commits }}

-

percentage_change_in_commits:{{ portfolioproject.twelve_mo_activity_and_year_on_year_change.percentage_change_in_commits }}

-

contributors:{{ portfolioproject.twelve_mo_activity_and_year_on_year_change.contributors }}

-

change_in_contributors:{{ portfolioproject.twelve_mo_activity_and_year_on_year_change.change_in_contributors }}

-

percentage_change_in_committers:{{ portfolioproject.twelve_mo_activity_and_year_on_year_change.percentage_change_in_committers }}

-{% endblock %} diff --git a/templates/model/templates/portfolio_project_list.html b/templates/model/templates/portfolio_project_list.html deleted file mode 100644 index 02725928..00000000 --- a/templates/model/templates/portfolio_project_list.html +++ /dev/null @@ -1,18 +0,0 @@ -{% extends "model/templates/base.html" %} -{% block title %} -Portfolio Project List -{% endblock %} -{% block content %} -

Portfolio Project List

-{% if portfolio_project_list %} - -{% else %} -

There are no portfolio project.

-{% endif %}{# if portfolio_project_list #} -{% endblock %}