diff --git a/.gitignore b/.gitignore index 77d4985a..1a464681 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ project/local_settings.py + media/* staticdev_bk/* templates_bk/* @@ -9,8 +10,19 @@ templates_bk/* media Icon static/CACHE -static/node_modules +static/node_modules/ staticdev/CACHE venv .coverage -/static/css/.sass-cache/ \ No newline at end of file +/static/css/.sass-cache/ +.venv +.vscode +*.pem +Dockerfile +.dockerignore +.venv/* +client-cert.pem +client-key.pem +server-ca.pem +project/settings.py + diff --git a/apps/a1c_app/urls.py b/apps/a1c_app/urls.py index fe5bf051..9695f743 100644 --- a/apps/a1c_app/urls.py +++ b/apps/a1c_app/urls.py @@ -14,22 +14,21 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see """ -from django.conf.urls import url - from a1c_app.views import * +from django.urls import re_path urlpatterns = [ - url(r'^(?P\d+)/info$', get_a1c_info), - url(r'^(?P\d+)/value_info$', get_observation_value_info), - url(r'^(?P\d+)/add_note$', add_note), - url(r'^(?P\d+)/add_value$', add_value), - url(r'^(?P\d+)/patient_refused$', patient_refused), - url(r'^note/(?P\d+)/edit$', edit_note), - url(r'^note/(?P\d+)/delete$', delete_note), - url(r'^value/(?P\d+)/delete$', delete_value), - url(r'^value/(?P\d+)/edit$', edit_value), - url(r'^value/(?P\d+)/add_note$', add_value_note), - url(r'^value/note/(?P\d+)/edit$', edit_value_note), - url(r'^value/note/(?P\d+)/delete$', delete_value_note), - url(r'^(?P\d+)/track/click/$', track_a1c_click), + re_path(r"^(?P\d+)/info$", get_a1c_info), + re_path(r"^(?P\d+)/value_info$", get_observation_value_info), + re_path(r"^(?P\d+)/add_note$", add_note), + re_path(r"^(?P\d+)/add_value$", add_value), + re_path(r"^(?P\d+)/patient_refused$", patient_refused), + re_path(r"^note/(?P\d+)/edit$", edit_note), + re_path(r"^note/(?P\d+)/delete$", delete_note), + re_path(r"^value/(?P\d+)/delete$", delete_value), + re_path(r"^value/(?P\d+)/edit$", edit_value), + re_path(r"^value/(?P\d+)/add_note$", add_value_note), + re_path(r"^value/note/(?P\d+)/edit$", edit_value_note), + re_path(r"^value/note/(?P\d+)/delete$", delete_value_note), + re_path(r"^(?P\d+)/track/click/$", track_a1c_click), ] diff --git a/apps/colons_app/urls.py b/apps/colons_app/urls.py index 84532768..4ba46f47 100644 --- a/apps/colons_app/urls.py +++ b/apps/colons_app/urls.py @@ -15,43 +15,34 @@ along with this program. If not, see """ -from django.conf.urls import url - from colons_app.views import * +from django.urls import re_path urlpatterns = [ - url(r'^(?P\d+)/info$', get_colon_info), - url(r'^(?P\d+)/refuse$', refuse), - url(r'^(?P\d+)/not_appropriate$', not_appropriate), - - url(r'^study/(?P\d+)/info$', get_study_info), - url(r'^(?P\d+)/add_study$', add_study), - url(r'^(?P\d+)/edit_study$', edit_study), - url(r'^(?P\d+)/delete_study$', delete_study), - - url(r'^study/(?P\d+)/upload_image$', upload_study_image), - url(r'^study/(?P\d+)/addImage$', add_study_image), - url(r'^study/(?P\d+)/image/(?P\d+)/delete$', delete_study_image), - - url(r'^(?P\d+)/add_factor$', add_factor), - url(r'^(?P\d+)/delete_factor$', delete_factor), - - - url(r'^(?P\d+)/add_note$', add_note), - url(r'^note/(?P\d+)/edit$', edit_note), - url(r'^note/(?P\d+)/delete$', delete_note), - - url(r'^(?P\d+)/track/click$', track_colon_click), - + re_path(r"^(?P\d+)/info$", get_colon_info), + re_path(r"^(?P\d+)/refuse$", refuse), + re_path(r"^(?P\d+)/not_appropriate$", not_appropriate), + re_path(r"^study/(?P\d+)/info$", get_study_info), + re_path(r"^(?P\d+)/add_study$", add_study), + re_path(r"^(?P\d+)/edit_study$", edit_study), + re_path(r"^(?P\d+)/delete_study$", delete_study), + re_path(r"^study/(?P\d+)/upload_image$", upload_study_image), + re_path(r"^study/(?P\d+)/addImage$", add_study_image), + re_path( + r"^study/(?P\d+)/image/(?P\d+)/delete$", delete_study_image + ), + re_path(r"^(?P\d+)/add_factor$", add_factor), + re_path(r"^(?P\d+)/delete_factor$", delete_factor), + re_path(r"^(?P\d+)/add_note$", add_note), + re_path(r"^note/(?P\d+)/edit$", edit_note), + re_path(r"^note/(?P\d+)/delete$", delete_note), + re_path(r"^(?P\d+)/track/click$", track_colon_click), # new restURL - url(r'^(?P\d+)$', get_colon_info), - url(r'^(?P\d+)/studies$', get_colon_cancer_studies), - url(r'^(?P\d+)/studies/(?P\d+)$', colon_cancer_study), - - url(r'^(?P\d+)/risk-factors$', get_risk_factors), - url(r'^(?P\d+)/risk-factors/(?P\d+)$', risk_factor), - - url(r'^(?P\d+)/notes$', get_notes), - url(r'^(?P\d+)/notes/(?P\d+)$', note), - + re_path(r"^(?P\d+)$", get_colon_info), + re_path(r"^(?P\d+)/studies$", get_colon_cancer_studies), + re_path(r"^(?P\d+)/studies/(?P\d+)$", colon_cancer_study), + re_path(r"^(?P\d+)/risk-factors$", get_risk_factors), + re_path(r"^(?P\d+)/risk-factors/(?P\d+)$", risk_factor), + re_path(r"^(?P\d+)/notes$", get_notes), + re_path(r"^(?P\d+)/notes/(?P\d+)$", note), ] diff --git a/apps/data_app/operations.py b/apps/data_app/operations.py index 8cb6c4f6..5d0bd9a1 100644 --- a/apps/data_app/operations.py +++ b/apps/data_app/operations.py @@ -14,11 +14,8 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see """ -from itertools import izip - -from django.db import connection - from common.views import timeit +from django.db import connection from emr.models import ObservationValue @@ -56,7 +53,7 @@ def query_to_dicts(query_string, *query_args): row = cursor.fetchone() if row is None: break - row_dict = dict(izip(col_names, row)) + row_dict = dict(zip(col_names, row)) yield row_dict return diff --git a/apps/data_app/urls.py b/apps/data_app/urls.py index fa2b9067..d534ce85 100644 --- a/apps/data_app/urls.py +++ b/apps/data_app/urls.py @@ -14,27 +14,33 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see """ -from django.conf.urls import url - from data_app.views import * +from django.urls import re_path urlpatterns = [ - url(r'^track/click$', track_observation_click), - url(r'^(?P\d+)/info$', get_observation_info), - url(r'^(?P\d+)/(?P\d+)/individual_data_info$', get_individual_data_info), - url(r'^(?P\d+)/get_datas$', get_datas), - url(r'^(?P\d+)/add_new_data_type$', add_new_data_type), - url(r'^(?P\d+)/(?P\d+)/save_data_type$', save_data_type), - url(r'^(?P\d+)/(?P\d+)/delete_data$', delete_data), - url(r'^updateOrder$', update_order), - url(r'^(?P\d+)/get_pins$', get_pins), - url(r'^(?P\d+)/pin_to_problem$', obseration_pin_to_problem), - url(r'^(?P\d+)/(?P\d+)/add_new_data$', add_new_data), - url(r'^(?P\d+)/(?P\d+)/delete_individual_data$', delete_individual_data), - url(r'^(?P\d+)/(?P\d+)/save_data$', save_data), - url(r'^update_graph$', update_graph), - + re_path(r"^track/click$", track_observation_click), + re_path(r"^(?P\d+)/info$", get_observation_info), + re_path( + r"^(?P\d+)/(?P\d+)/individual_data_info$", + get_individual_data_info, + ), + re_path(r"^(?P\d+)/get_datas$", get_datas), + re_path(r"^(?P\d+)/add_new_data_type$", add_new_data_type), + re_path( + r"^(?P\d+)/(?P\d+)/save_data_type$", save_data_type + ), + re_path(r"^(?P\d+)/(?P\d+)/delete_data$", delete_data), + re_path(r"^updateOrder$", update_order), + re_path(r"^(?P\d+)/get_pins$", get_pins), + re_path(r"^(?P\d+)/pin_to_problem$", obseration_pin_to_problem), + re_path(r"^(?P\d+)/(?P\d+)/add_new_data$", add_new_data), + re_path( + r"^(?P\d+)/(?P\d+)/delete_individual_data$", + delete_individual_data, + ), + re_path(r"^(?P\d+)/(?P\d+)/save_data$", save_data), + re_path(r"^update_graph$", update_graph), # Allow to edit multiple observation component value - url(r'^(?P\d+)/delete$', delete_component_values), - url(r'(?P\d+)/values$', get_observation_values), + re_path(r"^(?P\d+)/delete$", delete_component_values), + re_path(r"(?P\d+)/values$", get_observation_values), ] diff --git a/apps/data_app/views.py b/apps/data_app/views.py index cda06f88..25e6a8d7 100644 --- a/apps/data_app/views.py +++ b/apps/data_app/views.py @@ -16,21 +16,37 @@ """ from math import pow +from common.views import * +from data_app.operations import ( + get_observation_most_common_value, + get_observation_value_pair, +) from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.db.models import * -from rest_framework.decorators import api_view - -from common.views import * -from data_app.operations import get_observation_most_common_value, get_observation_value_pair -from emr.models import OBSERVATION_TYPES -from emr.models import Observation, ObservationComponent, ObservationOrder, \ - PhysicianTeam, ObservationPinToProblem, Problem, ObservationUnit, ObservationValue, \ - Inr, UserProfile +from emr.models import ( + OBSERVATION_TYPES, + Inr, + Observation, + ObservationComponent, + ObservationOrder, + ObservationPinToProblem, + ObservationUnit, + ObservationValue, + PhysicianTeam, + Problem, + UserProfile, +) from emr.operations import op_add_event from inr_app.serializers import InrSerializer +from rest_framework.decorators import api_view from users_app.views import permissions_accessed -from .serializers import ObservationSerializer, ObservationPinToProblemSerializer, ObservationValueSerializer + +from .serializers import ( + ObservationPinToProblemSerializer, + ObservationSerializer, + ObservationValueSerializer, +) @login_required diff --git a/apps/document_app/urls.py b/apps/document_app/urls.py index 5d8c5bf0..b2686be3 100644 --- a/apps/document_app/urls.py +++ b/apps/document_app/urls.py @@ -14,24 +14,23 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see """ -from django.conf.urls import url - +from django.urls import re_path from document_app.views import * urlpatterns = [ - url(r'^$', get_document_list), - url(r'^upload_document$', upload_document), - url(r'^info/(?P\d+)$', document_info), - url(r'^pin/patient$', pin_patient_2_document), - url(r'^pin/label$', pin_label_2_document), - url(r'^remove/label$', remove_document_label), - url(r'^pin/todo$', pin_todo_2_document), - url(r'^unpin/todo$', unpin_document_todo), - url(r'^pin/problem$', pin_problem_2_document), - url(r'^unpin/problem$', unpin_document_problem), - url(r'^search_patient$', search_patient), - url(r'^(?P\d+)/get_pinned_document$', get_patient_document), - url(r'^delete/(?P\d+)$', delete_document), - url(r'^remove/(?P\d+)$', remove_document), - url(r'^(?P\d+)/name$', update_name) + re_path(r"^$", get_document_list), + re_path(r"^upload_document$", upload_document), + re_path(r"^info/(?P\d+)$", document_info), + re_path(r"^pin/patient$", pin_patient_2_document), + re_path(r"^pin/label$", pin_label_2_document), + re_path(r"^remove/label$", remove_document_label), + re_path(r"^pin/todo$", pin_todo_2_document), + re_path(r"^unpin/todo$", unpin_document_todo), + re_path(r"^pin/problem$", pin_problem_2_document), + re_path(r"^unpin/problem$", unpin_document_problem), + re_path(r"^search_patient$", search_patient), + re_path(r"^(?P\d+)/get_pinned_document$", get_patient_document), + re_path(r"^delete/(?P\d+)$", delete_document), + re_path(r"^remove/(?P\d+)$", remove_document), + re_path(r"^(?P\d+)/name$", update_name), ] diff --git a/apps/emr/middleware.py b/apps/emr/middleware.py index 10ee5ecd..e86d634d 100644 --- a/apps/emr/middleware.py +++ b/apps/emr/middleware.py @@ -15,13 +15,15 @@ along with this program. If not, see """ +from django.utils.deprecation import MiddlewareMixin + from .models import AccessLog -class AccessLogMiddleware(object): +class AccessLogMiddleware(MiddlewareMixin): def process_request(self, request): - if request.user.is_authenticated() and not request.path.startswith('/list_of') and not request.path.endswith( + if request.user.is_authenticated and not request.path.startswith('/list_of') and not request.path.endswith( '/encounter/status'): access_log = AccessLog(user=request.user, summary=request.path) access_log.save() diff --git a/apps/emr/migrations/0001_initial.py b/apps/emr/migrations/0001_initial.py index 82f4abc1..dee81062 100644 --- a/apps/emr/migrations/0001_initial.py +++ b/apps/emr/migrations/0001_initial.py @@ -1,11 +1,10 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals +import emr.models import mptt.fields from django.conf import settings -from django.db import models, migrations - -import emr.models +from django.db import migrations, models class Migration(migrations.Migration): @@ -21,7 +20,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('datetime', models.DateTimeField(auto_now_add=True)), ('summary', models.TextField()), - ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), + ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), ], ), migrations.CreateModel( @@ -41,7 +40,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('datetime', models.DateTimeField(auto_now_add=True)), ('object_id', models.PositiveIntegerField()), - ('content_type', models.ForeignKey(to='contenttypes.ContentType')), + ('content_type', models.ForeignKey(to='contenttypes.ContentType', on_delete=models.DO_NOTHING)), ], ), migrations.CreateModel( @@ -50,7 +49,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('datetime', models.DateTimeField(auto_now_add=True)), ('summary', models.TextField()), - ('patient', models.ForeignKey(to=settings.AUTH_USER_MODEL)), + ('patient', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), ], ), migrations.CreateModel( @@ -77,7 +76,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('form', models.TextField()), - ('guideline', models.OneToOneField(to='emr.Guideline')), + ('guideline', models.OneToOneField(to='emr.Guideline', on_delete=models.DO_NOTHING)), ], ), migrations.CreateModel( @@ -86,7 +85,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('image', models.ImageField(upload_to=emr.models.get_path)), ('datetime', models.DateTimeField(auto_now_add=True)), - ('patient', models.ForeignKey(to=settings.AUTH_USER_MODEL)), + ('patient', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), ], ), migrations.CreateModel( @@ -112,8 +111,8 @@ class Migration(migrations.Migration): name='ProblemRelationship', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('source', models.ForeignKey(related_name='source', to='emr.Problem')), - ('target', models.ForeignKey(related_name='target', to='emr.Problem')), + ('source', models.ForeignKey(related_name='source', to='emr.Problem', on_delete=models.DO_NOTHING)), + ('target', models.ForeignKey(related_name='target', to='emr.Problem', on_delete=models.DO_NOTHING)), ], ), migrations.CreateModel( @@ -121,8 +120,8 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('all', models.BooleanField(default=True)), - ('other_patient', models.ForeignKey(related_name='other_patient', to=settings.AUTH_USER_MODEL)), - ('patient', models.ForeignKey(related_name='target_patient', to=settings.AUTH_USER_MODEL)), + ('other_patient', models.ForeignKey(related_name='other_patient', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), + ('patient', models.ForeignKey(related_name='target_patient', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), ], ), migrations.CreateModel( @@ -142,8 +141,8 @@ class Migration(migrations.Migration): ('todo', models.TextField()), ('accomplished', models.BooleanField(default=False)), ('notes', models.ManyToManyField(to='emr.TextNote', blank=True)), - ('patient', models.ForeignKey(to=settings.AUTH_USER_MODEL)), - ('problem', models.ForeignKey(blank=True, to='emr.Problem', null=True)), + ('patient', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), + ('problem', models.ForeignKey(blank=True, to='emr.Problem', null=True, on_delete=models.DO_NOTHING)), ], ), migrations.CreateModel( @@ -161,7 +160,7 @@ class Migration(migrations.Migration): models.CharField(blank=True, max_length=6, choices=[(b'male', b'male'), (b'female', b'female')])), ('date_of_birth', models.DateField(null=True, blank=True)), ('phone_number', models.CharField(max_length=20, blank=True)), - ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, unique=True)), + ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, unique=True, on_delete=models.DO_NOTHING)), ], ), migrations.CreateModel( @@ -171,8 +170,8 @@ class Migration(migrations.Migration): ('datetime', models.DateTimeField(auto_now=True)), ('tracking_id', models.CharField(max_length=20, blank=True)), ('user_agent', models.CharField(max_length=200, blank=True)), - ('patient', models.ForeignKey(related_name='viewed_patient', to=settings.AUTH_USER_MODEL)), - ('viewer', models.ForeignKey(related_name='viewer', to=settings.AUTH_USER_MODEL)), + ('patient', models.ForeignKey(related_name='viewed_patient', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), + ('viewer', models.ForeignKey(related_name='viewer', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), ], ), migrations.CreateModel( @@ -180,7 +179,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('status', models.TextField()), - ('patient', models.ForeignKey(to=settings.AUTH_USER_MODEL)), + ('patient', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), ], ), migrations.AddField( @@ -191,17 +190,17 @@ class Migration(migrations.Migration): migrations.AddField( model_name='problem', name='parent', - field=mptt.fields.TreeForeignKey(related_name='children', blank=True, to='emr.Problem', null=True), + field=mptt.fields.TreeForeignKey(related_name='children', blank=True, to='emr.Problem', null=True, on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='problem', name='patient', - field=models.ForeignKey(to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='patientimage', name='problem', - field=models.ForeignKey(blank=True, to='emr.Problem', null=True), + field=models.ForeignKey(blank=True, to='emr.Problem', null=True, on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='goal', @@ -211,12 +210,12 @@ class Migration(migrations.Migration): migrations.AddField( model_name='goal', name='patient', - field=models.ForeignKey(to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='goal', name='problem', - field=models.ForeignKey(blank=True, to='emr.Problem', null=True), + field=models.ForeignKey(blank=True, to='emr.Problem', null=True, on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='encounter', @@ -226,11 +225,11 @@ class Migration(migrations.Migration): migrations.AddField( model_name='encounter', name='patient', - field=models.ForeignKey(related_name='patient', to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(related_name='patient', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='encounter', name='physician', - field=models.ForeignKey(related_name='physician', to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(related_name='physician', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0002_auto_20150527_0747.py b/apps/emr/migrations/0002_auto_20150527_0747.py index 2997b7fa..b6e3030a 100644 --- a/apps/emr/migrations/0002_auto_20150527_0747.py +++ b/apps/emr/migrations/0002_auto_20150527_0747.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -26,7 +26,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='encounterevent', name='encounter', - field=models.ForeignKey(related_name='encounter_events', blank=True, to='emr.Encounter', null=True), + field=models.ForeignKey(related_name='encounter_events', blank=True, to='emr.Encounter', null=True, on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='encounterevent', @@ -37,11 +37,11 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='encounter', name='patient', - field=models.ForeignKey(related_name='patient_encounters', to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(related_name='patient_encounters', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING), ), migrations.AlterField( model_name='encounter', name='physician', - field=models.ForeignKey(related_name='physician_encounters', to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(related_name='physician_encounters', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0005_auto_20150723_0942.py b/apps/emr/migrations/0005_auto_20150723_0942.py index 2a0dd3ac..d9bd9031 100644 --- a/apps/emr/migrations/0005_auto_20150723_0942.py +++ b/apps/emr/migrations/0005_auto_20150723_0942.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -13,7 +13,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='textnote', name='author', - field=models.ForeignKey(blank=True, to='emr.UserProfile', null=True), + field=models.ForeignKey(blank=True, to='emr.UserProfile', null=True, on_delete=models.DO_NOTHING), ), migrations.AlterField( model_name='userprofile', diff --git a/apps/emr/migrations/0006_patientcontroller.py b/apps/emr/migrations/0006_patientcontroller.py index 44608527..60491f7b 100644 --- a/apps/emr/migrations/0006_patientcontroller.py +++ b/apps/emr/migrations/0006_patientcontroller.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -17,8 +17,8 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('author', models.BooleanField()), - ('patient', models.ForeignKey(related_name='patient_physicians', to=settings.AUTH_USER_MODEL)), - ('physician', models.ForeignKey(related_name='physician_patients', to=settings.AUTH_USER_MODEL)), + ('patient', models.ForeignKey(related_name='patient_physicians', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), + ('physician', models.ForeignKey(related_name='physician_patients', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), ], ), ] diff --git a/apps/emr/migrations/0007_auto_20150824_0111.py b/apps/emr/migrations/0007_auto_20150824_0111.py index 401db24e..bf8bf7d2 100644 --- a/apps/emr/migrations/0007_auto_20150824_0111.py +++ b/apps/emr/migrations/0007_auto_20150824_0111.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -14,6 +14,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='userprofile', name='user', - field=models.OneToOneField(to=settings.AUTH_USER_MODEL), + field=models.OneToOneField(to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0009_physicianteam.py b/apps/emr/migrations/0009_physicianteam.py index de181eb4..efd0db63 100644 --- a/apps/emr/migrations/0009_physicianteam.py +++ b/apps/emr/migrations/0009_physicianteam.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -16,8 +16,8 @@ class Migration(migrations.Migration): name='PhysicianTeam', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('member', models.ForeignKey(related_name='user_leaders', to=settings.AUTH_USER_MODEL)), - ('physician', models.ForeignKey(related_name='physician_helpers', to=settings.AUTH_USER_MODEL)), + ('member', models.ForeignKey(related_name='user_leaders', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), + ('physician', models.ForeignKey(related_name='physician_helpers', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), ], ), ] diff --git a/apps/emr/migrations/0011_auto_20150913_0210.py b/apps/emr/migrations/0011_auto_20150913_0210.py index 4cd28244..71f4a7ce 100644 --- a/apps/emr/migrations/0011_auto_20150913_0210.py +++ b/apps/emr/migrations/0011_auto_20150913_0210.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -19,7 +19,7 @@ class Migration(migrations.Migration): ('note', models.TextField()), ('note_type', models.CharField(max_length=50, choices=[(b'wiki', b'Wiki'), (b'history', b'History')])), ('created_on', models.DateTimeField(auto_now_add=True)), - ('author', models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True)), + ('author', models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.DO_NOTHING)), ], ), migrations.RemoveField( @@ -29,6 +29,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='problemnote', name='problem', - field=models.ForeignKey(blank=True, to='emr.Problem', null=True), + field=models.ForeignKey(blank=True, to='emr.Problem', null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0012_auto_20150915_1120.py b/apps/emr/migrations/0012_auto_20150915_1120.py index 1006a2eb..3f6e0c33 100644 --- a/apps/emr/migrations/0012_auto_20150915_1120.py +++ b/apps/emr/migrations/0012_auto_20150915_1120.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -13,6 +13,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='problemnote', name='author', - field=models.ForeignKey(blank=True, to='emr.UserProfile', null=True), + field=models.ForeignKey(blank=True, to='emr.UserProfile', null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0013_problemactivity.py b/apps/emr/migrations/0013_problemactivity.py index f5b50a95..934e369b 100644 --- a/apps/emr/migrations/0013_problemactivity.py +++ b/apps/emr/migrations/0013_problemactivity.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -17,8 +17,8 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('activity', models.TextField()), - ('author', models.ForeignKey(to=settings.AUTH_USER_MODEL)), - ('problem', models.ForeignKey(to='emr.Problem')), + ('author', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), + ('problem', models.ForeignKey(to='emr.Problem', on_delete=models.DO_NOTHING)), ], ), ] diff --git a/apps/emr/migrations/0014_auto_20151014_0629.py b/apps/emr/migrations/0014_auto_20151014_0629.py index 9857095c..c0d8fa4b 100644 --- a/apps/emr/migrations/0014_auto_20151014_0629.py +++ b/apps/emr/migrations/0014_auto_20151014_0629.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -13,6 +13,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='problemactivity', name='author', - field=models.ForeignKey(blank=True, to='emr.UserProfile', null=True), + field=models.ForeignKey(blank=True, to='emr.UserProfile', null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0016_encounterproblemrecord.py b/apps/emr/migrations/0016_encounterproblemrecord.py index 8cab6a75..9e840674 100644 --- a/apps/emr/migrations/0016_encounterproblemrecord.py +++ b/apps/emr/migrations/0016_encounterproblemrecord.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -14,8 +14,8 @@ class Migration(migrations.Migration): name='EncounterProblemRecord', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('encounter', models.ForeignKey(related_name='encounter_problem_records', to='emr.Encounter')), - ('problem', models.ForeignKey(related_name='problem_encounter_records', to='emr.Problem')), + ('encounter', models.ForeignKey(related_name='encounter_problem_records', to='emr.Encounter', on_delete=models.DO_NOTHING)), + ('problem', models.ForeignKey(related_name='problem_encounter_records', to='emr.Problem', on_delete=models.DO_NOTHING)), ], ), ] diff --git a/apps/emr/migrations/0019_problemsegment.py b/apps/emr/migrations/0019_problemsegment.py index d9f3fb75..bcbae081 100644 --- a/apps/emr/migrations/0019_problemsegment.py +++ b/apps/emr/migrations/0019_problemsegment.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -18,7 +18,7 @@ class Migration(migrations.Migration): ('is_active', models.BooleanField(default=True)), ('authenticated', models.BooleanField(default=False)), ('start_date', models.DateField(auto_now_add=True)), - ('problem', models.ForeignKey(to='emr.Problem')), + ('problem', models.ForeignKey(to='emr.Problem', on_delete=models.DO_NOTHING)), ], ), ] diff --git a/apps/emr/migrations/0021_auto_20160111_2140.py b/apps/emr/migrations/0021_auto_20160111_2140.py index 8b234576..030b9053 100644 --- a/apps/emr/migrations/0021_auto_20160111_2140.py +++ b/apps/emr/migrations/0021_auto_20160111_2140.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -18,6 +18,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='problemsegment', name='problem', - field=models.ForeignKey(related_name='problem_segment', to='emr.Problem'), + field=models.ForeignKey(related_name='problem_segment', to='emr.Problem', on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0026_todocomment.py b/apps/emr/migrations/0026_todocomment.py index 27ff85b1..c65b87e3 100644 --- a/apps/emr/migrations/0026_todocomment.py +++ b/apps/emr/migrations/0026_todocomment.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -18,8 +18,8 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('comment', models.TextField()), ('datetime', models.DateTimeField(auto_now_add=True)), - ('todo', models.ForeignKey(to='emr.ToDo')), - ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), + ('todo', models.ForeignKey(to='emr.ToDo', on_delete=models.DO_NOTHING)), + ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), ], ), ] diff --git a/apps/emr/migrations/0027_auto_20160203_0257.py b/apps/emr/migrations/0027_auto_20160203_0257.py index f73ea50d..d3b8d487 100644 --- a/apps/emr/migrations/0027_auto_20160203_0257.py +++ b/apps/emr/migrations/0027_auto_20160203_0257.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -16,7 +16,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name', models.TextField(null=True, blank=True)), ('css_class', models.TextField(null=True, blank=True)), - ('todo', models.ForeignKey(related_name='todo_label', to='emr.ToDo')), + ('todo', models.ForeignKey(related_name='todo_label', to='emr.ToDo', on_delete=models.DO_NOTHING)), ], ), migrations.AlterField( diff --git a/apps/emr/migrations/0028_auto_20160218_0200.py b/apps/emr/migrations/0028_auto_20160218_0200.py index c8a70df0..79612060 100644 --- a/apps/emr/migrations/0028_auto_20160218_0200.py +++ b/apps/emr/migrations/0028_auto_20160218_0200.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -18,18 +18,18 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('attachment', models.FileField(upload_to=b'attachments/', blank=True)), ('datetime', models.DateTimeField(auto_now=True)), - ('todo', models.ForeignKey(related_name='attachments', to='emr.ToDo')), - ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), + ('todo', models.ForeignKey(related_name='attachments', to='emr.ToDo', on_delete=models.DO_NOTHING)), + ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), ], ), migrations.AlterField( model_name='todocomment', name='todo', - field=models.ForeignKey(related_name='comments', to='emr.ToDo'), + field=models.ForeignKey(related_name='comments', to='emr.ToDo', on_delete=models.DO_NOTHING), ), migrations.AlterField( model_name='todolabel', name='todo', - field=models.ForeignKey(related_name='labels', to='emr.ToDo'), + field=models.ForeignKey(related_name='labels', to='emr.ToDo', on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0029_encountertodorecord.py b/apps/emr/migrations/0029_encountertodorecord.py index 6b56dde6..84f5e561 100644 --- a/apps/emr/migrations/0029_encountertodorecord.py +++ b/apps/emr/migrations/0029_encountertodorecord.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -14,8 +14,8 @@ class Migration(migrations.Migration): name='EncounterTodoRecord', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('encounter', models.ForeignKey(related_name='encounter_todo_records', to='emr.Encounter')), - ('todo', models.ForeignKey(related_name='todo_encounter_records', to='emr.ToDo')), + ('encounter', models.ForeignKey(related_name='encounter_todo_records', to='emr.Encounter', on_delete=models.DO_NOTHING)), + ('todo', models.ForeignKey(related_name='todo_encounter_records', to='emr.ToDo', on_delete=models.DO_NOTHING)), ], ), ] diff --git a/apps/emr/migrations/0030_todoactivity.py b/apps/emr/migrations/0030_todoactivity.py index 5d233a59..6573ad6f 100644 --- a/apps/emr/migrations/0030_todoactivity.py +++ b/apps/emr/migrations/0030_todoactivity.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -16,10 +16,10 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('activity', models.TextField()), ('created_on', models.DateTimeField(auto_now_add=True)), - ('attachment', models.ForeignKey(blank=True, to='emr.ToDoAttachment', null=True)), - ('author', models.ForeignKey(blank=True, to='emr.UserProfile', null=True)), - ('comment', models.ForeignKey(blank=True, to='emr.ToDoComment', null=True)), - ('todo', models.ForeignKey(to='emr.ToDo')), + ('attachment', models.ForeignKey(blank=True, to='emr.ToDoAttachment', null=True, on_delete=models.DO_NOTHING)), + ('author', models.ForeignKey(blank=True, to='emr.UserProfile', null=True, on_delete=models.DO_NOTHING)), + ('comment', models.ForeignKey(blank=True, to='emr.ToDoComment', null=True, on_delete=models.DO_NOTHING)), + ('todo', models.ForeignKey(to='emr.ToDo', on_delete=models.DO_NOTHING)), ], options={ 'ordering': ['-created_on'], diff --git a/apps/emr/migrations/0033_label_patient.py b/apps/emr/migrations/0033_label_patient.py index 6f73a92d..241aadfb 100644 --- a/apps/emr/migrations/0033_label_patient.py +++ b/apps/emr/migrations/0033_label_patient.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -15,6 +15,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='label', name='patient', - field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True), + field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0034_auto_20160311_2028.py b/apps/emr/migrations/0034_auto_20160311_2028.py index ec2ef7aa..d9dfa287 100644 --- a/apps/emr/migrations/0034_auto_20160311_2028.py +++ b/apps/emr/migrations/0034_auto_20160311_2028.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -20,11 +20,11 @@ class Migration(migrations.Migration): migrations.AddField( model_name='todo', name='user', - field=models.ForeignKey(related_name='todo_owner', blank=True, to=settings.AUTH_USER_MODEL, null=True), + field=models.ForeignKey(related_name='todo_owner', blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.DO_NOTHING), ), migrations.AlterField( model_name='todo', name='patient', - field=models.ForeignKey(related_name='todo_patient', blank=True, to=settings.AUTH_USER_MODEL, null=True), + field=models.ForeignKey(related_name='todo_patient', blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0035_auto_20160312_0130.py b/apps/emr/migrations/0035_auto_20160312_0130.py index 71fad1ca..47ca8984 100644 --- a/apps/emr/migrations/0035_auto_20160312_0130.py +++ b/apps/emr/migrations/0035_auto_20160312_0130.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -17,13 +17,13 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('order', models.BigIntegerField(null=True, blank=True)), - ('todo', models.ForeignKey(blank=True, to='emr.ToDo', null=True)), - ('user', models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True)), + ('todo', models.ForeignKey(blank=True, to='emr.ToDo', null=True, on_delete=models.DO_NOTHING)), + ('user', models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.DO_NOTHING)), ], ), migrations.AlterField( model_name='userprofile', name='user', - field=models.OneToOneField(related_name='profile', to=settings.AUTH_USER_MODEL), + field=models.OneToOneField(related_name='profile', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0036_labeledtodolist.py b/apps/emr/migrations/0036_labeledtodolist.py index 56ecb4ae..6a629f30 100644 --- a/apps/emr/migrations/0036_labeledtodolist.py +++ b/apps/emr/migrations/0036_labeledtodolist.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -18,7 +18,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name', models.TextField()), ('labels', models.ManyToManyField(to='emr.Label', blank=True)), - ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)), + ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), ], ), ] diff --git a/apps/emr/migrations/0038_auto_20160320_2319.py b/apps/emr/migrations/0038_auto_20160320_2319.py index c6137140..0eecb5df 100644 --- a/apps/emr/migrations/0038_auto_20160320_2319.py +++ b/apps/emr/migrations/0038_auto_20160320_2319.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -15,7 +15,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='label', name='author', - field=models.ForeignKey(related_name='label_author', blank=True, to=settings.AUTH_USER_MODEL, null=True), + field=models.ForeignKey(related_name='label_author', blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='label', @@ -25,6 +25,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='label', name='user', - field=models.ForeignKey(related_name='label_user', blank=True, to=settings.AUTH_USER_MODEL, null=True), + field=models.ForeignKey(related_name='label_user', blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0040_auto_20160406_2334.py b/apps/emr/migrations/0040_auto_20160406_2334.py index d5159635..9ddf484e 100644 --- a/apps/emr/migrations/0040_auto_20160406_2334.py +++ b/apps/emr/migrations/0040_auto_20160406_2334.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -96,7 +96,7 @@ class Migration(migrations.Migration): ('value_string', models.TextField(null=True, blank=True)), ('value_unit', models.CharField(max_length=45, null=True, blank=True)), ('comments', models.TextField(null=True, blank=True)), - ('observation', models.ForeignKey(related_name='observation_components', to='emr.Observation')), + ('observation', models.ForeignKey(related_name='observation_components', to='emr.Observation', on_delete=models.DO_NOTHING)), ], ), migrations.CreateModel( @@ -105,7 +105,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('code', models.CharField(max_length=2)), ('name', models.CharField(max_length=50)), - ('country', models.ForeignKey(related_name='country_states', to='emr.Country')), + ('country', models.ForeignKey(related_name='country_states', to='emr.Country', on_delete=models.DO_NOTHING)), ], ), migrations.CreateModel( @@ -130,10 +130,10 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('start', models.DateField(null=True, blank=True)), ('end', models.DateField(null=True, blank=True)), - ('address', models.ForeignKey(related_name='address_users', to='emr.Address')), - ('type_code', models.ForeignKey(related_name='type_code_user_address', to='emr.AddressType')), - ('use_code', models.ForeignKey(related_name='use_code_user_address', to='emr.AddressUse')), - ('user', models.ForeignKey(related_name='user_addresses', to=settings.AUTH_USER_MODEL)), + ('address', models.ForeignKey(related_name='address_users', to='emr.Address', on_delete=models.DO_NOTHING)), + ('type_code', models.ForeignKey(related_name='type_code_user_address', to='emr.AddressType', on_delete=models.DO_NOTHING)), + ('use_code', models.ForeignKey(related_name='use_code_user_address', to='emr.AddressUse', on_delete=models.DO_NOTHING)), + ('user', models.ForeignKey(related_name='user_addresses', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), ], ), migrations.CreateModel( @@ -144,8 +144,8 @@ class Migration(migrations.Migration): ('rank', models.PositiveIntegerField(null=True, blank=True)), ('start', models.DateField(null=True, blank=True)), ('end', models.DateField(null=True, blank=True)), - ('telecom', models.ForeignKey(related_name='telecom_users', to='emr.Telecom')), - ('user', models.ForeignKey(related_name='user_telecoms', to=settings.AUTH_USER_MODEL)), + ('telecom', models.ForeignKey(related_name='telecom_users', to='emr.Telecom', on_delete=models.DO_NOTHING)), + ('user', models.ForeignKey(related_name='user_telecoms', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), ], ), migrations.AddField( @@ -156,36 +156,36 @@ class Migration(migrations.Migration): migrations.AddField( model_name='observation', name='author', - field=models.ForeignKey(related_name='observation_authors', blank=True, to='emr.UserProfile', null=True), + field=models.ForeignKey(related_name='observation_authors', blank=True, to='emr.UserProfile', null=True, on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='observation', name='encounter', - field=models.ForeignKey(related_name='observation_encounters', blank=True, to='emr.UserProfile', null=True), + field=models.ForeignKey(related_name='observation_encounters', blank=True, to='emr.UserProfile', null=True, on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='observation', name='performer', - field=models.ForeignKey(related_name='observation_performers', blank=True, to='emr.UserProfile', null=True), + field=models.ForeignKey(related_name='observation_performers', blank=True, to='emr.UserProfile', null=True, on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='observation', name='subject', - field=models.ForeignKey(related_name='observation_subjects', to='emr.UserProfile'), + field=models.ForeignKey(related_name='observation_subjects', to='emr.UserProfile', on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='city', name='state', - field=models.ForeignKey(related_name='state_cities', to='emr.State'), + field=models.ForeignKey(related_name='state_cities', to='emr.State', on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='address', name='city', - field=models.ForeignKey(related_name='city_addresses', to='emr.City'), + field=models.ForeignKey(related_name='city_addresses', to='emr.City', on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='userprofile', name='marital_status', - field=models.ForeignKey(blank=True, to='emr.MaritalStatus', null=True), + field=models.ForeignKey(blank=True, to='emr.MaritalStatus', null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0041_observation_problem.py b/apps/emr/migrations/0041_observation_problem.py index 7fcdb428..c279b953 100644 --- a/apps/emr/migrations/0041_observation_problem.py +++ b/apps/emr/migrations/0041_observation_problem.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -13,7 +13,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='observation', name='problem', - field=models.ForeignKey(related_name='problem_observations', default=1, to='emr.Problem'), + field=models.ForeignKey(related_name='problem_observations', default=1, to='emr.Problem', on_delete=models.DO_NOTHING), preserve_default=False, ), ] diff --git a/apps/emr/migrations/0042_auto_20160414_0305.py b/apps/emr/migrations/0042_auto_20160414_0305.py index 2c05b4fd..ebbf9b0c 100644 --- a/apps/emr/migrations/0042_auto_20160414_0305.py +++ b/apps/emr/migrations/0042_auto_20160414_0305.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -16,13 +16,13 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('note', models.TextField()), ('datetime', models.DateTimeField(auto_now_add=True)), - ('author', models.ForeignKey(blank=True, to='emr.UserProfile', null=True)), - ('observation', models.ForeignKey(related_name='observation_notes', to='emr.Observation')), + ('author', models.ForeignKey(blank=True, to='emr.UserProfile', null=True, on_delete=models.DO_NOTHING)), + ('observation', models.ForeignKey(related_name='observation_notes', to='emr.Observation', on_delete=models.DO_NOTHING)), ], ), migrations.AddField( model_name='todo', name='observation', - field=models.ForeignKey(related_name='observation_todos', blank=True, to='emr.Observation', null=True), + field=models.ForeignKey(related_name='observation_todos', blank=True, to='emr.Observation', null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0046_observationcomponenttextnote.py b/apps/emr/migrations/0046_observationcomponenttextnote.py index b8ec2987..8d73fcf7 100644 --- a/apps/emr/migrations/0046_observationcomponenttextnote.py +++ b/apps/emr/migrations/0046_observationcomponenttextnote.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -16,9 +16,9 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('note', models.TextField()), ('datetime', models.DateTimeField(auto_now_add=True)), - ('author', models.ForeignKey(blank=True, to='emr.UserProfile', null=True)), + ('author', models.ForeignKey(blank=True, to='emr.UserProfile', null=True, on_delete=models.DO_NOTHING)), ('observation_component', - models.ForeignKey(related_name='observation_component_notes', to='emr.ObservationComponent')), + models.ForeignKey(related_name='observation_component_notes', to='emr.ObservationComponent', on_delete=models.DO_NOTHING)), ], ), ] diff --git a/apps/emr/migrations/0049_auto_20160428_2117.py b/apps/emr/migrations/0049_auto_20160428_2117.py index 7c085447..635293a0 100644 --- a/apps/emr/migrations/0049_auto_20160428_2117.py +++ b/apps/emr/migrations/0049_auto_20160428_2117.py @@ -1,10 +1,9 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.conf import settings -from django.db import models, migrations - import emr.models +from django.conf import settings +from django.db import migrations, models class Migration(migrations.Migration): @@ -21,9 +20,9 @@ class Migration(migrations.Migration): ('order', emr.models.ListField(null=True, blank=True)), ('patient', models.ForeignKey(related_name='patient_problem_order', blank=True, to=settings.AUTH_USER_MODEL, - null=True)), + null=True, on_delete=models.DO_NOTHING)), ('user', models.ForeignKey(related_name='user_problem_order', blank=True, to=settings.AUTH_USER_MODEL, - null=True)), + null=True, on_delete=models.DO_NOTHING)), ], ), migrations.AlterModelOptions( diff --git a/apps/emr/migrations/0050_observationcomponent_author.py b/apps/emr/migrations/0050_observationcomponent_author.py index cff40000..ad4612db 100644 --- a/apps/emr/migrations/0050_observationcomponent_author.py +++ b/apps/emr/migrations/0050_observationcomponent_author.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -14,6 +14,6 @@ class Migration(migrations.Migration): model_name='observationcomponent', name='author', field=models.ForeignKey(related_name='observation_component_authors', blank=True, to='emr.UserProfile', - null=True), + null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0051_auto_20160506_2007.py b/apps/emr/migrations/0051_auto_20160506_2007.py index 34f0f043..f20f8ad6 100644 --- a/apps/emr/migrations/0051_auto_20160506_2007.py +++ b/apps/emr/migrations/0051_auto_20160506_2007.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -20,7 +20,7 @@ class Migration(migrations.Migration): ('css_class', models.TextField(null=True, blank=True)), ('author', models.ForeignKey(related_name='problem_label_author', blank=True, to=settings.AUTH_USER_MODEL, - null=True)), + null=True, on_delete=models.DO_NOTHING)), ], ), migrations.AddField( diff --git a/apps/emr/migrations/0052_problemlabel_patient.py b/apps/emr/migrations/0052_problemlabel_patient.py index 19d69d7a..5c754b41 100644 --- a/apps/emr/migrations/0052_problemlabel_patient.py +++ b/apps/emr/migrations/0052_problemlabel_patient.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -16,6 +16,6 @@ class Migration(migrations.Migration): model_name='problemlabel', name='patient', field=models.ForeignKey(related_name='problem_label_patient', blank=True, to=settings.AUTH_USER_MODEL, - null=True), + null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0053_labeledproblemlist.py b/apps/emr/migrations/0053_labeledproblemlist.py index 4d5b9033..23551073 100644 --- a/apps/emr/migrations/0053_labeledproblemlist.py +++ b/apps/emr/migrations/0053_labeledproblemlist.py @@ -1,10 +1,9 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.conf import settings -from django.db import models, migrations - import emr.models +from django.conf import settings +from django.db import migrations, models class Migration(migrations.Migration): @@ -23,10 +22,10 @@ class Migration(migrations.Migration): ('labels', models.ManyToManyField(to='emr.ProblemLabel', blank=True)), ('patient', models.ForeignKey(related_name='label_problem_list_patient', blank=True, to=settings.AUTH_USER_MODEL, - null=True)), + null=True, on_delete=models.DO_NOTHING)), ('user', models.ForeignKey(related_name='label_problem_list_user', blank=True, to=settings.AUTH_USER_MODEL, - null=True)), + null=True, on_delete=models.DO_NOTHING)), ], ), ] diff --git a/apps/emr/migrations/0054_sharingpatient.py b/apps/emr/migrations/0054_sharingpatient.py index 7efd1633..c737f053 100644 --- a/apps/emr/migrations/0054_sharingpatient.py +++ b/apps/emr/migrations/0054_sharingpatient.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -16,8 +16,8 @@ class Migration(migrations.Migration): name='SharingPatient', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('shared', models.ForeignKey(related_name='patient_shared', to=settings.AUTH_USER_MODEL)), - ('sharing', models.ForeignKey(related_name='patient_sharing', to=settings.AUTH_USER_MODEL)), + ('shared', models.ForeignKey(related_name='patient_shared', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), + ('sharing', models.ForeignKey(related_name='patient_sharing', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), ], ), ] diff --git a/apps/emr/migrations/0065_commonproblem.py b/apps/emr/migrations/0065_commonproblem.py index f9b63ae7..5c9f9297 100644 --- a/apps/emr/migrations/0065_commonproblem.py +++ b/apps/emr/migrations/0065_commonproblem.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -22,8 +22,8 @@ class Migration(migrations.Migration): choices=[(b'acute', b'Acute'), (b'chronic', b'Chronic')])), ('author', models.ForeignKey(related_name='common_problem_author', blank=True, to=settings.AUTH_USER_MODEL, - null=True)), - ('patient', models.ForeignKey(related_name='common_problem_patient', to=settings.AUTH_USER_MODEL)), + null=True, on_delete=models.DO_NOTHING)), + ('patient', models.ForeignKey(related_name='common_problem_patient', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), ], ), ] diff --git a/apps/emr/migrations/0067_coloncancerscreening.py b/apps/emr/migrations/0067_coloncancerscreening.py index f2104a39..a251b6c6 100644 --- a/apps/emr/migrations/0067_coloncancerscreening.py +++ b/apps/emr/migrations/0067_coloncancerscreening.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -16,8 +16,8 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('created_on', models.DateTimeField(auto_now_add=True)), ('patient_refused', models.BooleanField(default=False)), - ('patient', models.ForeignKey(related_name='patient_colon_cancer', to='emr.UserProfile')), - ('problem', models.ForeignKey(related_name='problem_colon_cancer', to='emr.Problem')), + ('patient', models.ForeignKey(related_name='patient_colon_cancer', to='emr.UserProfile', on_delete=models.DO_NOTHING)), + ('problem', models.ForeignKey(related_name='problem_colon_cancer', to='emr.Problem', on_delete=models.DO_NOTHING)), ], options={ 'ordering': ['-created_on'], diff --git a/apps/emr/migrations/0068_auto_20160727_0144.py b/apps/emr/migrations/0068_auto_20160727_0144.py index c0d4433b..a56fe879 100644 --- a/apps/emr/migrations/0068_auto_20160727_0144.py +++ b/apps/emr/migrations/0068_auto_20160727_0144.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -24,10 +24,10 @@ class Migration(migrations.Migration): ('result', models.CharField(max_length=100, null=True, blank=True)), ('note', models.TextField(null=True, blank=True)), ('last_updated_date', models.DateField(auto_now=True)), - ('author', models.ForeignKey(related_name='author_studies', to='emr.UserProfile')), - ('colon', models.ForeignKey(related_name='colon_studies', to='emr.ColonCancerScreening')), + ('author', models.ForeignKey(related_name='author_studies', to='emr.UserProfile', on_delete=models.DO_NOTHING)), + ('colon', models.ForeignKey(related_name='colon_studies', to='emr.ColonCancerScreening', on_delete=models.DO_NOTHING)), ( - 'last_updated_user', models.ForeignKey(related_name='last_updated_user_studies', to='emr.UserProfile')), + 'last_updated_user', models.ForeignKey(related_name='last_updated_user_studies', to='emr.UserProfile', on_delete=models.DO_NOTHING)), ], options={ 'ordering': ['-created_on'], diff --git a/apps/emr/migrations/0069_auto_20160727_0351.py b/apps/emr/migrations/0069_auto_20160727_0351.py index f914de2a..6b696da1 100644 --- a/apps/emr/migrations/0069_auto_20160727_0351.py +++ b/apps/emr/migrations/0069_auto_20160727_0351.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -19,6 +19,6 @@ class Migration(migrations.Migration): model_name='coloncancerstudy', name='last_updated_user', field=models.ForeignKey(related_name='last_updated_user_studies', blank=True, to='emr.UserProfile', - null=True), + null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0070_auto_20160727_1134.py b/apps/emr/migrations/0070_auto_20160727_1134.py index a816cfaa..c6761c16 100644 --- a/apps/emr/migrations/0070_auto_20160727_1134.py +++ b/apps/emr/migrations/0070_auto_20160727_1134.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -23,12 +23,12 @@ class Migration(migrations.Migration): migrations.AddField( model_name='coloncancerstudyimage', name='author', - field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True), + field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='coloncancerstudyimage', name='colon', - field=models.ForeignKey(blank=True, to='emr.ColonCancerScreening', null=True), + field=models.ForeignKey(blank=True, to='emr.ColonCancerScreening', null=True, on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='coloncancerstudyimage', diff --git a/apps/emr/migrations/0071_auto_20160727_2038.py b/apps/emr/migrations/0071_auto_20160727_2038.py index eb68c50a..b9ffa83e 100644 --- a/apps/emr/migrations/0071_auto_20160727_2038.py +++ b/apps/emr/migrations/0071_auto_20160727_2038.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -17,11 +17,11 @@ class Migration(migrations.Migration): migrations.AddField( model_name='coloncancerstudyimage', name='study', - field=models.ForeignKey(blank=True, to='emr.ColonCancerStudy', null=True), + field=models.ForeignKey(blank=True, to='emr.ColonCancerStudy', null=True, on_delete=models.DO_NOTHING), ), migrations.AlterField( model_name='coloncancerstudyimage', name='author', - field=models.ForeignKey(blank=True, to='emr.UserProfile', null=True), + field=models.ForeignKey(blank=True, to='emr.UserProfile', null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0072_auto_20160728_0421.py b/apps/emr/migrations/0072_auto_20160728_0421.py index 1f83dbe9..e94f4aed 100644 --- a/apps/emr/migrations/0072_auto_20160728_0421.py +++ b/apps/emr/migrations/0072_auto_20160728_0421.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -16,7 +16,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('note', models.TextField()), ('datetime', models.DateTimeField(auto_now_add=True)), - ('author', models.ForeignKey(blank=True, to='emr.UserProfile', null=True)), + ('author', models.ForeignKey(blank=True, to='emr.UserProfile', null=True, on_delete=models.DO_NOTHING)), ], ), migrations.CreateModel( @@ -35,16 +35,16 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='coloncancerstudyimage', name='study', - field=models.ForeignKey(related_name='study_images', blank=True, to='emr.ColonCancerStudy', null=True), + field=models.ForeignKey(related_name='study_images', blank=True, to='emr.ColonCancerStudy', null=True, on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='riskfactor', name='colon', - field=models.ForeignKey(related_name='colon_risk_factors', to='emr.ColonCancerScreening'), + field=models.ForeignKey(related_name='colon_risk_factors', to='emr.ColonCancerScreening', on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='coloncancertextnote', name='colon', - field=models.ForeignKey(related_name='colon_notes', to='emr.ColonCancerScreening'), + field=models.ForeignKey(related_name='colon_notes', to='emr.ColonCancerScreening', on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0073_auto_20160728_0958.py b/apps/emr/migrations/0073_auto_20160728_0958.py index c60471be..16921809 100644 --- a/apps/emr/migrations/0073_auto_20160728_0958.py +++ b/apps/emr/migrations/0073_auto_20160728_0958.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -19,6 +19,6 @@ class Migration(migrations.Migration): model_name='coloncancerscreening', name='last_risk_updated_user', field=models.ForeignKey(related_name='last_risk_updated_user_colons', blank=True, to='emr.UserProfile', - null=True), + null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0075_auto_20160809_2040.py b/apps/emr/migrations/0075_auto_20160809_2040.py index 0ab705d0..3ccee131 100644 --- a/apps/emr/migrations/0075_auto_20160809_2040.py +++ b/apps/emr/migrations/0075_auto_20160809_2040.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -19,6 +19,6 @@ class Migration(migrations.Migration): model_name='todo', name='colon_cancer', field=models.ForeignKey(related_name='colon_cancer_todos', blank=True, to='emr.ColonCancerScreening', - null=True), + null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0077_mystorytab_mystorytextcomponent_mystorytextcomponententry.py b/apps/emr/migrations/0077_mystorytab_mystorytextcomponent_mystorytextcomponententry.py index 38070ec8..25acfb3f 100644 --- a/apps/emr/migrations/0077_mystorytab_mystorytextcomponent_mystorytextcomponententry.py +++ b/apps/emr/migrations/0077_mystorytab_mystorytextcomponent_mystorytextcomponententry.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -20,7 +20,7 @@ class Migration(migrations.Migration): ('datetime', models.DateTimeField(auto_now_add=True)), ('private', models.BooleanField(default=True)), ('shared', models.BooleanField(default=True)), - ('patient', models.ForeignKey(related_name='patient_story_tabs', to=settings.AUTH_USER_MODEL)), + ('patient', models.ForeignKey(related_name='patient_story_tabs', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), ], ), migrations.CreateModel( @@ -32,9 +32,9 @@ class Migration(migrations.Migration): ('datetime', models.DateTimeField(auto_now_add=True)), ('last_updated_date', models.DateField(auto_now=True)), ('concept_id', models.CharField(max_length=20, null=True, blank=True)), - ('last_updated_user', models.ForeignKey(blank=True, to='emr.UserProfile', null=True)), - ('patient', models.ForeignKey(related_name='patient_story_texts', to=settings.AUTH_USER_MODEL)), - ('tab', models.ForeignKey(blank=True, to='emr.MyStoryTab', null=True)), + ('last_updated_user', models.ForeignKey(blank=True, to='emr.UserProfile', null=True, on_delete=models.DO_NOTHING)), + ('patient', models.ForeignKey(related_name='patient_story_texts', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), + ('tab', models.ForeignKey(blank=True, to='emr.MyStoryTab', null=True, on_delete=models.DO_NOTHING)), ], ), migrations.CreateModel( @@ -43,8 +43,8 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('text', models.TextField(null=True, blank=True)), ('datetime', models.DateTimeField(null=True, blank=True)), - ('author', models.ForeignKey(related_name='author_story_text_entries', to=settings.AUTH_USER_MODEL)), - ('component', models.ForeignKey(blank=True, to='emr.MyStoryTextComponent', null=True)), + ('author', models.ForeignKey(related_name='author_story_text_entries', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), + ('component', models.ForeignKey(blank=True, to='emr.MyStoryTextComponent', null=True, on_delete=models.DO_NOTHING)), ], ), ] diff --git a/apps/emr/migrations/0078_auto_20160822_0343.py b/apps/emr/migrations/0078_auto_20160822_0343.py index 6ec5131d..d7d97180 100644 --- a/apps/emr/migrations/0078_auto_20160822_0343.py +++ b/apps/emr/migrations/0078_auto_20160822_0343.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -20,7 +20,7 @@ class Migration(migrations.Migration): model_name='mystorytab', name='author', field=models.ForeignKey(related_name='author_story_tabs', blank=True, to=settings.AUTH_USER_MODEL, - null=True), + null=True, on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='mystorytab', @@ -31,7 +31,7 @@ class Migration(migrations.Migration): model_name='mystorytextcomponent', name='author', field=models.ForeignKey(related_name='author_story_texts', blank=True, to=settings.AUTH_USER_MODEL, - null=True), + null=True, on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='mystorytextcomponent', @@ -46,17 +46,17 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='mystorytextcomponent', name='last_updated_user', - field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True), + field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.DO_NOTHING), ), migrations.AlterField( model_name='mystorytextcomponent', name='tab', - field=models.ForeignKey(related_name='my_story_tab_components', blank=True, to='emr.MyStoryTab', null=True), + field=models.ForeignKey(related_name='my_story_tab_components', blank=True, to='emr.MyStoryTab', null=True, on_delete=models.DO_NOTHING), ), migrations.AlterField( model_name='mystorytextcomponententry', name='component', field=models.ForeignKey(related_name='text_component_entries', blank=True, to='emr.MyStoryTextComponent', - null=True), + null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0080_auto_20160823_0244.py b/apps/emr/migrations/0080_auto_20160823_0244.py index 706d8e65..c795fd88 100644 --- a/apps/emr/migrations/0080_auto_20160823_0244.py +++ b/apps/emr/migrations/0080_auto_20160823_0244.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -24,8 +24,8 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('note', models.TextField()), ('datetime', models.DateTimeField(auto_now_add=True)), - ('a1c', models.ForeignKey(related_name='a1c_notes', to='emr.AOneC')), - ('author', models.ForeignKey(blank=True, to='emr.UserProfile', null=True)), + ('a1c', models.ForeignKey(related_name='a1c_notes', to='emr.AOneC', on_delete=models.DO_NOTHING)), + ('author', models.ForeignKey(blank=True, to='emr.UserProfile', null=True, on_delete=models.DO_NOTHING)), ], ), migrations.RemoveField( @@ -86,7 +86,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='observation', name='subject', - field=models.ForeignKey(related_name='observation_subjects', blank=True, to='emr.UserProfile', null=True), + field=models.ForeignKey(related_name='observation_subjects', blank=True, to='emr.UserProfile', null=True, on_delete=models.DO_NOTHING), ), migrations.AlterField( model_name='observationcomponent', @@ -104,16 +104,16 @@ class Migration(migrations.Migration): migrations.AddField( model_name='aonec', name='observation', - field=models.OneToOneField(related_name='observation_aonecs', to='emr.Observation'), + field=models.OneToOneField(related_name='observation_aonecs', to='emr.Observation', on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='aonec', name='problem', - field=models.OneToOneField(related_name='problem_aonecs', to='emr.Problem'), + field=models.OneToOneField(related_name='problem_aonecs', to='emr.Problem', on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='todo', name='a1c', - field=models.ForeignKey(related_name='a1c_todos', blank=True, to='emr.AOneC', null=True), + field=models.ForeignKey(related_name='a1c_todos', blank=True, to='emr.AOneC', null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0081_auto_20160824_2229.py b/apps/emr/migrations/0081_auto_20160824_2229.py index 57e476d9..7c7f5aa3 100644 --- a/apps/emr/migrations/0081_auto_20160824_2229.py +++ b/apps/emr/migrations/0081_auto_20160824_2229.py @@ -1,10 +1,9 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.conf import settings -from django.db import models, migrations - import emr.models +from django.conf import settings +from django.db import migrations, models class Migration(migrations.Migration): @@ -21,10 +20,10 @@ class Migration(migrations.Migration): ('order', emr.models.ListField(null=True, blank=True)), ('patient', models.ForeignKey(related_name='patient_observation_order', blank=True, to=settings.AUTH_USER_MODEL, - null=True)), + null=True, on_delete=models.DO_NOTHING)), ('user', models.ForeignKey(related_name='user_observation_order', blank=True, to=settings.AUTH_USER_MODEL, - null=True)), + null=True, on_delete=models.DO_NOTHING)), ], ), migrations.AddField( diff --git a/apps/emr/migrations/0082_observationpintoproblem.py b/apps/emr/migrations/0082_observationpintoproblem.py index f489d6f1..1ccca669 100644 --- a/apps/emr/migrations/0082_observationpintoproblem.py +++ b/apps/emr/migrations/0082_observationpintoproblem.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -14,10 +14,10 @@ class Migration(migrations.Migration): name='ObservationPinToProblem', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('author', models.ForeignKey(related_name='pin_authors', blank=True, to='emr.UserProfile', null=True)), + ('author', models.ForeignKey(related_name='pin_authors', blank=True, to='emr.UserProfile', null=True, on_delete=models.DO_NOTHING)), ('observation', - models.ForeignKey(related_name='pin_observations', blank=True, to='emr.Observation', null=True)), - ('problem', models.ForeignKey(related_name='pin_problems', blank=True, to='emr.Problem', null=True)), + models.ForeignKey(related_name='pin_observations', blank=True, to='emr.Observation', null=True, on_delete=models.DO_NOTHING)), + ('problem', models.ForeignKey(related_name='pin_problems', blank=True, to='emr.Problem', null=True, on_delete=models.DO_NOTHING)), ], ), ] diff --git a/apps/emr/migrations/0083_observationunit.py b/apps/emr/migrations/0083_observationunit.py index 5e077a4a..2e01318a 100644 --- a/apps/emr/migrations/0083_observationunit.py +++ b/apps/emr/migrations/0083_observationunit.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -16,7 +16,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('value_unit', models.CharField(max_length=45, null=True, blank=True)), ('is_used', models.BooleanField(default=False)), - ('observation', models.ForeignKey(related_name='observation_units', to='emr.Observation')), + ('observation', models.ForeignKey(related_name='observation_units', to='emr.Observation', on_delete=models.DO_NOTHING)), ], ), ] diff --git a/apps/emr/migrations/0084_auto_20160905_2151.py b/apps/emr/migrations/0084_auto_20160905_2151.py index 3003e585..93aeb0d8 100644 --- a/apps/emr/migrations/0084_auto_20160905_2151.py +++ b/apps/emr/migrations/0084_auto_20160905_2151.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -15,13 +15,13 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name', models.CharField(max_length=255, null=True, blank=True)), - ('observation', models.ForeignKey(related_name='observation_fields', to='emr.Observation')), + ('observation', models.ForeignKey(related_name='observation_fields', to='emr.Observation', on_delete=models.DO_NOTHING)), ], ), migrations.AddField( model_name='observationcomponent', name='field', field=models.ForeignKey(related_name='observation_component_fields', blank=True, to='emr.ObservationField', - null=True), + null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0086_auto_20160906_0142.py b/apps/emr/migrations/0086_auto_20160906_0142.py index ef236ed5..4bda152d 100644 --- a/apps/emr/migrations/0086_auto_20160906_0142.py +++ b/apps/emr/migrations/0086_auto_20160906_0142.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -22,7 +22,7 @@ class Migration(migrations.Migration): ('effective_datetime', models.DateTimeField(null=True, blank=True)), ('created_on', models.DateTimeField(auto_now_add=True, null=True)), ('author', models.ForeignKey(related_name='observation_value_authors', blank=True, to='emr.UserProfile', - null=True)), + null=True, on_delete=models.DO_NOTHING)), ], ), migrations.RemoveField( @@ -44,6 +44,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='observationvalue', name='component', - field=models.ForeignKey(related_name='observation_component_values', to='emr.ObservationComponent'), + field=models.ForeignKey(related_name='observation_component_values', to='emr.ObservationComponent', on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0087_auto_20160909_1150.py b/apps/emr/migrations/0087_auto_20160909_1150.py index 30732743..42457b5a 100644 --- a/apps/emr/migrations/0087_auto_20160909_1150.py +++ b/apps/emr/migrations/0087_auto_20160909_1150.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -24,6 +24,6 @@ class Migration(migrations.Migration): model_name='mystorytextcomponententry', name='author', field=models.ForeignKey(related_name='author_story_text_entries', blank=True, to=settings.AUTH_USER_MODEL, - null=True), + null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0088_auto_20160912_0220.py b/apps/emr/migrations/0088_auto_20160912_0220.py index 00bcef19..1da4f962 100644 --- a/apps/emr/migrations/0088_auto_20160912_0220.py +++ b/apps/emr/migrations/0088_auto_20160912_0220.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -16,9 +16,9 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('note', models.TextField()), ('datetime', models.DateTimeField(auto_now_add=True)), - ('author', models.ForeignKey(blank=True, to='emr.UserProfile', null=True)), + ('author', models.ForeignKey(blank=True, to='emr.UserProfile', null=True, on_delete=models.DO_NOTHING)), ('observation_value', - models.ForeignKey(related_name='observation_value_notes', to='emr.ObservationValue')), + models.ForeignKey(related_name='observation_value_notes', to='emr.ObservationValue', on_delete=models.DO_NOTHING)), ], ), migrations.RemoveField( diff --git a/apps/emr/migrations/0090_auto_20160919_2114.py b/apps/emr/migrations/0090_auto_20160919_2114.py index 1e9646ec..4a7688ba 100644 --- a/apps/emr/migrations/0090_auto_20160919_2114.py +++ b/apps/emr/migrations/0090_auto_20160919_2114.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -27,6 +27,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='todo', name='group_id', - field=models.ForeignKey(blank=True, to='emr.ToDoGroup', null=True), + field=models.ForeignKey(blank=True, to='emr.ToDoGroup', null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0092_auto_20160920_1115.py b/apps/emr/migrations/0092_auto_20160920_1115.py index 1ae2e565..1bcc81f5 100644 --- a/apps/emr/migrations/0092_auto_20160920_1115.py +++ b/apps/emr/migrations/0092_auto_20160920_1115.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -13,6 +13,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='todo', name='group', - field=models.ForeignKey(related_name='items', blank=True, to='emr.ToDoGroup', null=True), + field=models.ForeignKey(related_name='items', blank=True, to='emr.ToDoGroup', null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0094_todogroup_patient.py b/apps/emr/migrations/0094_todogroup_patient.py index 9e9cdd02..7d526ba4 100644 --- a/apps/emr/migrations/0094_todogroup_patient.py +++ b/apps/emr/migrations/0094_todogroup_patient.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -16,6 +16,6 @@ class Migration(migrations.Migration): model_name='todogroup', name='patient', field=models.ForeignKey(related_name='todo_group_patient', blank=True, to=settings.AUTH_USER_MODEL, - null=True), + null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0096_auto_20160929_2155.py b/apps/emr/migrations/0096_auto_20160929_2155.py index f97218ff..1dece117 100644 --- a/apps/emr/migrations/0096_auto_20160929_2155.py +++ b/apps/emr/migrations/0096_auto_20160929_2155.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -18,7 +18,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('note', models.TextField(null=True, blank=True)), ('created_on', models.DateTimeField(auto_now_add=True)), - ('patient', models.ForeignKey(related_name='patient_inr', to=settings.AUTH_USER_MODEL)), + ('patient', models.ForeignKey(related_name='patient_inr', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), ], options={ 'ordering': ['-created_on'], @@ -31,8 +31,8 @@ class Migration(migrations.Migration): ('value', models.DecimalField(null=True, max_digits=10, decimal_places=4, blank=True)), ('effective_datetime', models.DateTimeField(null=True, blank=True)), ('created_on', models.DateTimeField(auto_now_add=True)), - ('author', models.ForeignKey(related_name='author_inr_values', to='emr.UserProfile')), - ('inr', models.ForeignKey(related_name='inr_values', to='emr.Inr')), + ('author', models.ForeignKey(related_name='author_inr_values', to='emr.UserProfile', on_delete=models.DO_NOTHING)), + ('inr', models.ForeignKey(related_name='inr_values', to='emr.Inr', on_delete=models.DO_NOTHING)), ], options={ 'ordering': ['-effective_datetime', '-created_on'], @@ -46,8 +46,8 @@ class Migration(migrations.Migration): ('concept_id', models.CharField(max_length=20, null=True, blank=True)), ('current', models.BooleanField(default=True)), ('created_on', models.DateTimeField(auto_now_add=True)), - ('author', models.ForeignKey(related_name='author_medications', to='emr.UserProfile')), - ('inr', models.ForeignKey(related_name='inr_medications', to='emr.Inr')), + ('author', models.ForeignKey(related_name='author_medications', to='emr.UserProfile', on_delete=models.DO_NOTHING)), + ('inr', models.ForeignKey(related_name='inr_medications', to='emr.Inr', on_delete=models.DO_NOTHING)), ], options={ 'ordering': ['-created_on'], @@ -58,9 +58,9 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('author', - models.ForeignKey(related_name='author_pin_medications', blank=True, to='emr.UserProfile', null=True)), - ('medication', models.ForeignKey(related_name='medication_pin_medications', to='emr.Medication')), - ('problem', models.ForeignKey(related_name='problem_pin_medications', to='emr.Problem')), + models.ForeignKey(related_name='author_pin_medications', blank=True, to='emr.UserProfile', null=True, on_delete=models.DO_NOTHING)), + ('medication', models.ForeignKey(related_name='medication_pin_medications', to='emr.Medication', on_delete=models.DO_NOTHING)), + ('problem', models.ForeignKey(related_name='problem_pin_medications', to='emr.Problem', on_delete=models.DO_NOTHING)), ], ), migrations.CreateModel( @@ -69,8 +69,8 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('note', models.TextField()), ('datetime', models.DateTimeField(auto_now_add=True)), - ('author', models.ForeignKey(to='emr.UserProfile')), - ('medication', models.ForeignKey(related_name='medication_notes', to='emr.Medication')), + ('author', models.ForeignKey(to='emr.UserProfile', on_delete=models.DO_NOTHING)), + ('medication', models.ForeignKey(related_name='medication_notes', to='emr.Medication', on_delete=models.DO_NOTHING)), ], ), migrations.AlterModelOptions( @@ -80,6 +80,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='todo', name='inr', - field=models.ForeignKey(related_name='inr_todos', blank=True, to='emr.Inr', null=True), + field=models.ForeignKey(related_name='inr_todos', blank=True, to='emr.Inr', null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0097_auto_20160930_0441.py b/apps/emr/migrations/0097_auto_20160930_0441.py index b3472256..1ea0f03c 100644 --- a/apps/emr/migrations/0097_auto_20160930_0441.py +++ b/apps/emr/migrations/0097_auto_20160930_0441.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -14,6 +14,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='inr', name='patient', - field=models.OneToOneField(related_name='patient_inr', to=settings.AUTH_USER_MODEL), + field=models.OneToOneField(related_name='patient_inr', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0099_auto_20161014_0321.py b/apps/emr/migrations/0099_auto_20161014_0321.py index d4c1faa1..56bdec69 100644 --- a/apps/emr/migrations/0099_auto_20161014_0321.py +++ b/apps/emr/migrations/0099_auto_20161014_0321.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -28,7 +28,7 @@ class Migration(migrations.Migration): model_name='mystorytextcomponententry', name='patient', field=models.ForeignKey(related_name='patient_story_text_entries', blank=True, to=settings.AUTH_USER_MODEL, - null=True), + null=True, on_delete=models.DO_NOTHING), ), migrations.AlterField( model_name='mystorytextcomponententry', diff --git a/apps/emr/migrations/0101_auto_20161024_2210.py b/apps/emr/migrations/0101_auto_20161024_2210.py index 3e55e43b..fabf1059 100644 --- a/apps/emr/migrations/0101_auto_20161024_2210.py +++ b/apps/emr/migrations/0101_auto_20161024_2210.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -16,7 +16,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('note', models.TextField()), ('datetime', models.DateTimeField(auto_now_add=True)), - ('author', models.ForeignKey(to='emr.UserProfile')), + ('author', models.ForeignKey(to='emr.UserProfile', on_delete=models.DO_NOTHING)), ], ), migrations.RemoveField( @@ -26,13 +26,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='inr', name='author', - field=models.ForeignKey(related_name='author_inrs', blank=True, to='emr.UserProfile', null=True), + field=models.ForeignKey(related_name='author_inrs', blank=True, to='emr.UserProfile', null=True, on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='inr', name='pin', field=models.ForeignKey(related_name='observation_inrs', blank=True, to='emr.ObservationPinToProblem', - null=True), + null=True, on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='inrvalue', @@ -52,16 +52,16 @@ class Migration(migrations.Migration): migrations.AddField( model_name='medication', name='patient', - field=models.ForeignKey(related_name='patient_medications', blank=True, to='emr.UserProfile', null=True), + field=models.ForeignKey(related_name='patient_medications', blank=True, to='emr.UserProfile', null=True, on_delete=models.DO_NOTHING), ), migrations.AlterField( model_name='inr', name='patient', - field=models.ForeignKey(related_name='patient_inrs', to='emr.UserProfile'), + field=models.ForeignKey(related_name='patient_inrs', to='emr.UserProfile', on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='inrtextnote', name='inr', - field=models.ForeignKey(related_name='inr_notes', to='emr.Inr'), + field=models.ForeignKey(related_name='inr_notes', to='emr.Inr', on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0102_auto_20161025_0156.py b/apps/emr/migrations/0102_auto_20161025_0156.py index 779feb3f..177139e5 100644 --- a/apps/emr/migrations/0102_auto_20161025_0156.py +++ b/apps/emr/migrations/0102_auto_20161025_0156.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -21,11 +21,11 @@ class Migration(migrations.Migration): migrations.AddField( model_name='inr', name='observation', - field=models.ForeignKey(related_name='observation_pin_inrs', blank=True, to='emr.Observation', null=True), + field=models.ForeignKey(related_name='observation_pin_inrs', blank=True, to='emr.Observation', null=True, on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='inr', name='problem', - field=models.ForeignKey(related_name='problem_pin_inrs', blank=True, to='emr.Problem', null=True), + field=models.ForeignKey(related_name='problem_pin_inrs', blank=True, to='emr.Problem', null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0105_auto_20161107_0102.py b/apps/emr/migrations/0105_auto_20161107_0102.py index 7acdeb2d..6d7c0882 100644 --- a/apps/emr/migrations/0105_auto_20161107_0102.py +++ b/apps/emr/migrations/0105_auto_20161107_0102.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -17,7 +17,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='problem', name='inr', - field=models.ForeignKey(related_name='inr_problem', blank=True, to='emr.Inr', null=True), + field=models.ForeignKey(related_name='inr_problem', blank=True, to='emr.Inr', null=True, on_delete=models.DO_NOTHING), ), migrations.AlterField( model_name='inr', diff --git a/apps/emr/migrations/0107_auto_20161118_1709.py b/apps/emr/migrations/0107_auto_20161118_1709.py index 549b9193..8e2620a3 100644 --- a/apps/emr/migrations/0107_auto_20161118_1709.py +++ b/apps/emr/migrations/0107_auto_20161118_1709.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -17,7 +17,7 @@ class Migration(migrations.Migration): migrations.AddField( model_name='inr', name='problem', - field=models.ForeignKey(related_name='problem_pin_inrs', blank=True, to='emr.Problem', null=True), + field=models.ForeignKey(related_name='problem_pin_inrs', blank=True, to='emr.Problem', null=True, on_delete=models.DO_NOTHING), ), migrations.AlterField( model_name='inrvalue', diff --git a/apps/emr/migrations/0108_document.py b/apps/emr/migrations/0108_document.py index dcdeaa86..f90b0223 100644 --- a/apps/emr/migrations/0108_document.py +++ b/apps/emr/migrations/0108_document.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -17,9 +17,9 @@ class Migration(migrations.Migration): ('name', models.TextField()), ('path', models.TextField()), ('created_on', models.DateTimeField(auto_now_add=True)), - ('author', models.ForeignKey(related_name='author_document', to='emr.UserProfile')), + ('author', models.ForeignKey(related_name='author_document', to='emr.UserProfile', on_delete=models.DO_NOTHING)), ('patient', - models.ForeignKey(related_name='patient_pinned', blank=True, to='emr.UserProfile', null=True)), + models.ForeignKey(related_name='patient_pinned', blank=True, to='emr.UserProfile', null=True, on_delete=models.DO_NOTHING)), ], options={ 'ordering': ['-created_on'], diff --git a/apps/emr/migrations/0110_auto_20161127_1518.py b/apps/emr/migrations/0110_auto_20161127_1518.py index 3bcf0e1b..1b56f4ca 100644 --- a/apps/emr/migrations/0110_auto_20161127_1518.py +++ b/apps/emr/migrations/0110_auto_20161127_1518.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -32,21 +32,21 @@ class Migration(migrations.Migration): migrations.AddField( model_name='documenttodo', name='document', - field=models.ForeignKey(to='emr.Document'), + field=models.ForeignKey(to='emr.Document', on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='documenttodo', name='todo', - field=models.ForeignKey(to='emr.ToDo'), + field=models.ForeignKey(to='emr.ToDo', on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='documentproblem', name='document', - field=models.ForeignKey(to='emr.Document'), + field=models.ForeignKey(to='emr.Document', on_delete=models.DO_NOTHING), ), migrations.AddField( model_name='documentproblem', name='problem', - field=models.ForeignKey(to='emr.Problem'), + field=models.ForeignKey(to='emr.Problem', on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0112_auto_20161206_1027.py b/apps/emr/migrations/0112_auto_20161206_1027.py index d12a2620..a87461cb 100644 --- a/apps/emr/migrations/0112_auto_20161206_1027.py +++ b/apps/emr/migrations/0112_auto_20161206_1027.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -23,13 +23,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='documentproblem', name='author', - field=models.ForeignKey(default=None, to='emr.UserProfile'), + field=models.ForeignKey(default=None, to='emr.UserProfile', on_delete=models.DO_NOTHING), preserve_default=False, ), migrations.AddField( model_name='documenttodo', name='author', - field=models.ForeignKey(default=None, to='emr.UserProfile'), + field=models.ForeignKey(default=None, to='emr.UserProfile', on_delete=models.DO_NOTHING), preserve_default=False, ), migrations.AlterField( diff --git a/apps/emr/migrations/0114_auto_20161213_0932.py b/apps/emr/migrations/0114_auto_20161213_0932.py index 0dde3c9d..55a6d5a7 100644 --- a/apps/emr/migrations/0114_auto_20161213_0932.py +++ b/apps/emr/migrations/0114_auto_20161213_0932.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -17,11 +17,11 @@ class Migration(migrations.Migration): migrations.AddField( model_name='inrtextnote', name='patient', - field=models.ForeignKey(related_name='patient_note', to='emr.UserProfile'), + field=models.ForeignKey(related_name='patient_note', to='emr.UserProfile', on_delete=models.DO_NOTHING), ), migrations.AlterField( model_name='inrtextnote', name='author', - field=models.ForeignKey(related_name='author_note', to='emr.UserProfile'), + field=models.ForeignKey(related_name='author_note', to='emr.UserProfile', on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0116_auto_20161214_1140.py b/apps/emr/migrations/0116_auto_20161214_1140.py index d4ba8cf7..e4aa349a 100644 --- a/apps/emr/migrations/0116_auto_20161214_1140.py +++ b/apps/emr/migrations/0116_auto_20161214_1140.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -48,12 +48,12 @@ class Migration(migrations.Migration): migrations.AddField( model_name='inr', name='observation_value', - field=models.OneToOneField(null=True, to='emr.ObservationValue'), + field=models.OneToOneField(null=True, to='emr.ObservationValue', on_delete=models.DO_NOTHING), ), migrations.AlterField( model_name='inr', name='author', - field=models.ForeignKey(related_name='author_inr', blank=True, to='emr.UserProfile', null=True), + field=models.ForeignKey(related_name='author_inr', blank=True, to='emr.UserProfile', null=True, on_delete=models.DO_NOTHING), ), migrations.DeleteModel( name='InrValue', diff --git a/apps/emr/migrations/0117_inr_patient.py b/apps/emr/migrations/0117_inr_patient.py index 6a126e5d..39c3c459 100644 --- a/apps/emr/migrations/0117_inr_patient.py +++ b/apps/emr/migrations/0117_inr_patient.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -13,6 +13,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='inr', name='patient', - field=models.ForeignKey(related_name='patient_inr', to='emr.UserProfile', null=True), + field=models.ForeignKey(related_name='patient_inr', to='emr.UserProfile', null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0118_auto_20170103_1104.py b/apps/emr/migrations/0118_auto_20170103_1104.py index 63dfe94d..0288f861 100644 --- a/apps/emr/migrations/0118_auto_20170103_1104.py +++ b/apps/emr/migrations/0118_auto_20170103_1104.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -18,6 +18,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='inr', name='observation_value', - field=models.OneToOneField(related_name='inr', null=True, to='emr.ObservationValue'), + field=models.OneToOneField(related_name='inr', null=True, to='emr.ObservationValue', on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0122_todo_medication.py b/apps/emr/migrations/0122_todo_medication.py index e71493dd..39267c64 100644 --- a/apps/emr/migrations/0122_todo_medication.py +++ b/apps/emr/migrations/0122_todo_medication.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -13,6 +13,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='todo', name='medication', - field=models.ForeignKey(to='emr.Medication', null=True), + field=models.ForeignKey(to='emr.Medication', null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0128_auto_20170203_1508.py b/apps/emr/migrations/0128_auto_20170203_1508.py index 19669225..30c4fd18 100644 --- a/apps/emr/migrations/0128_auto_20170203_1508.py +++ b/apps/emr/migrations/0128_auto_20170203_1508.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -15,8 +15,8 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('created_on', models.DateTimeField(auto_now_add=True)), - ('encounter', models.ForeignKey(to='emr.Encounter')), - ('observation_value', models.ForeignKey(to='emr.ObservationValue')), + ('encounter', models.ForeignKey(to='emr.Encounter', on_delete=models.DO_NOTHING)), + ('observation_value', models.ForeignKey(to='emr.ObservationValue', on_delete=models.DO_NOTHING)), ], ), migrations.AddField( diff --git a/apps/emr/migrations/0137_auto_20171113_0917.py b/apps/emr/migrations/0137_auto_20171113_0917.py index 0e4f6c1e..72bf0d57 100644 --- a/apps/emr/migrations/0137_auto_20171113_0917.py +++ b/apps/emr/migrations/0137_auto_20171113_0917.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -14,6 +14,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='textnote', name='author', - field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True), + field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0138_auto_20171113_0942.py b/apps/emr/migrations/0138_auto_20171113_0942.py index c027a3e0..b171c3cf 100644 --- a/apps/emr/migrations/0138_auto_20171113_0942.py +++ b/apps/emr/migrations/0138_auto_20171113_0942.py @@ -2,8 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations - +from django.db import migrations, models from emr.models import ProblemActivity, UserProfile @@ -24,7 +23,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='problemactivity', name='author', - field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True), + field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.DO_NOTHING), ), migrations.RunPython(changer_user_profile_id_to_user_id) ] diff --git a/apps/emr/migrations/0139_auto_20171113_1045.py b/apps/emr/migrations/0139_auto_20171113_1045.py index f86577fa..c50159e4 100644 --- a/apps/emr/migrations/0139_auto_20171113_1045.py +++ b/apps/emr/migrations/0139_auto_20171113_1045.py @@ -2,8 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations - +from django.db import migrations, models from emr.models import ProblemNote, UserProfile @@ -24,7 +23,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='problemnote', name='author', - field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True), + field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.DO_NOTHING), ), migrations.RunPython(changer_user_profile_id_to_user_id) ] diff --git a/apps/emr/migrations/0140_auto_20171113_1132.py b/apps/emr/migrations/0140_auto_20171113_1132.py index e9c966e2..aff27a05 100644 --- a/apps/emr/migrations/0140_auto_20171113_1132.py +++ b/apps/emr/migrations/0140_auto_20171113_1132.py @@ -2,8 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations - +from django.db import migrations, models from emr.models import TodoActivity, UserProfile @@ -24,7 +23,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='todoactivity', name='author', - field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True), + field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.DO_NOTHING), ), migrations.RunPython(changer_user_profile_id_to_user_id) ] diff --git a/apps/emr/migrations/0141_auto_20171114_1542.py b/apps/emr/migrations/0141_auto_20171114_1542.py index fa55293a..a9d62816 100644 --- a/apps/emr/migrations/0141_auto_20171114_1542.py +++ b/apps/emr/migrations/0141_auto_20171114_1542.py @@ -2,8 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations - +from django.db import migrations, models from emr.models import Observation, UserProfile @@ -31,25 +30,25 @@ class Migration(migrations.Migration): model_name='observation', name='author', field=models.ForeignKey(related_name='observation_authors', blank=True, to=settings.AUTH_USER_MODEL, - null=True), + null=True, on_delete=models.DO_NOTHING), ), migrations.AlterField( model_name='observation', name='encounter', field=models.ForeignKey(related_name='observation_encounters', blank=True, to=settings.AUTH_USER_MODEL, - null=True), + null=True, on_delete=models.DO_NOTHING), ), migrations.AlterField( model_name='observation', name='performer', field=models.ForeignKey(related_name='observation_performers', blank=True, to=settings.AUTH_USER_MODEL, - null=True), + null=True, on_delete=models.DO_NOTHING), ), migrations.AlterField( model_name='observation', name='subject', field=models.ForeignKey(related_name='observation_subjects', blank=True, to=settings.AUTH_USER_MODEL, - null=True), + null=True, on_delete=models.DO_NOTHING), ), migrations.RunPython(changer_user_profile_id_to_user_id) ] diff --git a/apps/emr/migrations/0142_auto_20171114_1802.py b/apps/emr/migrations/0142_auto_20171114_1802.py index ae938a81..3d400063 100644 --- a/apps/emr/migrations/0142_auto_20171114_1802.py +++ b/apps/emr/migrations/0142_auto_20171114_1802.py @@ -2,8 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations - +from django.db import migrations, models from emr.models import ObservationComponent, UserProfile @@ -25,7 +24,7 @@ class Migration(migrations.Migration): model_name='observationcomponent', name='author', field=models.ForeignKey(related_name='observation_component_authors', blank=True, - to=settings.AUTH_USER_MODEL, null=True), + to=settings.AUTH_USER_MODEL, null=True, on_delete=models.DO_NOTHING), ), migrations.RunPython(changer_user_profile_id_to_user_id) ] diff --git a/apps/emr/migrations/0143_auto_20171116_0131.py b/apps/emr/migrations/0143_auto_20171116_0131.py index ac6e4755..90c73fd8 100644 --- a/apps/emr/migrations/0143_auto_20171116_0131.py +++ b/apps/emr/migrations/0143_auto_20171116_0131.py @@ -2,8 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations - +from django.db import migrations, models from emr.models import ObservationValue, UserProfile @@ -25,7 +24,7 @@ class Migration(migrations.Migration): model_name='observationvalue', name='author', field=models.ForeignKey(related_name='observation_value_authors', blank=True, to=settings.AUTH_USER_MODEL, - null=True), + null=True, on_delete=models.DO_NOTHING), ), migrations.RunPython(changer_user_profile_id_to_user_id) ] diff --git a/apps/emr/migrations/0144_auto_20171116_0153.py b/apps/emr/migrations/0144_auto_20171116_0153.py index 52b7b371..d16c85ef 100644 --- a/apps/emr/migrations/0144_auto_20171116_0153.py +++ b/apps/emr/migrations/0144_auto_20171116_0153.py @@ -2,8 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations - +from django.db import migrations, models from emr.models import ObservationPinToProblem, UserProfile @@ -24,7 +23,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='observationpintoproblem', name='author', - field=models.ForeignKey(related_name='pin_authors', blank=True, to=settings.AUTH_USER_MODEL, null=True), + field=models.ForeignKey(related_name='pin_authors', blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.DO_NOTHING), ), migrations.RunPython(changer_user_profile_id_to_user_id) ] diff --git a/apps/emr/migrations/0145_auto_20171116_0217.py b/apps/emr/migrations/0145_auto_20171116_0217.py index cbca5bce..885d12f5 100644 --- a/apps/emr/migrations/0145_auto_20171116_0217.py +++ b/apps/emr/migrations/0145_auto_20171116_0217.py @@ -2,8 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations - +from django.db import migrations, models from emr.models import AOneCTextNote, UserProfile @@ -24,7 +23,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='aonectextnote', name='author', - field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True), + field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.DO_NOTHING), ), migrations.RunPython(changer_user_profile_id_to_user_id) ] diff --git a/apps/emr/migrations/0146_auto_20171116_0223.py b/apps/emr/migrations/0146_auto_20171116_0223.py index 09d4231d..9e7d52fe 100644 --- a/apps/emr/migrations/0146_auto_20171116_0223.py +++ b/apps/emr/migrations/0146_auto_20171116_0223.py @@ -2,8 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations - +from django.db import migrations, models from emr.models import ObservationValueTextNote, UserProfile @@ -24,7 +23,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='observationvaluetextnote', name='author', - field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True), + field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.DO_NOTHING), ), migrations.RunPython(changer_user_profile_id_to_user_id) ] diff --git a/apps/emr/migrations/0147_auto_20171116_0232.py b/apps/emr/migrations/0147_auto_20171116_0232.py index 3e502875..e9e59bba 100644 --- a/apps/emr/migrations/0147_auto_20171116_0232.py +++ b/apps/emr/migrations/0147_auto_20171116_0232.py @@ -2,8 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations - +from django.db import migrations, models from emr.models import ColonCancerScreening, UserProfile @@ -28,12 +27,12 @@ class Migration(migrations.Migration): model_name='coloncancerscreening', name='last_risk_updated_user', field=models.ForeignKey(related_name='last_risk_updated_user_colons', blank=True, - to=settings.AUTH_USER_MODEL, null=True), + to=settings.AUTH_USER_MODEL, null=True, on_delete=models.DO_NOTHING), ), migrations.AlterField( model_name='coloncancerscreening', name='patient', - field=models.ForeignKey(related_name='patient_colon_cancer', to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(related_name='patient_colon_cancer', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING), ), migrations.RunPython(changer_user_profile_id_to_user_id) ] diff --git a/apps/emr/migrations/0148_auto_20171116_1414.py b/apps/emr/migrations/0148_auto_20171116_1414.py index 1044a43c..857f121d 100644 --- a/apps/emr/migrations/0148_auto_20171116_1414.py +++ b/apps/emr/migrations/0148_auto_20171116_1414.py @@ -2,8 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations - +from django.db import migrations, models from emr.models import ColonCancerStudy, UserProfile @@ -27,13 +26,13 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='coloncancerstudy', name='author', - field=models.ForeignKey(related_name='author_studies', to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(related_name='author_studies', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING), ), migrations.AlterField( model_name='coloncancerstudy', name='last_updated_user', field=models.ForeignKey(related_name='last_updated_user_studies', blank=True, to=settings.AUTH_USER_MODEL, - null=True), + null=True, on_delete=models.DO_NOTHING), ), migrations.RunPython(changer_user_profile_id_to_user_id) ] diff --git a/apps/emr/migrations/0149_auto_20171116_1429.py b/apps/emr/migrations/0149_auto_20171116_1429.py index ec2c6275..cb928de1 100644 --- a/apps/emr/migrations/0149_auto_20171116_1429.py +++ b/apps/emr/migrations/0149_auto_20171116_1429.py @@ -2,8 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations - +from django.db import migrations, models from emr.models import ColonCancerStudyImage, UserProfile @@ -24,7 +23,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='coloncancerstudyimage', name='author', - field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True), + field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.DO_NOTHING), ), migrations.RunPython(changer_user_profile_id_to_user_id) ] diff --git a/apps/emr/migrations/0150_auto_20171116_1439.py b/apps/emr/migrations/0150_auto_20171116_1439.py index 1b1d542e..f2466796 100644 --- a/apps/emr/migrations/0150_auto_20171116_1439.py +++ b/apps/emr/migrations/0150_auto_20171116_1439.py @@ -2,8 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations - +from django.db import migrations, models from emr.models import ColonCancerTextNote, UserProfile @@ -24,7 +23,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='coloncancertextnote', name='author', - field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True), + field=models.ForeignKey(blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.DO_NOTHING), ), migrations.RunPython(changer_user_profile_id_to_user_id) ] diff --git a/apps/emr/migrations/0151_auto_20171116_1455.py b/apps/emr/migrations/0151_auto_20171116_1455.py index b39ce59c..4f3159f8 100644 --- a/apps/emr/migrations/0151_auto_20171116_1455.py +++ b/apps/emr/migrations/0151_auto_20171116_1455.py @@ -2,8 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations - +from django.db import migrations, models from emr.models import Inr, UserProfile @@ -26,12 +25,12 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='inr', name='author', - field=models.ForeignKey(related_name='author_inr', blank=True, to=settings.AUTH_USER_MODEL, null=True), + field=models.ForeignKey(related_name='author_inr', blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.DO_NOTHING), ), migrations.AlterField( model_name='inr', name='patient', - field=models.ForeignKey(related_name='patient_inr', to=settings.AUTH_USER_MODEL, null=True), + field=models.ForeignKey(related_name='patient_inr', to=settings.AUTH_USER_MODEL, null=True, on_delete=models.DO_NOTHING), ), migrations.RunPython(changer_user_profile_id_to_user_id) ] diff --git a/apps/emr/migrations/0152_auto_20171116_1517.py b/apps/emr/migrations/0152_auto_20171116_1517.py index 1b228a1d..370e7a7c 100644 --- a/apps/emr/migrations/0152_auto_20171116_1517.py +++ b/apps/emr/migrations/0152_auto_20171116_1517.py @@ -2,8 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations - +from django.db import migrations, models from emr.models import InrTextNote, UserProfile @@ -30,11 +29,11 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='inrtextnote', name='author', - field=models.ForeignKey(related_name='author_note', to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(related_name='author_note', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING), ), migrations.AlterField( model_name='inrtextnote', name='patient', - field=models.ForeignKey(related_name='patient_note', to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(related_name='patient_note', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/migrations/0153_auto_20171118_2249.py b/apps/emr/migrations/0153_auto_20171118_2249.py index 1f95760d..ce8fab44 100644 --- a/apps/emr/migrations/0153_auto_20171118_2249.py +++ b/apps/emr/migrations/0153_auto_20171118_2249.py @@ -2,8 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations - +from django.db import migrations, models from emr.models import Medication, UserProfile @@ -26,13 +25,13 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='medication', name='author', - field=models.ForeignKey(related_name='author_medications', to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(related_name='author_medications', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING), ), migrations.AlterField( model_name='medication', name='patient', field=models.ForeignKey(related_name='patient_medications', blank=True, to=settings.AUTH_USER_MODEL, - null=True), + null=True, on_delete=models.DO_NOTHING), ), migrations.RunPython(changer_user_profile_id_to_user_id) ] diff --git a/apps/emr/migrations/0154_auto_20171118_2305.py b/apps/emr/migrations/0154_auto_20171118_2305.py index 2a7c11d8..a0b3e0b3 100644 --- a/apps/emr/migrations/0154_auto_20171118_2305.py +++ b/apps/emr/migrations/0154_auto_20171118_2305.py @@ -2,8 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations - +from django.db import migrations, models from emr.models import MedicationPinToProblem, UserProfile @@ -25,7 +24,7 @@ class Migration(migrations.Migration): model_name='medicationpintoproblem', name='author', field=models.ForeignKey(related_name='author_pin_medications', blank=True, to=settings.AUTH_USER_MODEL, - null=True), + null=True, on_delete=models.DO_NOTHING), ), migrations.RunPython(changer_user_profile_id_to_user_id) ] diff --git a/apps/emr/migrations/0155_auto_20171118_2313.py b/apps/emr/migrations/0155_auto_20171118_2313.py index 72df327c..0dd44319 100644 --- a/apps/emr/migrations/0155_auto_20171118_2313.py +++ b/apps/emr/migrations/0155_auto_20171118_2313.py @@ -2,8 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations - +from django.db import migrations, models from emr.models import MedicationTextNote, UserProfile @@ -24,7 +23,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='medicationtextnote', name='author', - field=models.ForeignKey(to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING), ), migrations.RunPython(changer_user_profile_id_to_user_id) ] diff --git a/apps/emr/migrations/0156_auto_20171118_2319.py b/apps/emr/migrations/0156_auto_20171118_2319.py index 2ac0195e..946283e0 100644 --- a/apps/emr/migrations/0156_auto_20171118_2319.py +++ b/apps/emr/migrations/0156_auto_20171118_2319.py @@ -2,8 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations - +from django.db import migrations, models from emr.models import Document, UserProfile @@ -26,12 +25,12 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='document', name='author', - field=models.ForeignKey(related_name='author_document', to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(related_name='author_document', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING), ), migrations.AlterField( model_name='document', name='patient', - field=models.ForeignKey(related_name='patient_pinned', blank=True, to=settings.AUTH_USER_MODEL, null=True), + field=models.ForeignKey(related_name='patient_pinned', blank=True, to=settings.AUTH_USER_MODEL, null=True, on_delete=models.DO_NOTHING), ), migrations.RunPython(changer_user_profile_id_to_user_id) ] diff --git a/apps/emr/migrations/0157_auto_20171118_2339.py b/apps/emr/migrations/0157_auto_20171118_2339.py index a81c6587..ed72f61d 100644 --- a/apps/emr/migrations/0157_auto_20171118_2339.py +++ b/apps/emr/migrations/0157_auto_20171118_2339.py @@ -2,8 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations - +from django.db import migrations, models from emr.models import DocumentTodo, UserProfile @@ -24,7 +23,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='documenttodo', name='author', - field=models.ForeignKey(to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING), ), migrations.RunPython(changer_user_profile_id_to_user_id) ] diff --git a/apps/emr/migrations/0158_auto_20171118_2343.py b/apps/emr/migrations/0158_auto_20171118_2343.py index 08bec326..f9bfa1ac 100644 --- a/apps/emr/migrations/0158_auto_20171118_2343.py +++ b/apps/emr/migrations/0158_auto_20171118_2343.py @@ -2,8 +2,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations - +from django.db import migrations, models from emr.models import DocumentProblem, UserProfile @@ -24,7 +23,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='documentproblem', name='author', - field=models.ForeignKey(to=settings.AUTH_USER_MODEL), + field=models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING), ), migrations.RunPython(changer_user_profile_id_to_user_id) ] diff --git a/apps/emr/migrations/0161_narrative.py b/apps/emr/migrations/0161_narrative.py index 0a17578a..df86ded7 100644 --- a/apps/emr/migrations/0161_narrative.py +++ b/apps/emr/migrations/0161_narrative.py @@ -18,9 +18,9 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('description', models.TextField()), ('created_at', models.DateTimeField(auto_now_add=True)), - ('author', models.ForeignKey(related_name='owned_narratives', to=settings.AUTH_USER_MODEL)), - ('parent', models.ForeignKey(related_name='child', to='emr.Narrative')), - ('patient', models.ForeignKey(related_name='patient_narratives', to=settings.AUTH_USER_MODEL)), + ('author', models.ForeignKey(related_name='owned_narratives', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), + ('parent', models.ForeignKey(related_name='child', to='emr.Narrative', on_delete=models.DO_NOTHING)), + ('patient', models.ForeignKey(related_name='patient_narratives', to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), ], ), ] diff --git a/apps/emr/migrations/0162_auto_20180624_1203.py b/apps/emr/migrations/0162_auto_20180624_1203.py index 97443118..38c0e645 100644 --- a/apps/emr/migrations/0162_auto_20180624_1203.py +++ b/apps/emr/migrations/0162_auto_20180624_1203.py @@ -13,6 +13,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='narrative', name='parent', - field=models.ForeignKey(related_name='child', to='emr.Narrative', null=True), + field=models.ForeignKey(related_name='child', to='emr.Narrative', null=True, on_delete=models.DO_NOTHING), ), ] diff --git a/apps/emr/models.py b/apps/emr/models.py index 6ff9e863..3dc4b61c 100644 --- a/apps/emr/models.py +++ b/apps/emr/models.py @@ -21,11 +21,17 @@ import reversion from django.contrib.auth.models import User from django.db import models +from emr.managers import ( + AOneCManager, + ColonCancerScreeningManager, + ColonCancerStudyManager, + EncounterManager, + ProblemManager, + ProblemNoteManager, + TodoManager, +) from mptt.models import MPTTModel, TreeForeignKey -from emr.managers import AOneCManager, ProblemManager, ProblemNoteManager, EncounterManager, \ - TodoManager, ColonCancerScreeningManager, ColonCancerStudyManager - # DATA ROLE_CHOICES = ( ('patient', 'Patient'), @@ -189,7 +195,7 @@ class ListField(models.TextField): def __init__(self, *args, **kwargs): super(ListField, self).__init__(*args, **kwargs) - def from_db_value(self, value, expression, connection, context): + def from_db_value(self, value, expression, connection, context = None): if not value: value = [] @@ -211,7 +217,7 @@ def get_prep_value(self, value): if value is None: return value - return unicode(value) + return value def value_to_string(self, obj): value = self._get_val_from_obj(obj) @@ -227,7 +233,7 @@ class MaritalStatus(models.Model): class UserProfile(models.Model): - user = models.OneToOneField(User, related_name="profile") + user = models.OneToOneField(User, related_name="profile", on_delete=models.DO_NOTHING) role = models.CharField(max_length=10, choices=ROLE_CHOICES, default='patient') data = models.TextField(blank=True) cover_image = models.ImageField(upload_to='cover_image/', default='/static/images/cover.png') @@ -236,7 +242,7 @@ class UserProfile(models.Model): sex = models.CharField(max_length=6, choices=SEX_CHOICES, blank=True) date_of_birth = models.DateTimeField(null=True, blank=True) deceased_date = models.DateTimeField(null=True, blank=True) - marital_status = models.ForeignKey(MaritalStatus, null=True, blank=True) + marital_status = models.ForeignKey(MaritalStatus, null=True, blank=True, on_delete=models.DO_NOTHING) phone_number = models.CharField(max_length=20, blank=True) note = models.TextField(null=True, blank=True) active_reason = models.TextField(null=True, blank=True) @@ -251,19 +257,19 @@ def __unicode__(self): # Many To Many Relation class PatientController(models.Model): - patient = models.ForeignKey(User, related_name='patient_physicians') - physician = models.ForeignKey(User, related_name='physician_patients') + patient = models.ForeignKey(User, related_name='patient_physicians', on_delete=models.DO_NOTHING) + physician = models.ForeignKey(User, related_name='physician_patients', on_delete=models.DO_NOTHING) author = models.BooleanField(default=False) class PhysicianTeam(models.Model): # Need to add save_admin to check if member is physician - physician = models.ForeignKey(User, related_name='physician_helpers') - member = models.ForeignKey(User, related_name='user_leaders') + physician = models.ForeignKey(User, related_name='physician_helpers', on_delete=models.DO_NOTHING) + member = models.ForeignKey(User, related_name='user_leaders', on_delete=models.DO_NOTHING) class AccessLog(models.Model): - user = models.ForeignKey(User) + user = models.ForeignKey(User, on_delete=models.DO_NOTHING) datetime = models.DateTimeField(auto_now_add=True) summary = models.TextField() @@ -272,8 +278,8 @@ def __unicode__(self): class Encounter(models.Model): - physician = models.ForeignKey(User, related_name="physician_encounters") - patient = models.ForeignKey(User, related_name="patient_encounters") + physician = models.ForeignKey(User, related_name="physician_encounters", on_delete=models.DO_NOTHING) + patient = models.ForeignKey(User, related_name="patient_encounters", on_delete=models.DO_NOTHING) starttime = models.DateTimeField(auto_now_add=True) stoptime = models.DateTimeField(null=True, blank=True) audio = models.FileField(upload_to=get_path, blank=True) @@ -305,7 +311,7 @@ def duration(self): class EncounterEvent(models.Model): - encounter = models.ForeignKey(Encounter, related_name='encounter_events', null=True, blank=True) + encounter = models.ForeignKey(Encounter, related_name='encounter_events', null=True, blank=True, on_delete=models.DO_NOTHING) datetime = models.DateTimeField(auto_now_add=True) summary = models.TextField(default='') @@ -316,7 +322,7 @@ class EncounterEvent(models.Model): timestamp = models.DateTimeField(null=True, blank=True) def __unicode__(self): - return unicode(self.summary) + return self.summary def video_seconds(self): if self.timestamp: @@ -337,7 +343,7 @@ def video_timestamp(self): # @Deprecated class TextNote(models.Model): - author = models.ForeignKey(User, null=True, blank=True) + author = models.ForeignKey(User, null=True, blank=True, on_delete=models.DO_NOTHING) by = models.CharField(max_length=20, choices=BY_CHOICES) note = models.TextField() datetime = models.DateTimeField(auto_now_add=True) @@ -349,16 +355,16 @@ def __unicode__(self): class ProblemLabel(models.Model): name = models.TextField(null=True, blank=True) css_class = models.TextField(null=True, blank=True) - author = models.ForeignKey(User, null=True, blank=True, related_name="problem_label_author") - patient = models.ForeignKey(User, null=True, blank=True, related_name="problem_label_patient") + author = models.ForeignKey(User, null=True, blank=True, related_name="problem_label_author", on_delete=models.DO_NOTHING) + patient = models.ForeignKey(User, null=True, blank=True, related_name="problem_label_patient", on_delete=models.DO_NOTHING) def __unicode__(self): - return '%s' % (unicode(self.name)) + return self.name class Problem(MPTTModel): - patient = models.ForeignKey(User) - parent = TreeForeignKey('self', null=True, blank=True, related_name='children') + patient = models.ForeignKey(User, on_delete=models.DO_NOTHING) + parent = TreeForeignKey('self', null=True, blank=True, related_name='children', on_delete=models.DO_NOTHING) problem_name = models.CharField(max_length=200) concept_id = models.CharField(max_length=20, blank=True, null=True) is_controlled = models.BooleanField(default=False) @@ -379,23 +385,23 @@ def __unicode__(self): class SharingPatient(models.Model): - sharing = models.ForeignKey(User, related_name='patient_sharing') - shared = models.ForeignKey(User, related_name='patient_shared') + sharing = models.ForeignKey(User, related_name='patient_sharing', on_delete=models.DO_NOTHING) + shared = models.ForeignKey(User, related_name='patient_shared', on_delete=models.DO_NOTHING) problems = models.ManyToManyField(Problem, blank=True, related_name="sharing_problems") is_my_story_shared = models.BooleanField(default=True) class ProblemOrder(models.Model): - patient = models.ForeignKey(User, null=True, blank=True, related_name="patient_problem_order") - user = models.ForeignKey(User, null=True, blank=True, related_name="user_problem_order") + patient = models.ForeignKey(User, null=True, blank=True, related_name="patient_problem_order", on_delete=models.DO_NOTHING) + user = models.ForeignKey(User, null=True, blank=True, related_name="user_problem_order", on_delete=models.DO_NOTHING) order = ListField(null=True, blank=True) def __unicode__(self): - return '%s' % (unicode(self.user.username)) + return self.user.username class ProblemSegment(models.Model): - problem = models.ForeignKey(Problem, related_name='problem_segment') + problem = models.ForeignKey(Problem, related_name='problem_segment', on_delete=models.DO_NOTHING) is_controlled = models.BooleanField(default=False) is_active = models.BooleanField(default=True) authenticated = models.BooleanField(default=False) @@ -411,8 +417,8 @@ def __unicode__(self): class ProblemActivity(models.Model): - problem = models.ForeignKey(Problem) - author = models.ForeignKey(User, null=True, blank=True) + problem = models.ForeignKey(Problem, on_delete=models.DO_NOTHING) + author = models.ForeignKey(User, null=True, blank=True, on_delete=models.DO_NOTHING) activity = models.TextField() is_input_type = models.BooleanField(default=False) is_output_type = models.BooleanField(default=False) @@ -423,8 +429,8 @@ class Meta: class ProblemNote(models.Model): - author = models.ForeignKey(User, null=True, blank=True) - problem = models.ForeignKey(Problem, null=True, blank=True) + author = models.ForeignKey(User, null=True, blank=True, on_delete=models.DO_NOTHING) + problem = models.ForeignKey(Problem, null=True, blank=True, on_delete=models.DO_NOTHING) note = models.TextField() note_type = models.CharField(choices=NOTE_TYPE_CHOICES, max_length=50) created_on = models.DateTimeField(auto_now_add=True) @@ -436,20 +442,20 @@ def __unicode__(self): class LabeledProblemList(models.Model): - user = models.ForeignKey(User, null=True, blank=True, related_name="label_problem_list_user") - patient = models.ForeignKey(User, null=True, blank=True, related_name="label_problem_list_patient") + user = models.ForeignKey(User, null=True, blank=True, related_name="label_problem_list_user", on_delete=models.DO_NOTHING) + patient = models.ForeignKey(User, null=True, blank=True, related_name="label_problem_list_patient", on_delete=models.DO_NOTHING) labels = models.ManyToManyField(ProblemLabel, blank=True) name = models.TextField() problem_list = ListField(null=True, blank=True) note = models.TextField(null=True, blank=True) def __unicode__(self): - return '%s' % (unicode(self.name)) + return self.name class Goal(models.Model): - patient = models.ForeignKey(User) - problem = models.ForeignKey(Problem, null=True, blank=True) + patient = models.ForeignKey(User, on_delete=models.DO_NOTHING) + problem = models.ForeignKey(Problem, null=True, blank=True, on_delete=models.DO_NOTHING) goal = models.TextField() is_controlled = models.BooleanField(default=False) accomplished = models.BooleanField(default=False) @@ -457,17 +463,17 @@ class Goal(models.Model): start_date = models.DateTimeField(auto_now_add=True) def __unicode__(self): - return '%s %s' % (unicode(self.patient), unicode(self.problem)) + return f'{self.patient} {self.problem}' class Label(models.Model): name = models.TextField(null=True, blank=True) css_class = models.TextField(null=True, blank=True) - author = models.ForeignKey(User, null=True, blank=True, related_name="label_author") + author = models.ForeignKey(User, null=True, blank=True, related_name="label_author", on_delete=models.DO_NOTHING) is_all = models.BooleanField(default=False) def __unicode__(self): - return '%s' % (unicode(self.name)) + return self.name class ToDo(models.Model): @@ -490,15 +496,15 @@ class ToDo(models.Model): due_date = models.DateTimeField(blank=True, null=True) order = models.BigIntegerField(null=True, blank=True) # Position in normal todo list - user = models.ForeignKey(User, null=True, blank=True, related_name="todo_owner") # Author - patient = models.ForeignKey(User, null=True, blank=True, related_name="todo_patient") + user = models.ForeignKey(User, null=True, blank=True, related_name="todo_owner", on_delete=models.DO_NOTHING) # Author + patient = models.ForeignKey(User, null=True, blank=True, related_name="todo_patient", on_delete=models.DO_NOTHING) labels = models.ManyToManyField(Label, blank=True) - a1c = models.ForeignKey("AOneC", null=True, blank=True, related_name="a1c_todos") - problem = models.ForeignKey(Problem, null=True, blank=True) - colon_cancer = models.ForeignKey("ColonCancerScreening", null=True, blank=True, related_name="colon_cancer_todos") + a1c = models.ForeignKey("AOneC", null=True, blank=True, related_name="a1c_todos", on_delete=models.DO_NOTHING) + problem = models.ForeignKey(Problem, null=True, blank=True, on_delete=models.DO_NOTHING) + colon_cancer = models.ForeignKey("ColonCancerScreening", null=True, blank=True, related_name="colon_cancer_todos", on_delete=models.DO_NOTHING) notes = models.ManyToManyField(TextNote, blank=True) # aka comment should 1-n relation members = models.ManyToManyField(User, through="TaggedToDoOrder") - medication = models.ForeignKey("Medication", null=True) + medication = models.ForeignKey("Medication", null=True, on_delete=models.DO_NOTHING) created_at = models.PositiveIntegerField(choices=BELONG_TO, default=0) # Place where todo is generated -> removed created_on = models.DateTimeField(auto_now_add=True, null=True, blank=True) @@ -506,30 +512,30 @@ class ToDo(models.Model): objects = TodoManager() def __unicode__(self): - return '%s' % (unicode(self.todo)) + return self.todo class TaggedToDoOrder(models.Model): order = models.BigIntegerField(null=True, blank=True) status = models.IntegerField(choices=VIEW_STATUS, default=0) - todo = models.ForeignKey(ToDo, null=True, blank=True) - user = models.ForeignKey(User, null=True, blank=True) + todo = models.ForeignKey(ToDo, null=True, blank=True, on_delete=models.DO_NOTHING) + user = models.ForeignKey(User, null=True, blank=True, on_delete=models.DO_NOTHING) created_on = models.DateTimeField(auto_now_add=True, null=True, blank=True) def __unicode__(self): - return '%s' % (unicode(self.todo.todo)) + return self.todo.todo class LabeledToDoList(models.Model): name = models.TextField() - user = models.ForeignKey(User) # author + user = models.ForeignKey(User, on_delete=models.DO_NOTHING) # author labels = models.ManyToManyField(Label, blank=True) private = models.BooleanField(default=1) # 1 is save just for me, 0: is save for all user todo_list = ListField(null=True, blank=True) expanded = ListField(null=True, blank=True) def __unicode__(self): - return '%s' % (unicode(self.name)) + return self.name class Guideline(models.Model): @@ -548,7 +554,7 @@ def get_form(self): class GuidelineForm(models.Model): - guideline = models.OneToOneField(Guideline) + guideline = models.OneToOneField(Guideline, on_delete=models.DO_NOTHING) form = models.TextField() def __unicode__(self): @@ -556,27 +562,27 @@ def __unicode__(self): class PatientImage(models.Model): - patient = models.ForeignKey(User) - problem = models.ForeignKey(Problem, null=True, blank=True) + patient = models.ForeignKey(User, on_delete=models.DO_NOTHING) + problem = models.ForeignKey(Problem, null=True, blank=True, on_delete=models.DO_NOTHING) image = models.ImageField(upload_to=get_path) datetime = models.DateTimeField(auto_now_add=True) def __unicode__(self): - return '%s' % (unicode(self.patient)) + return self.patient class Sharing(models.Model): - patient = models.ForeignKey(User, related_name='target_patient') - other_patient = models.ForeignKey(User, related_name='other_patient') + patient = models.ForeignKey(User, related_name='target_patient', on_delete=models.DO_NOTHING) + other_patient = models.ForeignKey(User, related_name='other_patient', on_delete=models.DO_NOTHING) all = models.BooleanField(default=True) def __unicode__(self): - return '%s %s' % (unicode(self.patient), unicode(self.other_patient)) + return f'{self.patient} {self.other_patient}' class Viewer(models.Model): - patient = models.ForeignKey(User, related_name='viewed_patient') - viewer = models.ForeignKey(User, related_name='viewer') + patient = models.ForeignKey(User, related_name='viewed_patient', on_delete=models.DO_NOTHING) + viewer = models.ForeignKey(User, related_name='viewer', on_delete=models.DO_NOTHING) datetime = models.DateTimeField(auto_now=True) # for tracking open browser instances e.g. multiple tabs tracking_id = models.CharField(max_length=20, blank=True) @@ -585,46 +591,46 @@ class Viewer(models.Model): class ViewStatus(models.Model): - patient = models.ForeignKey(User) + patient = models.ForeignKey(User, on_delete=models.DO_NOTHING) status = models.TextField() class ProblemRelationship(models.Model): - source = models.ForeignKey(Problem, related_name="source") - target = models.ForeignKey(Problem, related_name="target") + source = models.ForeignKey(Problem, related_name="source", on_delete=models.DO_NOTHING) + target = models.ForeignKey(Problem, related_name="target", on_delete=models.DO_NOTHING) def __unicode__(self): - return "%s %s" % (unicode(self.source), unicode(self.target)) + return f'{self.source} {self.target}' class EncounterProblemRecord(models.Model): encounter = models.ForeignKey( - Encounter, related_name='encounter_problem_records') + Encounter, related_name='encounter_problem_records', on_delete=models.DO_NOTHING) problem = models.ForeignKey( - Problem, related_name='problem_encounter_records') + Problem, related_name='problem_encounter_records', on_delete=models.DO_NOTHING) def __unicode__(self): - return "%s %s" % (unicode(self.encounter), unicode(self.problem)) + return f'{self.encounter} {self.problem}' class ToDoComment(models.Model): - todo = models.ForeignKey(ToDo, related_name="comments") - user = models.ForeignKey(User) + todo = models.ForeignKey(ToDo, related_name="comments", on_delete=models.DO_NOTHING) + user = models.ForeignKey(User, on_delete=models.DO_NOTHING) comment = models.TextField(null=True, blank=True) datetime = models.DateTimeField(auto_now=True) def __unicode__(self): - return '%s' % (unicode(self.todo.todo)) + return self.todo.todo class ToDoAttachment(models.Model): - todo = models.ForeignKey(ToDo, related_name="attachments") + todo = models.ForeignKey(ToDo, related_name="attachments", on_delete=models.DO_NOTHING) attachment = models.FileField(upload_to='attachments/', blank=True) datetime = models.DateTimeField(auto_now=True) - user = models.ForeignKey(User) + user = models.ForeignKey(User, on_delete=models.DO_NOTHING) def __unicode__(self): - return '%s' % (unicode(self.attachment.path)) + return self.attachment.path def filename(self): return os.path.basename(self.attachment.name) @@ -648,19 +654,19 @@ def is_image(self): class EncounterTodoRecord(models.Model): encounter = models.ForeignKey( - Encounter, related_name='encounter_todo_records') + Encounter, related_name='encounter_todo_records', on_delete=models.DO_NOTHING) todo = models.ForeignKey( - ToDo, related_name='todo_encounter_records') + ToDo, related_name='todo_encounter_records', on_delete=models.DO_NOTHING) def __unicode__(self): - return "%s %s" % (unicode(self.encounter), unicode(self.todo)) + return f'{self.encounter} {self.todo}' class TodoActivity(models.Model): - todo = models.ForeignKey(ToDo) - author = models.ForeignKey(User, null=True, blank=True) - comment = models.ForeignKey(ToDoComment, null=True, blank=True) - attachment = models.ForeignKey(ToDoAttachment, null=True, blank=True) + todo = models.ForeignKey(ToDo, on_delete=models.DO_NOTHING) + author = models.ForeignKey(User, null=True, blank=True, on_delete=models.DO_NOTHING) + comment = models.ForeignKey(ToDoComment, null=True, blank=True, on_delete=models.DO_NOTHING) + attachment = models.ForeignKey(ToDoAttachment, null=True, blank=True, on_delete=models.DO_NOTHING) activity = models.TextField() created_on = models.DateTimeField(auto_now_add=True) @@ -684,19 +690,19 @@ class Observation(models.Model): comments = models.TextField(null=True, blank=True) color = models.CharField(max_length=7, null=True, blank=True) graph = models.TextField(default='Line') - subject = models.ForeignKey(User, null=True, blank=True, related_name='observation_subjects') + subject = models.ForeignKey(User, null=True, blank=True, related_name='observation_subjects', on_delete=models.DO_NOTHING) # TODO: Check for deprecation - encounter = models.ForeignKey(User, null=True, blank=True, related_name='observation_encounters') + encounter = models.ForeignKey(User, null=True, blank=True, related_name='observation_encounters', on_delete=models.DO_NOTHING) # TODO: Check for deprecation - performer = models.ForeignKey(User, null=True, blank=True, related_name='observation_performers') - author = models.ForeignKey(User, null=True, blank=True, related_name='observation_authors') + performer = models.ForeignKey(User, null=True, blank=True, related_name='observation_performers', on_delete=models.DO_NOTHING) + author = models.ForeignKey(User, null=True, blank=True, related_name='observation_authors', on_delete=models.DO_NOTHING) created_on = models.DateTimeField(auto_now_add=True) class Meta: ordering = ['-created_on'] def __unicode__(self): - return '%s' % (unicode(self.name)) + return self.name class ObservationComponent(models.Model): @@ -715,8 +721,8 @@ class ObservationComponent(models.Model): comments = models.TextField(null=True, blank=True) effective_datetime = models.DateTimeField(null=True, blank=True) - observation = models.ForeignKey(Observation, related_name='observation_components') - author = models.ForeignKey(User, null=True, blank=True, related_name='observation_component_authors') + observation = models.ForeignKey(Observation, related_name='observation_components', on_delete=models.DO_NOTHING) + author = models.ForeignKey(User, null=True, blank=True, related_name='observation_component_authors', on_delete=models.DO_NOTHING) created_on = models.DateTimeField(auto_now_add=True, null=True, blank=True) @@ -724,11 +730,11 @@ class Meta: ordering = ['effective_datetime', 'created_on'] def __unicode__(self): - return '%s' % (unicode(self.name)) + return self.name class ObservationUnit(models.Model): - observation = models.ForeignKey(Observation, related_name='observation_units') + observation = models.ForeignKey(Observation, related_name='observation_units', on_delete=models.DO_NOTHING) value_unit = models.CharField(max_length=45, null=True, blank=True) is_used = models.BooleanField(default=False) @@ -741,8 +747,8 @@ class ObservationValue(models.Model): value_string = models.TextField(null=True, blank=True) value_unit = models.CharField(max_length=45, null=True, blank=True) effective_datetime = models.DateTimeField(null=True, blank=True) - component = models.ForeignKey(ObservationComponent, related_name='observation_component_values') - author = models.ForeignKey(User, null=True, blank=True, related_name='observation_value_authors') + component = models.ForeignKey(ObservationComponent, related_name='observation_component_values', on_delete=models.DO_NOTHING) + author = models.ForeignKey(User, null=True, blank=True, related_name='observation_value_authors', on_delete=models.DO_NOTHING) created_on = models.DateTimeField(auto_now_add=True, null=True, blank=True) class Meta: @@ -750,18 +756,18 @@ class Meta: class ObservationOrder(models.Model): - patient = models.ForeignKey(User, null=True, blank=True, related_name="patient_observation_order") - user = models.ForeignKey(User, null=True, blank=True, related_name="user_observation_order") + patient = models.ForeignKey(User, null=True, blank=True, related_name="patient_observation_order", on_delete=models.DO_NOTHING) + user = models.ForeignKey(User, null=True, blank=True, related_name="user_observation_order", on_delete=models.DO_NOTHING) order = ListField(null=True, blank=True) def __unicode__(self): - return '%s' % (unicode(self.user.username)) + return self.user.username class ObservationPinToProblem(models.Model): - author = models.ForeignKey(User, null=True, blank=True, related_name='pin_authors') - observation = models.ForeignKey(Observation, null=True, blank=True, related_name='pin_observations') - problem = models.ForeignKey(Problem, null=True, blank=True, related_name='pin_problems') + author = models.ForeignKey(User, null=True, blank=True, related_name='pin_authors', on_delete=models.DO_NOTHING) + observation = models.ForeignKey(Observation, null=True, blank=True, related_name='pin_observations', on_delete=models.DO_NOTHING) + problem = models.ForeignKey(Problem, null=True, blank=True, related_name='pin_problems', on_delete=models.DO_NOTHING) class Country(models.Model): @@ -774,7 +780,7 @@ def __unicode__(self): class State(models.Model): - country = models.ForeignKey(Country, related_name='country_states') + country = models.ForeignKey(Country, related_name='country_states', on_delete=models.DO_NOTHING) code = models.CharField(max_length=2) name = models.CharField(max_length=50) @@ -783,7 +789,7 @@ def __unicode__(self): class City(models.Model): - state = models.ForeignKey(State, related_name='state_cities') + state = models.ForeignKey(State, related_name='state_cities', on_delete=models.DO_NOTHING) name = models.CharField(max_length=50) def __unicode__(self): @@ -793,7 +799,7 @@ def __unicode__(self): class Address(models.Model): line1 = models.CharField(max_length=50) line2 = models.CharField(max_length=50) - city = models.ForeignKey(City, related_name='city_addresses') + city = models.ForeignKey(City, related_name='city_addresses', on_delete=models.DO_NOTHING) zip = models.CharField(max_length=6) zip4 = models.CharField(max_length=4, null=True, blank=True) lat = models.DecimalField(max_digits=10, decimal_places=8, null=True, blank=True) @@ -837,8 +843,8 @@ def __unicode__(self): class UserTelecom(models.Model): - user = models.ForeignKey(User, related_name='user_telecoms') - telecom = models.ForeignKey(Telecom, related_name='telecom_users') + user = models.ForeignKey(User, related_name='user_telecoms', on_delete=models.DO_NOTHING) + telecom = models.ForeignKey(Telecom, related_name='telecom_users', on_delete=models.DO_NOTHING) use_code = models.CharField(max_length=6) rank = models.PositiveIntegerField(null=True, blank=True) start = models.DateTimeField(null=True, blank=True) @@ -846,27 +852,27 @@ class UserTelecom(models.Model): class UserAddress(models.Model): - user = models.ForeignKey(User, related_name='user_addresses') - address = models.ForeignKey(Address, related_name='address_users') - type_code = models.ForeignKey(AddressType, related_name='type_code_user_address') - use_code = models.ForeignKey(AddressUse, related_name='use_code_user_address') + user = models.ForeignKey(User, related_name='user_addresses', on_delete=models.DO_NOTHING) + address = models.ForeignKey(Address, related_name='address_users', on_delete=models.DO_NOTHING) + type_code = models.ForeignKey(AddressType, related_name='type_code_user_address', on_delete=models.DO_NOTHING) + use_code = models.ForeignKey(AddressUse, related_name='use_code_user_address', on_delete=models.DO_NOTHING) start = models.DateTimeField(null=True, blank=True) end = models.DateTimeField(null=True, blank=True) class AOneC(models.Model): - problem = models.OneToOneField(Problem, related_name='problem_aonecs') + problem = models.OneToOneField(Problem, related_name='problem_aonecs', on_delete=models.DO_NOTHING) todo_past_six_months = models.BooleanField(default=False) patient_refused_A1C = models.BooleanField(default=False) - observation = models.OneToOneField(Observation, related_name='observation_aonecs') + observation = models.OneToOneField(Observation, related_name='observation_aonecs', on_delete=models.DO_NOTHING) objects = AOneCManager() class AOneCTextNote(models.Model): note = models.TextField() - a1c = models.ForeignKey(AOneC, related_name='a1c_notes') - author = models.ForeignKey(User, null=True, blank=True) + a1c = models.ForeignKey(AOneC, related_name='a1c_notes', on_delete=models.DO_NOTHING) + author = models.ForeignKey(User, null=True, blank=True, on_delete=models.DO_NOTHING) # TODO: Should be renamed to created_on datetime = models.DateTimeField(auto_now_add=True) @@ -876,8 +882,8 @@ def __unicode__(self): class ObservationValueTextNote(models.Model): note = models.TextField() - observation_value = models.ForeignKey(ObservationValue, related_name='observation_value_notes') - author = models.ForeignKey(User, null=True, blank=True) + observation_value = models.ForeignKey(ObservationValue, related_name='observation_value_notes', on_delete=models.DO_NOTHING) + author = models.ForeignKey(User, null=True, blank=True, on_delete=models.DO_NOTHING) # TODO: Should be renamed to created_on datetime = models.DateTimeField(auto_now_add=True) @@ -893,7 +899,7 @@ class CommonProblem(models.Model): problem_name = models.CharField(max_length=200) concept_id = models.CharField(max_length=20, unique=True, null=True, blank=True) problem_type = models.CharField(max_length=10, choices=COMMON_PROBLEM_TYPE_CHOICES, default='acute') - author = models.ForeignKey(User, null=True, blank=True, related_name="common_problem_author") + author = models.ForeignKey(User, null=True, blank=True, related_name="common_problem_author", on_delete=models.DO_NOTHING) class ColonCancerScreening(models.Model): @@ -904,10 +910,10 @@ class ColonCancerScreening(models.Model): todo_past_five_years = models.BooleanField(default=False) patient_refused_on = models.DateTimeField(null=True, blank=True) not_appropriate_on = models.DateTimeField(null=True, blank=True) - problem = models.ForeignKey(Problem, related_name='problem_colon_cancer') - patient = models.ForeignKey(User, related_name='patient_colon_cancer') + problem = models.ForeignKey(Problem, related_name='problem_colon_cancer', on_delete=models.DO_NOTHING) + patient = models.ForeignKey(User, related_name='patient_colon_cancer', on_delete=models.DO_NOTHING) last_risk_updated_user = models.ForeignKey(User, related_name='last_risk_updated_user_colons', null=True, - blank=True) + blank=True, on_delete=models.DO_NOTHING) created_on = models.DateTimeField(auto_now_add=True) objects = ColonCancerScreeningManager() @@ -922,9 +928,9 @@ class ColonCancerStudy(models.Model): result = models.CharField(max_length=100, null=True, blank=True) note = models.TextField(null=True, blank=True) - colon = models.ForeignKey(ColonCancerScreening, related_name='colon_studies') - author = models.ForeignKey(User, related_name='author_studies') - last_updated_user = models.ForeignKey(User, related_name='last_updated_user_studies', null=True, blank=True) + colon = models.ForeignKey(ColonCancerScreening, related_name='colon_studies', on_delete=models.DO_NOTHING) + author = models.ForeignKey(User, related_name='author_studies', on_delete=models.DO_NOTHING) + last_updated_user = models.ForeignKey(User, related_name='last_updated_user_studies', null=True, blank=True, on_delete=models.DO_NOTHING) last_updated_date = models.DateTimeField(auto_now=True) created_on = models.DateTimeField(auto_now_add=True) @@ -937,26 +943,26 @@ class Meta: class ColonCancerStudyImage(models.Model): image = models.ImageField(upload_to='studies/', blank=True) - author = models.ForeignKey(User, null=True, blank=True) - study = models.ForeignKey(ColonCancerStudy, null=True, blank=True, related_name="study_images") + author = models.ForeignKey(User, null=True, blank=True, on_delete=models.DO_NOTHING) + study = models.ForeignKey(ColonCancerStudy, null=True, blank=True, related_name="study_images", on_delete=models.DO_NOTHING) datetime = models.DateTimeField(auto_now_add=True, null=True, blank=True) def __unicode__(self): - return '%s' % (unicode(self.patient)) + return self.patient def filename(self): return os.path.basename(self.image.name) class RiskFactor(models.Model): - colon = models.ForeignKey(ColonCancerScreening, related_name='colon_risk_factors') + colon = models.ForeignKey(ColonCancerScreening, related_name='colon_risk_factors', on_delete=models.DO_NOTHING) factor = models.CharField(max_length=100, null=True, blank=True) class ColonCancerTextNote(models.Model): note = models.TextField() - colon = models.ForeignKey(ColonCancerScreening, related_name='colon_notes') - author = models.ForeignKey(User, null=True, blank=True) + colon = models.ForeignKey(ColonCancerScreening, related_name='colon_notes', on_delete=models.DO_NOTHING) + author = models.ForeignKey(User, null=True, blank=True, on_delete=models.DO_NOTHING) # TODO: Should be renamed to created_at datetime = models.DateTimeField(auto_now_add=True) @@ -970,9 +976,9 @@ class MyStoryTab(models.Model): private = models.BooleanField(default=True) # Only applied if author is Patient is_all = models.BooleanField(default=False) # Only applied if author is Staff - patient = models.ForeignKey(User, related_name="patient_story_tabs") + patient = models.ForeignKey(User, related_name="patient_story_tabs", on_delete=models.DO_NOTHING) author = models.ForeignKey(User, related_name="author_story_tabs", null=True, - blank=True) # Patient, Patient who has accessed to the patient, Physician, Admin + blank=True, on_delete=models.DO_NOTHING) # Patient, Patient who has accessed to the patient, Physician, Admin datetime = models.DateTimeField(auto_now_add=True) @@ -986,9 +992,9 @@ class MyStoryTextComponent(models.Model): # TODO: Why need both private & is_all private = models.BooleanField(default=True) is_all = models.BooleanField(default=False) - tab = models.ForeignKey(MyStoryTab, null=True, blank=True, related_name="my_story_tab_components") - patient = models.ForeignKey(User, related_name="patient_story_texts") - author = models.ForeignKey(User, related_name="author_story_texts", null=True, blank=True) + tab = models.ForeignKey(MyStoryTab, null=True, blank=True, related_name="my_story_tab_components", on_delete=models.DO_NOTHING) + patient = models.ForeignKey(User, related_name="patient_story_texts", on_delete=models.DO_NOTHING) + author = models.ForeignKey(User, related_name="author_story_texts", null=True, blank=True, on_delete=models.DO_NOTHING) # TODO: Should rename to created_at datetime = models.DateTimeField(auto_now_add=True) @@ -998,9 +1004,9 @@ def __unicode__(self): class MyStoryTextComponentEntry(models.Model): text = models.TextField(null=True, blank=True) - component = models.ForeignKey(MyStoryTextComponent, null=True, blank=True, related_name="text_component_entries") - patient = models.ForeignKey(User, related_name="patient_story_text_entries", null=True, blank=True) - author = models.ForeignKey(User, related_name="author_story_text_entries", null=True, blank=True) + component = models.ForeignKey(MyStoryTextComponent, null=True, blank=True, related_name="text_component_entries", on_delete=models.DO_NOTHING) + patient = models.ForeignKey(User, related_name="patient_story_text_entries", null=True, blank=True, on_delete=models.DO_NOTHING) + author = models.ForeignKey(User, related_name="author_story_text_entries", null=True, blank=True, on_delete=models.DO_NOTHING) datetime = models.DateTimeField(auto_now_add=True, blank=True, null=True) class Meta: @@ -1021,12 +1027,12 @@ class Inr(models.Model): next_inr = models.DateTimeField(null=True, blank=True) # Measured date & value is referred to observation data - observation_value = models.OneToOneField(ObservationValue, related_name="inr", null=True) + observation_value = models.OneToOneField(ObservationValue, related_name="inr", null=True, on_delete=models.DO_NOTHING) # Medication dosage author - author = models.ForeignKey(User, related_name='author_inr', blank=True, null=True) + author = models.ForeignKey(User, related_name='author_inr', blank=True, null=True, on_delete=models.DO_NOTHING) # Can be in duplication with patient in observation value becuz this in one-2-on relationship - patient = models.ForeignKey(User, related_name="patient_inr", null=True) + patient = models.ForeignKey(User, related_name="patient_inr", null=True, on_delete=models.DO_NOTHING) created_on = models.DateTimeField(auto_now_add=True) # Medication dosage created @@ -1039,8 +1045,8 @@ def __str__(self): class InrTextNote(models.Model): note = models.TextField() - author = models.ForeignKey(User, related_name="author_note") - patient = models.ForeignKey(User, related_name="patient_note") + author = models.ForeignKey(User, related_name="author_note", on_delete=models.DO_NOTHING) + patient = models.ForeignKey(User, related_name="patient_note", on_delete=models.DO_NOTHING) # TODO: Should be rename to created_at / created_on datetime = models.DateTimeField(auto_now_add=True) @@ -1055,8 +1061,8 @@ class Medication(models.Model): current = models.BooleanField(default=True) # Store original medication search string for change dosage function search_str = models.TextField(null=True, blank=True) - author = models.ForeignKey(User, related_name='author_medications') - patient = models.ForeignKey(User, related_name="patient_medications", blank=True, null=True) + author = models.ForeignKey(User, related_name='author_medications', on_delete=models.DO_NOTHING) + patient = models.ForeignKey(User, related_name="patient_medications", blank=True, null=True, on_delete=models.DO_NOTHING) created_on = models.DateTimeField(auto_now_add=True) class Meta: @@ -1067,15 +1073,15 @@ def __str__(self): class MedicationPinToProblem(models.Model): - author = models.ForeignKey(User, null=True, blank=True, related_name='author_pin_medications') - medication = models.ForeignKey(Medication, related_name='medication_pin_medications') - problem = models.ForeignKey(Problem, related_name='problem_pin_medications') + author = models.ForeignKey(User, null=True, blank=True, related_name='author_pin_medications', on_delete=models.DO_NOTHING) + medication = models.ForeignKey(Medication, related_name='medication_pin_medications', on_delete=models.DO_NOTHING) + problem = models.ForeignKey(Problem, related_name='problem_pin_medications', on_delete=models.DO_NOTHING) class MedicationTextNote(models.Model): note = models.TextField() - medication = models.ForeignKey(Medication, related_name='medication_notes') - author = models.ForeignKey(User) + medication = models.ForeignKey(Medication, related_name='medication_notes', on_delete=models.DO_NOTHING) + author = models.ForeignKey(User, on_delete=models.DO_NOTHING) datetime = models.DateTimeField(auto_now_add=True) def __unicode__(self): @@ -1092,8 +1098,8 @@ class Document(models.Model): # TODO: These should being migrated to using reverse relationship problems = models.ManyToManyField(Problem, blank=True, through="DocumentProblem") # This should be always be the user who sent the request by using request object instead of pass uid directly - author = models.ForeignKey(User, related_name='author_document') - patient = models.ForeignKey(User, related_name='patient_pinned', null=True, blank=True) + author = models.ForeignKey(User, related_name='author_document', on_delete=models.DO_NOTHING) + patient = models.ForeignKey(User, related_name='patient_pinned', null=True, blank=True, on_delete=models.DO_NOTHING) created_on = models.DateTimeField(auto_now_add=True) @@ -1122,16 +1128,16 @@ def file_mime_type(self): class DocumentTodo(models.Model): - document = models.ForeignKey(Document) - todo = models.ForeignKey(ToDo) - author = models.ForeignKey(User) # User who attach document to the todo + document = models.ForeignKey(Document, on_delete=models.DO_NOTHING) + todo = models.ForeignKey(ToDo, on_delete=models.DO_NOTHING) + author = models.ForeignKey(User, on_delete=models.DO_NOTHING) # User who attach document to the todo created_on = models.DateTimeField(auto_now_add=True) class DocumentProblem(models.Model): - document = models.ForeignKey(Document) - problem = models.ForeignKey(Problem) - author = models.ForeignKey(User) # User who attach document to the problem + document = models.ForeignKey(Document, on_delete=models.DO_NOTHING) + problem = models.ForeignKey(Problem, on_delete=models.DO_NOTHING) + author = models.ForeignKey(User, on_delete=models.DO_NOTHING) # User who attach document to the problem created_on = models.DateTimeField(auto_now_add=True) @@ -1148,8 +1154,8 @@ class GeneralSetting(models.Model): class EncounterObservationValue(models.Model): - encounter = models.ForeignKey(Encounter, null=False) - observation_value = models.ForeignKey(ObservationValue, null=False) + encounter = models.ForeignKey(Encounter, null=False, on_delete=models.DO_NOTHING) + observation_value = models.ForeignKey(ObservationValue, null=False, on_delete=models.DO_NOTHING) created_on = models.DateTimeField(auto_now_add=True) @@ -1158,9 +1164,9 @@ class Narrative(models.Model): """ description = models.TextField() - patient = models.ForeignKey(User, related_name="patient_narratives") - author = models.ForeignKey(User, related_name="owned_narratives") - parent = models.ForeignKey("Narrative", related_name="child", null=True) + patient = models.ForeignKey(User, related_name="patient_narratives", on_delete=models.DO_NOTHING) + author = models.ForeignKey(User, related_name="owned_narratives", on_delete=models.DO_NOTHING) + parent = models.ForeignKey("Narrative", related_name="child", null=True, on_delete=models.DO_NOTHING) created_at = models.DateTimeField(auto_now_add=True) @@ -1210,8 +1216,8 @@ class Meta: class EncounterMedication(models.Model): - encounter = models.ForeignKey(to=Encounter, related_name='medications') - medication = models.ForeignKey(to=Medication, related_name='encounters') + encounter = models.ForeignKey(to=Encounter, related_name='medications', on_delete=models.DO_NOTHING) + medication = models.ForeignKey(to=Medication, related_name='encounters', on_delete=models.DO_NOTHING) created_at = models.DateTimeField(auto_now_add=True) class Meta: diff --git a/apps/emr/views.py b/apps/emr/views.py index e194a8e9..5f337549 100644 --- a/apps/emr/views.py +++ b/apps/emr/views.py @@ -18,20 +18,30 @@ import os from audioop import reverse -from django.contrib.auth.decorators import user_passes_test, login_required +from common.views import * +from django.contrib.auth.decorators import login_required, user_passes_test from django.contrib.auth.models import User from django.core.checks import messages from django.views.generic import View from django.views.static import serve +from emr.models import ( + Goal, + Guideline, + PatientImage, + Problem, + ProblemRelationship, + Sharing, + TextNote, + ToDo, + UserProfile, + Viewer, + ViewStatus, + VWProblems, +) +from emr.mysnomedct import VWProblemsSerializers from ranged_response import RangedFileResponse import project.settings as settings -from common.views import * -from emr.mysnomedct import VWProblemsSerializers -from models import UserProfile, Problem, \ - Goal, ToDo, Guideline, TextNote, PatientImage, \ - Sharing, Viewer, \ - ViewStatus, ProblemRelationship, VWProblems @user_passes_test(lambda u: u.is_superuser) @@ -412,7 +422,7 @@ def has_read_permission(request, path): """ Only show to authenticated users""" # Note this could allow access to paths including ../.. # Don't use this simple check in production! - return request.user.is_authenticated() + return request.user.is_authenticated def serve_private_file(request, path): @@ -424,7 +434,6 @@ def serve_private_file(request, path): """ if has_read_permission(request, path): fileRes = serve(request, path, settings.MEDIA_ROOT, False) - response = RangedFileResponse(request, fileRes.file_to_stream, fileRes._headers['content-type'][1]) - return response + return fileRes else: return HttpResponseForbidden() diff --git a/apps/encounters_app/urls.py b/apps/encounters_app/urls.py index 7fe1c2c0..5ef1e60d 100644 --- a/apps/encounters_app/urls.py +++ b/apps/encounters_app/urls.py @@ -14,27 +14,48 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see """ -from django.conf.urls import url - +from django.urls import re_path from encounters_app.views import * urlpatterns = [ - - url(r'^patient/(?P\d+)/encounter/status$', patient_encounter_status), - url(r'^patient/(?P\d+)/encounter/start$', create_new_encounter), - url(r'^patient/(?P\d+)/encounter/(?P\d+)/update_note$', update_encounter_note), - url(r'^patient/(?P\d+)/encounter/(?P\d+)/upload_video/$', upload_encounter_video), - url(r'^patient/(?P\d+)/encounter/(?P\d+)/upload_audio/$', upload_encounter_audio), - url(r'^patient/(?P\d+)/encounter/(?P\d+)/add_timestamp$', add_timestamp), - url(r'^patient/(?P\d+)/encounter/(?P\d+)/delete$', delete_encounter), - - url(r'^encounter/(?P\d+)/stop$', stop_patient_encounter), - url(r'^encounter/(?P\d+)/info$', get_encounter_info), - url(r'^encounter/(?P\d+)/recorder_status$', toggle_encounter_recorder), - url(r'^encounter/(?P\d+)/audio_played$', increase_audio_played_count), - url(r'^encounter/(?P\d+)/event$', add_encounter_event), - url(r'^encounter/add/event_summary$', add_event_summary), - - url(r'^encounter_event/(?P\d+)/mark_favorite$', mark_favorite), - url(r'^encounter_event/(?P\d+)/name_favorite$', name_favorite), + re_path( + r"^patient/(?P\d+)/encounter/status$", patient_encounter_status + ), + re_path(r"^patient/(?P\d+)/encounter/start$", create_new_encounter), + re_path( + r"^patient/(?P\d+)/encounter/(?P\d+)/update_note$", + update_encounter_note, + ), + re_path( + r"^patient/(?P\d+)/encounter/(?P\d+)/upload_video/$", + upload_encounter_video, + ), + re_path( + r"^patient/(?P\d+)/encounter/(?P\d+)/upload_audio/$", + upload_encounter_audio, + ), + re_path( + r"^patient/(?P\d+)/encounter/(?P\d+)/add_timestamp$", + add_timestamp, + ), + re_path( + r"^patient/(?P\d+)/encounter/(?P\d+)/delete$", + delete_encounter, + ), + re_path(r"^encounter/(?P\d+)/stop$", stop_patient_encounter), + re_path(r"^encounter/(?P\d+)/info$", get_encounter_info), + re_path( + r"^encounter/(?P\d+)/recorder_status$", toggle_encounter_recorder + ), + re_path( + r"^encounter/(?P\d+)/audio_played$", increase_audio_played_count + ), + re_path(r"^encounter/(?P\d+)/event$", add_encounter_event), + re_path(r"^encounter/add/event_summary$", add_event_summary), + re_path( + r"^encounter_event/(?P\d+)/mark_favorite$", mark_favorite + ), + re_path( + r"^encounter_event/(?P\d+)/name_favorite$", name_favorite + ), ] diff --git a/apps/goals_app/urls.py b/apps/goals_app/urls.py index ab451b29..ab3dac41 100644 --- a/apps/goals_app/urls.py +++ b/apps/goals_app/urls.py @@ -14,14 +14,20 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see """ -from django.conf.urls import url - +from django.urls import re_path from goals_app.views import * urlpatterns = [ - url(r'^goal/(?P\d+)/info$', get_goal_info), - url(r'^patient/(?P\d+)/goals/add/new_goal$', add_patient_goal), - url(r'^patient/(?P\d+)/goal/(?P\d+)/add_note$', add_goal_note), - url(r'^patient/(?P\d+)/goal/(?P\d+)/update_status$', update_goal_status), - url(r'^patient/(?P\d+)/goal/(?P\d+)/change_name$', change_name), + re_path(r"^goal/(?P\d+)/info$", get_goal_info), + re_path(r"^patient/(?P\d+)/goals/add/new_goal$", add_patient_goal), + re_path( + r"^patient/(?P\d+)/goal/(?P\d+)/add_note$", add_goal_note + ), + re_path( + r"^patient/(?P\d+)/goal/(?P\d+)/update_status$", + update_goal_status, + ), + re_path( + r"^patient/(?P\d+)/goal/(?P\d+)/change_name$", change_name + ), ] diff --git a/apps/inr_app/urls.py b/apps/inr_app/urls.py index de0c881c..d8926362 100644 --- a/apps/inr_app/urls.py +++ b/apps/inr_app/urls.py @@ -14,22 +14,21 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see """ -from django.conf.urls import url - +from django.urls import re_path from inr_app.views import * urlpatterns = [ - url(r'^(?P\d+)/target/get$', get_inr_target), - url(r'^(?P\d+)/target/set$', set_inr_target), - url(r'^(?P\d+)/inrs$', get_inr_table), - url(r'^(?P\d+)/inr/add$', add_inr), - url(r'^(?P\d+)/inr/update$', update_inr), - url(r'^(?P\d+)/inr/delete$', delete_inr), - url(r'^(?P\d+)/problems$', get_problems), - url(r'^(?P\d+)/medications$', get_medications), - url(r'^(?P\d+)/(?P\d+)/orders$', get_orders), - url(r'^(?P\d+)/order/add$', add_order), - url(r'^(?P\d+)/notes$', get_inr_note), - url(r'^(?P\d+)/note/add$', add_note), - url(r'^patients$', find_patient) + re_path(r"^(?P\d+)/target/get$", get_inr_target), + re_path(r"^(?P\d+)/target/set$", set_inr_target), + re_path(r"^(?P\d+)/inrs$", get_inr_table), + re_path(r"^(?P\d+)/inr/add$", add_inr), + re_path(r"^(?P\d+)/inr/update$", update_inr), + re_path(r"^(?P\d+)/inr/delete$", delete_inr), + re_path(r"^(?P\d+)/problems$", get_problems), + re_path(r"^(?P\d+)/medications$", get_medications), + re_path(r"^(?P\d+)/(?P\d+)/orders$", get_orders), + re_path(r"^(?P\d+)/order/add$", add_order), + re_path(r"^(?P\d+)/notes$", get_inr_note), + re_path(r"^(?P\d+)/note/add$", add_note), + re_path(r"^patients$", find_patient), ] diff --git a/apps/medication_app/operations.py b/apps/medication_app/operations.py index 68288447..e6994d24 100644 --- a/apps/medication_app/operations.py +++ b/apps/medication_app/operations.py @@ -15,8 +15,15 @@ along with this program. If not, see """ from common.views import timeit -from emr.models import Encounter, EncounterEvent, ProblemActivity, MedicationPinToProblem, PatientController, Problem, \ - EncounterMedication +from emr.models import ( + Encounter, + EncounterEvent, + EncounterMedication, + MedicationPinToProblem, + PatientController, + Problem, + ProblemActivity, +) @timeit @@ -80,8 +87,8 @@ def op_pin_medication_to_problem_for_all_controlled_patient(actor, pinned_instan :return: """ controlled_patients = PatientController.objects.filter(physician=actor) - controlled_patient_id_set = [long(x.patient.id) for x in controlled_patients] - pinned_instance_id_set = [long(x.problem_id) for x in pinned_instance_set] + controlled_patient_id_set = [int(x.patient.id) for x in controlled_patients] + pinned_instance_id_set = [int(x.problem_id) for x in pinned_instance_set] # Filtered out all problem already pinned to this medication problems = Problem.objects.filter(concept_id=problem.concept_id).filter( diff --git a/apps/medication_app/urls.py b/apps/medication_app/urls.py index 484d8e9f..d9cd0418 100644 --- a/apps/medication_app/urls.py +++ b/apps/medication_app/urls.py @@ -14,26 +14,33 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see """ -from django.conf.urls import url - +from django.urls import re_path from medication_app.views import * urlpatterns = [ - url(r'^list_terms$', list_terms), - - url(r'^note/(?P\d+)/edit$', edit_note), - url(r'^note/(?P\d+)/delete$', delete_note), - - url(r'^(?P\d+)/pin_to_problem$', pin_to_problem), - url(r'^(?P\d+)/get_medications$', get_medications), - url(r'^(?P\d+)/add_medication$', add_medication), - - url(r'^(?P\d+)/(?P\d+)/change_active_medication$', change_active_medication), - url(r'^(?P\d+)/(?P\d+)/change_dosage$', change_dosage), - url(r'^(?P\d+)/(?P\d+)/access$', on_medication_accessed), - url(r'^(?P\d+)/(?P\d+)/add_medication_note$', add_medication_note), - url(r'^(?P\d+)/medication/(?P\d+)/info$', get_medication), - - url(r'^(?P\d+)/get_pins$', get_pins), - url(r'^(?P\d+)/encounters$', get_medication_encounter), + re_path(r"^list_terms$", list_terms), + re_path(r"^note/(?P\d+)/edit$", edit_note), + re_path(r"^note/(?P\d+)/delete$", delete_note), + re_path(r"^(?P\d+)/pin_to_problem$", pin_to_problem), + re_path(r"^(?P\d+)/get_medications$", get_medications), + re_path(r"^(?P\d+)/add_medication$", add_medication), + re_path( + r"^(?P\d+)/(?P\d+)/change_active_medication$", + change_active_medication, + ), + re_path( + r"^(?P\d+)/(?P\d+)/change_dosage$", change_dosage + ), + re_path( + r"^(?P\d+)/(?P\d+)/access$", on_medication_accessed + ), + re_path( + r"^(?P\d+)/(?P\d+)/add_medication_note$", + add_medication_note, + ), + re_path( + r"^(?P\d+)/medication/(?P\d+)/info$", get_medication + ), + re_path(r"^(?P\d+)/get_pins$", get_pins), + re_path(r"^(?P\d+)/encounters$", get_medication_encounter), ] diff --git a/apps/my_story_app/urls.py b/apps/my_story_app/urls.py index 91f269a7..32e9fc1b 100644 --- a/apps/my_story_app/urls.py +++ b/apps/my_story_app/urls.py @@ -14,19 +14,27 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see """ -from django.conf.urls import url - +from django.urls import re_path from my_story_app.views import * urlpatterns = [ - url(r'^track/click$', track_tab_click), - url(r'^(?P\d+)/get_my_story$', get_my_story), - url(r'^(?P\d+)/info$', get_tab_info), - url(r'^(?P\d+)/add_tab$', add_tab), - url(r'^(?P\d+)/(?P\d+)/add_text$', add_text), - url(r'^(?P\d+)/delete_tab/(?P\d+)$', delete_tab), - url(r'^(?P\d+)/save_tab/(?P\d+)$', save_tab), - url(r'^(?P\d+)/delete_text_component/(?P\d+)$', delete_text_component), - url(r'^(?P\d+)/save_text_component/(?P\d+)$', save_text_component), - url(r'^(?P\d+)/save_text_component_entry/(?P\d+)$', save_text_component_entry) + re_path(r"^track/click$", track_tab_click), + re_path(r"^(?P\d+)/get_my_story$", get_my_story), + re_path(r"^(?P\d+)/info$", get_tab_info), + re_path(r"^(?P\d+)/add_tab$", add_tab), + re_path(r"^(?P\d+)/(?P\d+)/add_text$", add_text), + re_path(r"^(?P\d+)/delete_tab/(?P\d+)$", delete_tab), + re_path(r"^(?P\d+)/save_tab/(?P\d+)$", save_tab), + re_path( + r"^(?P\d+)/delete_text_component/(?P\d+)$", + delete_text_component, + ), + re_path( + r"^(?P\d+)/save_text_component/(?P\d+)$", + save_text_component, + ), + re_path( + r"^(?P\d+)/save_text_component_entry/(?P\d+)$", + save_text_component_entry, + ), ] diff --git a/apps/pain/__init__.py b/apps/pain/__init__.py index c5f1df65..e69de29b 100644 --- a/apps/pain/__init__.py +++ b/apps/pain/__init__.py @@ -1,16 +0,0 @@ -""" -Copyright (c) Small Brain Records 2014-2018 Kevin Perdue, James Ryan with contributors Timothy Clemens and Dinh Ngoc Anh - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see -""" diff --git a/apps/pain/admin.py b/apps/pain/admin.py index a25b67d0..f257db1b 100644 --- a/apps/pain/admin.py +++ b/apps/pain/admin.py @@ -15,10 +15,9 @@ along with this program. If not, see """ from django.contrib import admin +from pain.models import PainAvatar from reversion.admin import VersionAdmin -from models import PainAvatar - class PainAvatarAdmin(VersionAdmin): pass diff --git a/apps/pain/migrations/0001_initial.py b/apps/pain/migrations/0001_initial.py index 212a3944..d10145e4 100644 --- a/apps/pain/migrations/0001_initial.py +++ b/apps/pain/migrations/0001_initial.py @@ -18,7 +18,7 @@ from __future__ import unicode_literals from django.conf import settings -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -33,7 +33,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('datetime', models.DateTimeField(auto_now_add=True)), ('json', models.TextField()), - ('patient', models.ForeignKey(to=settings.AUTH_USER_MODEL)), + ('patient', models.ForeignKey(to=settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING)), ], ), ] diff --git a/apps/pain/models.py b/apps/pain/models.py index 69459fb0..36a1f7f8 100644 --- a/apps/pain/models.py +++ b/apps/pain/models.py @@ -21,12 +21,12 @@ class PainAvatar(models.Model): - patient = models.ForeignKey(User) + patient = models.ForeignKey(User, on_delete=models.DO_NOTHING) datetime = models.DateTimeField(auto_now_add=True) json = models.TextField() def __unicode__(self): - return '%s %s' % (self.patient.username, self.datetime) + return f'{self.patient.username} {self.datetime}' def generate_dict(self): @@ -40,3 +40,6 @@ def generate_dict(self): obj_dict['json'] = json.loads(self.json) return obj_dict + + class Meta: + app_label = "foundation" diff --git a/apps/pain/views.py b/apps/pain/views.py index e712663e..8f875bdc 100644 --- a/apps/pain/views.py +++ b/apps/pain/views.py @@ -15,11 +15,10 @@ along with this program. If not, see """ -from django.contrib.auth.decorators import login_required -from django.shortcuts import render_to_response - from common.views import * -from models import PainAvatar +from django.contrib.auth.decorators import login_required +from django.shortcuts import render +from pain.models import PainAvatar @timeit @@ -27,7 +26,7 @@ def create_pain_avatar(request, patient_id): if request.POST: pain_avatar = PainAvatar.objects.create(patient_id=patient_id, json=request.POST['json']) content = {'patient_id': patient_id} - return render_to_response('pain/create_pain_avatar.html', content) + return render(None, 'pain/create_pain_avatar.html', content) @login_required @@ -40,14 +39,14 @@ def add_pain_avatar(request, patient_id): return ajax_response(resp) content = {'patient_id': patient_id} - return render_to_response('pain/add_pain_avatar.html', content) + return render(None, 'pain/add_pain_avatar.html', content) @login_required @timeit def view_pain_avatars(request): content = {'pain_avatars': PainAvatar.objects.all().order_by('-datetime')} - return render_to_response('pain/view_pain_avatars.html', content) + return render(None, 'pain/view_pain_avatars.html', content) @login_required diff --git a/apps/problems_app/urls.py b/apps/problems_app/urls.py index df7ec4db..9ce9622d 100644 --- a/apps/problems_app/urls.py +++ b/apps/problems_app/urls.py @@ -14,68 +14,102 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see """ -from django.conf.urls import url - +from django.urls import re_path from problems_app.views import * urlpatterns = [ - url(r'^problem/(?P\d+)/info$', get_problem_info), - url(r'^problem/(?P\d+)/(?P\d+)/activity/$', get_problem_activity), - url(r'^problem/(?P\d+)/track/click/$', track_problem_click), - url(r'^patient/(?P\d+)/problems/add/new_problem$', add_patient_problem), - url(r'^patient/(?P\d+)/problems/add/new_common_problem$', add_patient_common_problem), - url(r'^problem/(?P\d+)/delete$', delete_problem), - url(r'^problem/(?P\d+)/change_name$', change_name), - url(r'^problem/(?P\d+)/update_status$', update_problem_status), - url(r'^problem/(?P\d+)/update_start_date$', update_start_date), - url(r'^problem/(?P\d+)/add_wiki_note$', add_wiki_note), - url(r'^problem/(?P\d+)/add_history_note$', add_history_note), - url(r'^problem/(?P\d+)/add_goal$', add_problem_goal), - url(r'^problem/(?P\d+)/add_todo$', add_problem_todo), - url(r'^problem/(?P\d+)/upload_image$', upload_problem_image), - url(r'^problem/(?P\d+)/image/(?P\d+)/delete/$', delete_problem_image), - url(r'^problem/(?P\d+)/a1c$', get_a1c), - url(r'^problem/(?P\d+)/colon_cancers$', get_colon_cancers), - url(r'^problem/relate/$', relate_problem), - url(r'^problem/updateOrder/$', update_order), - url(r'^problem/update_by_ptw/$', update_by_ptw), - url(r'^problem/update_state_to_ptw/$', update_state_to_ptw), - url(r'^problem/newLabel/(?P\d+)$', new_problem_label), - url(r'^problem/(?P\d+)/(?P\d+)/getlabels$', get_problem_labels), - url(r'^problem/saveEditLabel/(?P\d+)/(?P\d+)/(?P\d+)$', - save_edit_problem_label), - url(r'^problem/(?P\d+)/(?P\d+)/addLabel$', add_problem_label), - url(r'^problem/removeLabel/(?P\d+)/(?P\d+)$', remove_problem_label), - url(r'^problem/deleteLabel/(?P\d+)$', delete_problem_label), - url(r'^problem/(?P\d+)/(?P\d+)/new_list$', add_problem_list), - url(r'^problem/(?P\d+)/deleteProblemList$', delete_problem_list), - url(r'^problem/(?P\d+)/renameProblemList$', rename_problem_list), - url(r'^problem/(?P\d+)/update_problem_list_note$', update_problem_list_note), - url(r'^problem/(?P\d+)/(?P\d+)/getLabeledProblemLists$', - get_label_problem_lists), - url(r'^problem/(?P\d+)/getproblems$', get_problems), - url(r'^problem/(?P\d+)/(?P\d+)/get_sharing_problems$', - get_sharing_problems), - url( - r'^problem/(?P\d+)/(?P\d+)/(?P\d+)/remove_sharing_problems$', - remove_sharing_problems), - url( - r'^problem/(?P\d+)/(?P\d+)/(?P\d+)/add_sharing_problems$', - add_sharing_problems), - url(r'^problem/staff/(?P\d+)/add_new_common_problem$', add_new_common_problem), - url(r'^problem/staff/(?P\d+)/get_common_problems$', get_common_problems), - url(r'^problem/remove_common_problem/(?P\d+)$', remove_common_problem), - url(r'^problem/(?P\d+)/get_data_pins$', get_data_pins), - url(r'^problem/(?P\d+)/get_medication_pins$', get_medication_pins), - + re_path(r"^problem/(?P\d+)/info$", get_problem_info), + re_path( + r"^problem/(?P\d+)/(?P\d+)/activity/$", + get_problem_activity, + ), + re_path(r"^problem/(?P\d+)/track/click/$", track_problem_click), + re_path( + r"^patient/(?P\d+)/problems/add/new_problem$", add_patient_problem + ), + re_path( + r"^patient/(?P\d+)/problems/add/new_common_problem$", + add_patient_common_problem, + ), + re_path(r"^problem/(?P\d+)/delete$", delete_problem), + re_path(r"^problem/(?P\d+)/change_name$", change_name), + re_path(r"^problem/(?P\d+)/update_status$", update_problem_status), + re_path(r"^problem/(?P\d+)/update_start_date$", update_start_date), + re_path(r"^problem/(?P\d+)/add_wiki_note$", add_wiki_note), + re_path(r"^problem/(?P\d+)/add_history_note$", add_history_note), + re_path(r"^problem/(?P\d+)/add_goal$", add_problem_goal), + re_path(r"^problem/(?P\d+)/add_todo$", add_problem_todo), + re_path(r"^problem/(?P\d+)/upload_image$", upload_problem_image), + re_path( + r"^problem/(?P\d+)/image/(?P\d+)/delete/$", + delete_problem_image, + ), + re_path(r"^problem/(?P\d+)/a1c$", get_a1c), + re_path(r"^problem/(?P\d+)/colon_cancers$", get_colon_cancers), + re_path(r"^problem/relate/$", relate_problem), + re_path(r"^problem/updateOrder/$", update_order), + re_path(r"^problem/update_by_ptw/$", update_by_ptw), + re_path(r"^problem/update_state_to_ptw/$", update_state_to_ptw), + re_path(r"^problem/newLabel/(?P\d+)$", new_problem_label), + re_path( + r"^problem/(?P\d+)/(?P\d+)/getlabels$", get_problem_labels + ), + re_path( + r"^problem/saveEditLabel/(?P\d+)/(?P\d+)/(?P\d+)$", + save_edit_problem_label, + ), + re_path( + r"^problem/(?P\d+)/(?P\d+)/addLabel$", add_problem_label + ), + re_path( + r"^problem/removeLabel/(?P\d+)/(?P\d+)$", + remove_problem_label, + ), + re_path(r"^problem/deleteLabel/(?P\d+)$", delete_problem_label), + re_path( + r"^problem/(?P\d+)/(?P\d+)/new_list$", add_problem_list + ), + re_path(r"^problem/(?P\d+)/deleteProblemList$", delete_problem_list), + re_path(r"^problem/(?P\d+)/renameProblemList$", rename_problem_list), + re_path( + r"^problem/(?P\d+)/update_problem_list_note$", update_problem_list_note + ), + re_path( + r"^problem/(?P\d+)/(?P\d+)/getLabeledProblemLists$", + get_label_problem_lists, + ), + re_path(r"^problem/(?P\d+)/getproblems$", get_problems), + re_path( + r"^problem/(?P\d+)/(?P\d+)/get_sharing_problems$", + get_sharing_problems, + ), + re_path( + r"^problem/(?P\d+)/(?P\d+)/(?P\d+)/remove_sharing_problems$", + remove_sharing_problems, + ), + re_path( + r"^problem/(?P\d+)/(?P\d+)/(?P\d+)/add_sharing_problems$", + add_sharing_problems, + ), + re_path( + r"^problem/staff/(?P\d+)/add_new_common_problem$", + add_new_common_problem, + ), + re_path( + r"^problem/staff/(?P\d+)/get_common_problems$", get_common_problems + ), + re_path( + r"^problem/remove_common_problem/(?P\d+)$", remove_common_problem + ), + re_path(r"^problem/(?P\d+)/get_data_pins$", get_data_pins), + re_path(r"^problem/(?P\d+)/get_medication_pins$", get_medication_pins), # API used for optimize problem loading page AND more semantics URLs/RESTFUL - url(r'^problem/(?P\d+)/todos$', get_problem_todos), - url(r'^problem/(?P\d+)/wikis$', get_problem_wikis), - url(r'^problem/(?P\d+)/goals$', get_problem_goals), - url(r'^problem/(?P\d+)/images$', get_problem_images), - url(r'^problem/(?P\d+)/relationships', get_problem_relationships), - url(r'^problem/(?P\d+)/encounters$', get_related_encounters), - url(r'^problem/(?P\d+)/documents$', get_related_documents), - - url(r'^problem/(?P\d+)/notes$', problem_notes_function), + re_path(r"^problem/(?P\d+)/todos$", get_problem_todos), + re_path(r"^problem/(?P\d+)/wikis$", get_problem_wikis), + re_path(r"^problem/(?P\d+)/goals$", get_problem_goals), + re_path(r"^problem/(?P\d+)/images$", get_problem_images), + re_path(r"^problem/(?P\d+)/relationships", get_problem_relationships), + re_path(r"^problem/(?P\d+)/encounters$", get_related_encounters), + re_path(r"^problem/(?P\d+)/documents$", get_related_documents), + re_path(r"^problem/(?P\d+)/notes$", problem_notes_function), ] diff --git a/apps/problems_app/views.py b/apps/problems_app/views.py index 0c2432f0..be9400cc 100644 --- a/apps/problems_app/views.py +++ b/apps/problems_app/views.py @@ -19,7 +19,6 @@ from dateutil import parser from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User - from document_app.serializers import DocumentSerializer from encounters_app.serializers import EncounterSerializer @@ -31,35 +30,67 @@ import operator -from django.db.models import Max, Prefetch, Q -from django.shortcuts import get_object_or_404 -from rest_framework.decorators import api_view - from a1c_app.serializers import AOneCSerializer from colons_app.serializers import ColonCancerScreeningSerializer from common.views import * -from data_app.serializers import ObservationPinToProblemSerializer, ObservationSerializer -from emr.models import ColonCancerScreening, Observation, ObservationUnit, ObservationComponent, TaggedToDoOrder, \ - PatientController -from emr.models import Encounter -from emr.models import Goal, ToDo, PatientImage, Label -from emr.models import MedicationPinToProblem -from emr.models import ProblemNote, ProblemActivity, CommonProblem -from emr.models import ProblemRelationship -from emr.models import SharingPatient, PhysicianTeam, AOneC, ObservationPinToProblem -from emr.models import UserProfile, Problem, ProblemOrder, ProblemLabel, LabeledProblemList +from data_app.serializers import ( + ObservationPinToProblemSerializer, + ObservationSerializer, +) +from django.db.models import Max, Prefetch, Q +from django.shortcuts import get_object_or_404 +from emr.models import ( + AOneC, + ColonCancerScreening, + CommonProblem, + Encounter, + Goal, + Label, + LabeledProblemList, + MedicationPinToProblem, + Observation, + ObservationComponent, + ObservationPinToProblem, + ObservationUnit, + PatientController, + PatientImage, + PhysicianTeam, + Problem, + ProblemActivity, + ProblemLabel, + ProblemNote, + ProblemOrder, + ProblemRelationship, + SharingPatient, + TaggedToDoOrder, + ToDo, + UserProfile, +) from emr.operations import op_add_event, op_add_todo_event from goals_app.serializers import GoalSerializer from medication_app.serializers import MedicationPinToProblemSerializer -from problems_app.operations import add_problem_activity, check_problem_access, get_available_widget +from problems_app.operations import ( + add_problem_activity, + check_problem_access, + get_available_widget, +) from problems_app.services import ProblemService +from rest_framework.decorators import api_view from todo_app.operations import add_todo_activity from todo_app.serializers import TodoSerializer from users_app.serializers import UserProfileSerializer -from .serializers import ProblemNoteSerializer, ProblemActivitySerializer, CommonProblemSerializer, \ - PatientImageSerializer, ProblemTodoSerializer -from .serializers import ProblemSerializer, ProblemLabelSerializer, \ - LabeledProblemListSerializer, ProblemInfoSerializer + +from .serializers import ( + CommonProblemSerializer, + LabeledProblemListSerializer, + PatientImageSerializer, + ProblemActivitySerializer, + ProblemInfoSerializer, + ProblemLabelSerializer, + ProblemNoteSerializer, + ProblemSerializer, + ProblemTodoSerializer, +) @login_required @@ -876,7 +907,7 @@ def add_problem_list(request, patient_id, user_id): @login_required -@timeit +# @timeit def get_label_problem_lists(request, patient_id, user_id): resp = {'success': False} diff --git a/apps/project_admin_app/urls.py b/apps/project_admin_app/urls.py index 87a23db6..3a4a8195 100644 --- a/apps/project_admin_app/urls.py +++ b/apps/project_admin_app/urls.py @@ -14,45 +14,56 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see """ -from django.conf.urls import url - +from django.urls import re_path from project_admin_app.views import * urlpatterns = [ - - url(r'^$', home, name='pa_home'), - - url(r'^list/registered/users/$', list_registered_users, name='pa_list_registered_users'), - - url(r'^list/unregistered/users/$', list_unregistered_users, name='pa_list_unregistered_users'), - - url(r'^user/(?P\d+)/info/$', user_info, name='pa_user_info'), - - url(r'^user/approve/$', approve_user, name='pa_approve_user'), - - url(r'^user/reject/$', reject_user, name='pa_reject_user'), - - url(r'^user/update/profile/$', update_profile, name='pa_update_profile'), - - url(r'^user/update/basic/$', update_basic_profile, name='pa_update_basic_profile'), - - url(r'^user/update/email/$', update_email, name='pa_update_email'), - - url(r'^user/update/password/$', update_password, name='pa_update_password'), - - url(r'^user/update/active/$', update_active, name='pa_update_active'), - - url(r'^user/update/deceased_date/$', update_deceased_date, name='pa_update_deceased_date'), - - url(r'^user/create/$', create_user, name='pa_create_user'), - - url(r'^patient/physicians/$', list_patient_physicians, name='pa_list_patient_physicians'), - - url(r'^assigned/physicians/$', list_assigned_physicians, name='pa_list_assigned_physicians'), - - url(r'^physician/data/$', fetch_physician_data, name='pa_fetch_physician_data'), - - url(r'^physician/assign/member/$', assign_physician_member, name='pa_assign_physician_member'), - - url(r'^physician/unassign/member/$', unassign_physician_member, name='pa_unassign_physician_member') + re_path(r"^$", home, name="pa_home"), + re_path( + r"^list/registered/users/$", + list_registered_users, + name="pa_list_registered_users", + ), + re_path( + r"^list/unregistered/users/$", + list_unregistered_users, + name="pa_list_unregistered_users", + ), + re_path(r"^user/(?P\d+)/info/$", user_info, name="pa_user_info"), + re_path(r"^user/approve/$", approve_user, name="pa_approve_user"), + re_path(r"^user/reject/$", reject_user, name="pa_reject_user"), + re_path(r"^user/update/profile/$", update_profile, name="pa_update_profile"), + re_path( + r"^user/update/basic/$", update_basic_profile, name="pa_update_basic_profile" + ), + re_path(r"^user/update/email/$", update_email, name="pa_update_email"), + re_path(r"^user/update/password/$", update_password, name="pa_update_password"), + re_path(r"^user/update/active/$", update_active, name="pa_update_active"), + re_path( + r"^user/update/deceased_date/$", + update_deceased_date, + name="pa_update_deceased_date", + ), + re_path(r"^user/create/$", create_user, name="pa_create_user"), + re_path( + r"^patient/physicians/$", + list_patient_physicians, + name="pa_list_patient_physicians", + ), + re_path( + r"^assigned/physicians/$", + list_assigned_physicians, + name="pa_list_assigned_physicians", + ), + re_path(r"^physician/data/$", fetch_physician_data, name="pa_fetch_physician_data"), + re_path( + r"^physician/assign/member/$", + assign_physician_member, + name="pa_assign_physician_member", + ), + re_path( + r"^physician/unassign/member/$", + unassign_physician_member, + name="pa_unassign_physician_member", + ), ] diff --git a/apps/project_admin_app/views.py b/apps/project_admin_app/views.py index 6f14991c..355d3b78 100644 --- a/apps/project_admin_app/views.py +++ b/apps/project_admin_app/views.py @@ -16,19 +16,24 @@ """ import logging +from common.views import * from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.db.models import Q from django.shortcuts import render - -from common.views import * -from emr.models import PatientController, PhysicianTeam -from emr.models import UserProfile +from emr.models import PatientController, PhysicianTeam, UserProfile from users_app.serializers import UserProfileSerializer -from .forms import CreateUserForm, AssignPhysicianMemberForm -from .forms import UpdateActiveForm, UpdateDeceasedDateForm -from .forms import UpdateEmailForm, UpdatePasswordForm -from .forms import UpdateProfileForm, UpdateBasicProfileForm + +from .forms import ( + AssignPhysicianMemberForm, + CreateUserForm, + UpdateActiveForm, + UpdateBasicProfileForm, + UpdateDeceasedDateForm, + UpdateEmailForm, + UpdatePasswordForm, + UpdateProfileForm, +) @login_required @@ -57,7 +62,7 @@ def list_registered_users(request): if actor_profile.role == 'physician': controlled_patients = PatientController.objects.filter(physician=actor) - patients_ids = [long(x.patient.id) for x in controlled_patients] + patients_ids = [int(x.patient.id) for x in controlled_patients] user_profiles = UserProfile.objects.filter(user__id__in=patients_ids) if actor_profile.role == 'admin': @@ -107,7 +112,7 @@ def approve_user(request): role = request.POST.get('role') try: - user = User.objects.get(id=long(user_id)) + user = User.objects.get(id=int(user_id)) except User.DoesNotExist: user = None @@ -137,7 +142,7 @@ def reject_user(request): user_id = request.POST.get('id') try: - user = User.objects.get(id=long(user_id)) + user = User.objects.get(id=int(user_id)) except User.DoesNotExist: user = None @@ -397,7 +402,7 @@ def list_patient_physicians(request): patient = User.objects.get(id=patient_id) controllers = PatientController.objects.filter(patient=patient) - physician_ids = [long(x.physician.id) for x in controllers] + physician_ids = [int(x.physician.id) for x in controllers] physicians = UserProfile.objects.filter(user__id__in=physician_ids) physicians_list = UserProfileSerializer(physicians, many=True).data @@ -419,7 +424,7 @@ def fetch_physician_data(request): physician = User.objects.get(id=physician_id) team_members = PhysicianTeam.objects.filter(physician=physician) - user_ids = [long(x.member.id) for x in team_members] + user_ids = [int(x.member.id) for x in team_members] user_profiles = UserProfile.objects.all().exclude( Q(role='physician') | Q(role='patient')) @@ -449,7 +454,7 @@ def fetch_physician_data(request): secretaries_list.append(profile_dict) patients = PatientController.objects.filter(physician=physician) - patient_ids = [long(x.patient.id) for x in patients] + patient_ids = [int(x.patient.id) for x in patients] patient_profiles = UserProfile.objects.filter(user__id__in=patient_ids).filter(user__is_active=True) patient_profiles_dict = UserProfileSerializer( diff --git a/apps/todo_app/custom_serializers.py b/apps/todo_app/custom_serializers.py new file mode 100644 index 00000000..5e56dfc1 --- /dev/null +++ b/apps/todo_app/custom_serializers.py @@ -0,0 +1,156 @@ + + +from collections import OrderedDict +import logging + + +def serialize_todo_patient(row_data, cursor_description): + row_dict = OrderedDict(zip([col[0] for col in cursor_description], row_data)) + patient_dict = { + "id": row_dict["patient_id"], + "first_name": row_dict["first_name"], + "last_name": row_dict["last_name"], + "username": row_dict["username"], + "email": row_dict["email"], + "profile": { + "id": row_dict["patient_id"], + "user": row_dict["patient_id"], + "role": "patient" + }, + "is_active": bool(row_dict["is_active"]), + } + return patient_dict + + +def serialize_todo(row_data, cursor_description): + row_dict = OrderedDict(zip([col[0] for col in cursor_description], row_data)) + if row_dict.get("due_date"): + due_date = row_dict["due_date"].strftime("%m/%d/%Y, %H:%M:%S") + if row_dict.get("created_on"): + created_on = row_dict["created_on"].strftime("%m/%d/%Y, %H:%M:%S") + + todo_dict = { + "id": row_dict["patient_id"], + "patient": {}, + "user": row_dict["user_id"], + "problem": row_dict["problem_id"], + "todo": row_dict["todo"], + "accomplished": bool(row_dict["accomplished"]), + "due_date": due_date if row_dict.get("due_date") else "", + "labels": [], + "comments": [], + "attachments": [], + "members": [], + "document_set": [], + "a1c": row_dict["a1c_id"], + "colon_cancer": row_dict["colon_cancer_id"], + "created_at": row_dict["created_at"], + "created_on": created_on if row_dict.get("created_on") else "", + } + + return OrderedDict(todo_dict) + + +def serialize_todo_label(row_data): + todo_label_author = { + "id": row_data["author_id"], + "first_name": row_data["author_first_name"], + "last_name": row_data["author_last_name"], + "username": row_data["author_username"], + "email": row_data["author_email"], + "profile": { + "id": row_data["author_id"], + "user": row_data["author_id"], + "role": row_data["author_role"], + }, + "is_active": row_data["author_is_active"], + } + + todo_label_dict = { + "id": row_data["id"], + "name": row_data["name"], + "css_class": row_data["css_class"], + "author": OrderedDict(todo_label_author), + } + + return OrderedDict(todo_label_dict) + + +def serialize_todo_attachment(row_data): + todo_attachment_user = { + "id": row_data["user_id"], + "first_name": row_data["first_name"], + "last_name": row_data["last_name"], + "username": row_data["username"], + "email": row_data["email"], + "profile": { + "id": row_data["user_id"], + "user": row_data["user_id"], + "role": row_data["role"], + }, + "is_active": row_data["is_active"], + } + if row_data.get("datetime"): + datetime = row_data["datetime"].strftime("%m/%d/%Y, %H:%M:%S") + + attachment_split = row_data["attachment"].split("/") + filename = attachment_split[-1] + filename_split = filename.split(".") + filename_ext = filename_split[-1] + image_extensions = ['jpg', 'png', 'jpeg'] + + todo_attachment_dict = { + "id": row_data["attachment_id"], + "user": OrderedDict(todo_attachment_user), + "attachment": row_data["attachment"], + "datetime": datetime if row_data.get("datetime") else "", + "filename": filename, + "is_image": bool(filename_ext in image_extensions) + } + + return OrderedDict(todo_attachment_dict) + + +def serialize_todo_comments(row_data): + todo_comment_user = { + "id": row_data["user_id"], + "first_name": row_data["first_name"], + "last_name": row_data["last_name"], + "username": row_data["username"], + "email": row_data["email"], + "profile": { + "id": row_data["user_id"], + "user": row_data["user_id"], + "role": row_data["role"], + }, + "is_active": row_data["is_active"], + } + if row_data.get("datetime"): + datetime = row_data["datetime"].strftime("%m/%d/%Y, %H:%M:%S") + + todo_attachment_dict = { + "id": row_data["comment_id"], + "user": OrderedDict(todo_comment_user), + "comment": row_data["comment"], + "datetime": datetime if row_data.get("datetime") else "", + } + + return OrderedDict(todo_attachment_dict) + + +def serialize_todo_member(row_data): + todo_comment_user = { + "id": row_data["user_id"], + "first_name": row_data["first_name"], + "last_name": row_data["last_name"], + "username": row_data["username"], + "email": row_data["email"], + "profile": { + "id": row_data["user_id"], + "user": row_data["user_id"], + "role": row_data["role"], + }, + "is_active": row_data["is_active"], + } + + return OrderedDict(todo_comment_user) \ No newline at end of file diff --git a/apps/todo_app/todo_list.py b/apps/todo_app/todo_list.py new file mode 100644 index 00000000..fddc8c9a --- /dev/null +++ b/apps/todo_app/todo_list.py @@ -0,0 +1,208 @@ +from collections import OrderedDict +from django.db import connection +import logging + +from apps.todo_app import custom_serializers +from apps.todo_app.todo_problems import operations as prob_operations + + +def get_todo_list_from_label(label_ids): + with connection.cursor() as cursor: + cursor.execute( + """ + SELECT + et.*, + au.* + FROM + emr_todo et + JOIN emr_todo_labels etl ON + et.id = etl.todo_id + JOIN auth_user au ON + au.id = et.patient_id + JOIN emr_label el ON + el.id = etl.label_id + WHERE + el.id IN %s; + """, [label_ids]) + + todo_results = [] + for row in cursor.fetchall(): + todo_dict = custom_serializers.serialize_todo(row, cursor.description) + todo_dict["patient"] = custom_serializers.serialize_todo_patient( + row, cursor.description + ) + + if todo_dict["problem"]: + problem_dict = prob_operations.get_todo_problem(todo_dict["problem"]) + todo_dict["problem"] = problem_dict + + todo_dict["labels"] = get_todo_labels(todo_dict["id"]) + todo_dict["attachments"] = get_todo_attachments(todo_dict["id"]) + todo_dict["comments"] = get_todo_attachments(todo_dict["id"]) + todo_dict["members"] = get_todo_members(todo_dict["id"]) + + todo_results.append(todo_dict) + + cursor.close() + + return todo_results + + + +def get_todo_labels(todo_id): + + with connection.cursor() as todo_label_cursor: + + todo_label_cursor.execute( + """ + SELECT el.id, + el.name, + el.css_class, + el.is_all, + au.id as author_id, + au.first_name as author_first_name, + au.last_name as author_last_name, + au.username as author_username, + au.email as author_email, + eu.role as author_role, + au.is_active as author_is_active + FROM emr_todo_labels etl + JOIN emr_label el ON + etl.label_id = el.id + JOIN auth_user au ON + el.author_id = au.id + JOIN emr_userprofile eu on + au.id = eu.id + WHERE todo_id = %s; + """, [todo_id]) + + todo_labels = [] + todo_labels_results = todo_label_cursor.fetchall() + + if todo_labels_results: + for row in todo_labels_results: + row_data = OrderedDict( + zip([col[0] for col in todo_label_cursor.description], row) + ) + + todo_labels.append(custom_serializers.serialize_todo_label( + row_data + )) + + todo_label_cursor.close() + + return todo_labels + + +def get_todo_attachments(todo_id): + with connection.cursor() as todo_attachment_cursor: + + todo_attachment_cursor.execute( + """ + SELECT eat.id as attachment_id, + au.id as user_id, + au.first_name, + au.last_name, + au.username, + au.email, + eu.role, + au.is_active, + eat.attachment, + eat.datetime + FROM emr_todoattachment eat + JOIN auth_user au ON + eat.user_id = au.id + JOIN emr_userprofile eu ON + au.id = eu.id + WHERE todo_id = %s; + """, [todo_id]) + + todo_attachments = [] + todo_attachments_results = todo_attachment_cursor.fetchall() + + if todo_attachments_results: + for row in todo_attachments_results: + row_data = OrderedDict( + zip([col[0] for col in todo_attachment_cursor.description], row) + ) + + todo_attachments.append(custom_serializers.serialize_todo_attachment( + row_data + )) + + todo_attachment_cursor.close() + + return todo_attachments + + +def get_todo_comments(todo_id): + with connection.cursor() as todo_comments_cursor: + todo_comments_cursor.execute( + """ + SELECT et.id as comment_id, + et.comment, + et.datetime, + au.id as user_id, + au.first_name, + au.last_name, + au.username, + au.email, + eu.role, + au.is_active + FROM emr_todocomment et + JOIN auth_user au ON + et.user_id = au.id + JOIN emr_userprofile eu ON + au.id = eu.id + WHERE todo_id = %s; + """, [todo_id]) + + todo_comments = [] + todo_comments_results = todo_comments_cursor.fetchall() + + if todo_comments_results: + for row in todo_comments_results: + row_data = OrderedDict( + zip([col[0] for col in todo_comments_cursor.description], row) + ) + + todo_comments.append(custom_serializers.serialize_todo_comments( + row_data + )) + + todo_comments_cursor.close() + + return todo_comments + + +def get_todo_members(todo_id): + with connection.cursor() as todo_members_cursor: + todo_members_cursor.execute( + """ + SELECT * + FROM emr_taggedtodoorder et + JOIN auth_user au ON + et.user_id = au.id + JOIN emr_userprofile eu ON + au.id = eu.id + WHERE todo_id = %s; + """, [todo_id]) + + todo_members = [] + todo_members_results = todo_members_cursor.fetchall() + + if todo_members_results: + for row in todo_members_results: + row_data = OrderedDict( + zip([col[0] for col in todo_members_cursor.description], row) + ) + + todo_members.append(custom_serializers.serialize_todo_member( + row_data + )) + + todo_members_cursor.close() + + return todo_members + + \ No newline at end of file diff --git a/apps/todo_app/todo_problems/operations.py b/apps/todo_app/todo_problems/operations.py new file mode 100644 index 00000000..6bcbec71 --- /dev/null +++ b/apps/todo_app/todo_problems/operations.py @@ -0,0 +1,125 @@ +from collections import OrderedDict +from django.db import connection +import logging +from apps.todo_app.todo_problems import serializers as problem_serializer + +def get_todo_problem(problem_id): + problem_dict = {} + with connection.cursor() as problem_cursor: + problem_cursor.execute( + """ + SELECT ep.* + FROM emr_problem ep + WHERE id = %s; + """, [problem_id]) + + for row in problem_cursor.fetchall(): + row_data = OrderedDict( + zip([col[0] for col in problem_cursor.description], row) + ) + problem_dict = problem_serializer.serialize_todo_problem(row_data) + + # problem_cursor.execute( + # """ + # SELECT * + # FROM emr_problemsegment ep + # WHERE problem_id = %s; + # """, [problem_id]) + + # problem_segments = [] + # problem_seg_results = problem_cursor.fetchall() + + # if problem_seg_results: + # for row in problem_seg_results: + # row_data = OrderedDict( + # zip([col[0] for col in problem_cursor.description], row) + # ) + + # problem_segments.append(problem_serializer.serialize_todo_problem_segment( + # row_data + # )) + + # problem_dict["problem_segment"] = problem_segments + + problem_cursor.execute( + """ + SELECT ep.*, + au.first_name as author_first_name, + au.last_name as author_last_name, + au.username as author_username, + au.email as author_email, + eu.role as author_role, + au.is_active as author_is_active, + pat.first_name as patient_first_name, + pat.last_name as patient_last_name, + pat.username as patient_user_name, + pat.email as patient_email, + pp.role as patient_role, + pat.is_active as patient_is_active + FROM emr_problem_labels epl + JOIN emr_problemlabel ep on + epl.problemlabel_id = ep.id + JOIN auth_user au on + ep.author_id = au.id + JOIN emr_userprofile eu on + au.id = eu.id + JOIN auth_user pat on + ep.patient_id = pat.id + JOIN emr_userprofile pp on + pat.id = pp.id + WHERE problem_id = %s; + """, [problem_id]) + + problem_labels = [] + for row in problem_cursor.fetchall(): + row_data = OrderedDict( + zip([col[0] for col in problem_cursor.description], row) + ) + + problem_labels.append(problem_serializer.serialize_todo_problem_label( + row_data + )) + + problem_dict["labels"] = problem_labels + problem_cursor.close() + + # need to understand what's being done here + # with connection.cursor() as problem_effected_cursor: + # problem_effected_cursor.execute( + # """ + # SELECT epr.source_id + # FROM emr_problemrelationship epr + # WHERE target_id = %s; + # """, [problem_id]) + + # problem_effected_result = problem_effected_cursor.fetchall() + # problem_effected_list = [] + # if problem_effected_result: + # for row in problem_seg_results: + # problem_effected_list.append(row[0]) + # # problem_dict["effected"] = problem_effected_list + + # problem_effected_cursor.close() + + # with connection.cursor() as problem_effecting_cursor: + # problem_effecting_cursor.execute( + # """ + # SELECT epr.target_id + # FROM emr_problemrelationship epr + # WHERE source_id = %s; + # """, [problem_id]) + + # problem_effecting_result = problem_effecting_cursor.fetchall() + # problem_effecting_list = [] + # if problem_effecting_result: + # for row in problem_seg_results: + # problem_effecting_list.append(row[0]) + # # problem_dict["effecting"] = problem_effecting_list + + # problem_effecting_cursor.close() + + return problem_dict + + + + \ No newline at end of file diff --git a/apps/todo_app/todo_problems/serializers.py b/apps/todo_app/todo_problems/serializers.py new file mode 100644 index 00000000..845f5410 --- /dev/null +++ b/apps/todo_app/todo_problems/serializers.py @@ -0,0 +1,80 @@ + + +from collections import OrderedDict +import logging + + +def serialize_todo_problem(problem_row_data): + problem_dict = { + "id": problem_row_data["id"], + "problem_segment": [], + "patient": problem_row_data["patient_id"], + "parent": problem_row_data["parent_id"], + "labels": [], + "problem_name": problem_row_data["problem_name"], + "old_problem_name": problem_row_data["old_problem_name"], + "concept_id": problem_row_data["concept_id"], + "is_controlled": bool(problem_row_data["is_controlled"]), + "is_active": bool(problem_row_data["is_active"]), + "authenticated": bool(problem_row_data["authenticated"]), + "start_time": problem_row_data["start_date"].strftime("%H:%M:%S"), + "start_date": problem_row_data["start_date"].strftime("%m/%d/%Y"), + "effected": [], + "effecting": [] + } + return OrderedDict(problem_dict) + + +def serialize_todo_problem_segment(row_data): + problem_segment_dict = { + "id": row_data["id"], + "problem": row_data["problem_id"], + "is_controlled": bool(row_data["is_controlled"]), + "is_active": bool(row_data["is_active"]), + "authenticated": bool(row_data["authenticated"]), + "event_id": row_data["event_id"], + "start_time": row_data["start_date"].strftime("%H:%M:%S"), + "start_date": row_data["start_date"].strftime("%m/%d/%Y"), + } + + return OrderedDict(problem_segment_dict) + + +def serialize_todo_problem_label(row_data): + problem_label_author = { + "id": row_data["author_id"], + "first_name": row_data["author_first_name"], + "last_name": row_data["author_last_name"], + "username": row_data["author_username"], + "email": row_data["author_email"], + "profile": { + "id": row_data["author_id"], + "user": row_data["author_id"], + "role": row_data["author_role"], + }, + "is_active": row_data["author_is_active"], + } + + problem_label_patient = { + "id": row_data["author_id"], + "first_name": row_data["author_first_name"], + "last_name": row_data["author_last_name"], + "username": row_data["author_username"], + "email": row_data["author_email"], + "profile": { + "id": row_data["author_id"], + "user": row_data["author_id"], + "role": row_data["author_role"], + }, + "is_active": row_data["author_is_active"], + } + + problem_label_dict = { + "id": row_data["id"], + "name": row_data["name"], + "css_class": row_data["css_class"], + "author": OrderedDict(problem_label_author), + "patient": OrderedDict(problem_label_patient), + } + + return OrderedDict(problem_label_dict) \ No newline at end of file diff --git a/apps/todo_app/urls.py b/apps/todo_app/urls.py index 8b534db1..40f9ed43 100644 --- a/apps/todo_app/urls.py +++ b/apps/todo_app/urls.py @@ -15,42 +15,42 @@ along with this program. If not, see """ -from django.conf.urls import url - +from django.urls import re_path from todo_app.views import * urlpatterns = [ - url(r'^patient/(?P\d+)/todos/add/new_todo$', add_patient_todo), - - url(r'^staff/(?P\d+)/todos/add/new_todo$', add_staff_todo), - url(r'^staff/(?P\d+)/new_list$', add_staff_todo_list), - url(r'^staff/all_todos/(?P\d+)$', staff_all_todos), - - url(r'^todo/(?P\d+)/update/$', update_todo_status), - url(r'^todo/updateOrder/$', update_order), - url(r'^todo/(?P\d+)/info/$', get_todo_info), - url(r'^todo/(?P\d+)/comment$', add_todo_comment), - url(r'^todo/(?P\d+)/edit$', edit_todo_comment), - url(r'^todo/(?P\d+)/delete$', delete_todo_comment), - url(r'^todo/(?P\d+)/changeText$', change_todo_text), - url(r'^todo/(?P\d+)/changeDueDate$', change_todo_due_date), - url(r'^todo/(?P\d+)/(?P\d+)/addLabel$', add_todo_label), - url(r'^todo/removeLabel/(?P\d+)/(?P\d+)$', remove_todo_label), - url(r'^todo/deleteLabel/(?P\d+)$', delete_label), - url(r'^todo/newLabel/(?P\d+)$', new_todo_label), - url(r'^todo/accessEncounter/(?P\d+)$', todo_access_encounter), - url(r'^todo/(?P\d+)/addAttachment$', add_todo_attachment), - url(r'^todo/(?P\d+)/(?P\d+)/activity/$', get_todo_activity), - url(r'^todo/(?P\d+)/addMember$', add_todo_member), - url(r'^todo/(?P\d+)/removeMember$', remove_todo_member), - url(r'^todo/(?P\d+)/getlabels$', get_labels), - url(r'^todo/(?P\d+)/getLabeledTodoList$', get_user_label_lists), - url(r'^todo/saveEditLabel/(?P\d+)$', save_edit_label), - url(r'^todo/user_todos/(?P\d+)$', get_user_todos), - url(r'^todo/(?P\d+)/deleteTodoList$', delete_todo_list), - url(r'^todo/(?P\d+)/open_todo_list$', open_todo_list), - - url(r'^attachment/(?P\d+)/downloadAttachment$', download_attachment), - url(r'^attachment/(?P\d+)/delete$', delete_attachment), - url(r'^activities$', batch_save_activities), + re_path(r"^patient/(?P\d+)/todos/add/new_todo$", add_patient_todo), + re_path(r"^staff/(?P\d+)/todos/add/new_todo$", add_staff_todo), + re_path(r"^staff/(?P\d+)/new_list$", add_staff_todo_list), + re_path(r"^staff/all_todos/(?P\d+)$", staff_all_todos), + re_path(r"^todo/(?P\d+)/update/$", update_todo_status), + re_path(r"^todo/updateOrder/$", update_order), + re_path(r"^todo/(?P\d+)/info/$", get_todo_info), + re_path(r"^todo/(?P\d+)/comment$", add_todo_comment), + re_path(r"^todo/(?P\d+)/edit$", edit_todo_comment), + re_path(r"^todo/(?P\d+)/delete$", delete_todo_comment), + re_path(r"^todo/(?P\d+)/changeText$", change_todo_text), + re_path(r"^todo/(?P\d+)/changeDueDate$", change_todo_due_date), + re_path(r"^todo/(?P\d+)/(?P\d+)/addLabel$", add_todo_label), + re_path( + r"^todo/removeLabel/(?P\d+)/(?P\d+)$", remove_todo_label + ), + re_path(r"^todo/deleteLabel/(?P\d+)$", delete_label), + re_path(r"^todo/newLabel/(?P\d+)$", new_todo_label), + re_path(r"^todo/accessEncounter/(?P\d+)$", todo_access_encounter), + re_path(r"^todo/(?P\d+)/addAttachment$", add_todo_attachment), + re_path(r"^todo/(?P\d+)/(?P\d+)/activity/$", get_todo_activity), + re_path(r"^todo/(?P\d+)/addMember$", add_todo_member), + re_path(r"^todo/(?P\d+)/removeMember$", remove_todo_member), + re_path(r"^todo/(?P\d+)/getlabels$", get_labels), + re_path(r"^todo/(?P\d+)/getLabeledTodoList$", get_user_label_lists), + re_path(r"^todo/saveEditLabel/(?P\d+)$", save_edit_label), + re_path(r"^todo/user_todos/(?P\d+)$", get_user_todos), + re_path(r"^todo/(?P\d+)/deleteTodoList$", delete_todo_list), + re_path(r"^todo/(?P\d+)/open_todo_list$", open_todo_list), + re_path( + r"^attachment/(?P\d+)/downloadAttachment$", download_attachment + ), + re_path(r"^attachment/(?P\d+)/delete$", delete_attachment), + re_path(r"^activities$", batch_save_activities), ] diff --git a/apps/todo_app/views.py b/apps/todo_app/views.py index d5c85c98..51c1ff3f 100644 --- a/apps/todo_app/views.py +++ b/apps/todo_app/views.py @@ -15,13 +15,16 @@ along with this program. If not, see """ +from collections import OrderedDict from wsgiref.util import FileWrapper from dateutil import parser from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.db.models import Max, Q +from django.db import connection from rest_framework.decorators import api_view +from apps.todo_app import todo_list from common.views import * from document_app.serializers import * @@ -32,7 +35,7 @@ from todo_app.operations import * from users_app.serializers import SafeUserSerializer, UserProfileSerializer from .serializers import ToDoCommentSerializer, TodoActivitySerializer, LabeledToDoListSerializer - +import logging @login_required @timeit @@ -745,7 +748,7 @@ def get_user_label_lists(request, user_id): resp = {} lists = LabeledToDoList.objects.filter(user_id=user_id).all() - + # Loaded admin labeled to do list for all user admin_labeled_todo_list = LabeledToDoList.objects.filter(user__profile__role='admin', private=0).all() @@ -754,9 +757,12 @@ def get_user_label_lists(request, user_id): physician_ids = [x.physician.id for x in physicians] physician_labeled_todo_list = LabeledToDoList.objects.filter(user_id__in=physician_ids).filter(private=0).all() + merged_list = list(lists) + list(admin_labeled_todo_list) + list(physician_labeled_todo_list) lists_holder = [] + for label_list in merged_list: + list_dict = LabeledToDoListSerializer(label_list).data # TODO: Have to simplify the below logic, after understand what is being done here. @@ -772,13 +778,15 @@ def get_user_label_lists(request, user_id): todos.append(todo) else: - todos = ToDo.objects.filter(labels__id__in=label_ids).distinct().order_by('due_date') + todo_results = todo_list.get_todo_list_from_label(label_ids) - list_dict['todos'] = TodoSerializer(todos, many=True).data + list_dict['todos'] = todo_results list_dict['expanded'] = label_list.expanded + lists_holder.append(list_dict) resp['todo_lists'] = lists_holder + return ajax_response(resp) diff --git a/apps/users_app/urls.py b/apps/users_app/urls.py index fa304070..8e6053ba 100644 --- a/apps/users_app/urls.py +++ b/apps/users_app/urls.py @@ -15,55 +15,55 @@ along with this program. If not, see """ -from django.conf.urls import url - +# from django.conf.urls import url +from django.urls import re_path from users_app.views import * urlpatterns = [ - url(r'^login/$', login_user), - url(r'^logout/$', logout_user), - url(r'^register/$', register_user), - url(r'^home/$', home), - url(r'^staff/$', staff), - url(r'^staff/search$', staff_search, name="staff_search"), - url(r'^patient/manage/(?P\d+)/search$', search, name="search"), - url(r'^patient/manage/(?P\d+)/$', manage_patient), - url(r'^patient/(?P\d+)/info$', get_patient_info), - url(r'^patient/(?P\d+)/timelineinfo$', get_timeline_info), - url(r'^patient/(?P\d+)/patient_todos_info$', get_patient_todos_info), - url(r'^user_info/(?P\d+)/info/$', user_info), - url(r'^patient/(?P\d+)/profile/update_summary$', update_patient_summary), - url(r'^patient/(?P\d+)/profile/update_password$', update_patient_password), - url(r'^patient/(?P\d+)/update/basic$', update_basic_profile), - url(r'^patient/(?P\d+)/update/profile$', update_profile), - url(r'^patient/(?P\d+)/update/email$', update_patient_email), - url(r'^active/user/$', fetch_active_user), - url(r'^members/(?P\d+)/getlist/$', get_patient_members), - url(r'^patients/$', get_patients_list), - url(r'^patient/add_sharing_patient/(?P\d+)/(?P\d+)$', + re_path(r'^login/$', login_user), + re_path(r'^logout/$', logout_user), + re_path(r'^register/$', register_user), + re_path(r'^home/$', home), + re_path(r'^staff/$', staff), + re_path(r'^staff/search$', staff_search, name="staff_search"), + re_path(r'^patient/manage/(?P\d+)/search$', search, name="search"), + re_path(r'^patient/manage/(?P\d+)/$', manage_patient), + re_path(r'^patient/(?P\d+)/info$', get_patient_info), + re_path(r'^patient/(?P\d+)/timelineinfo$', get_timeline_info), + re_path(r'^patient/(?P\d+)/patient_todos_info$', get_patient_todos_info), + re_path(r'^user_info/(?P\d+)/info/$', user_info), + re_path(r'^patient/(?P\d+)/profile/update_summary$', update_patient_summary), + re_path(r'^patient/(?P\d+)/profile/update_password$', update_patient_password), + re_path(r'^patient/(?P\d+)/update/basic$', update_basic_profile), + re_path(r'^patient/(?P\d+)/update/profile$', update_profile), + re_path(r'^patient/(?P\d+)/update/email$', update_patient_email), + re_path(r'^active/user/$', fetch_active_user), + re_path(r'^members/(?P\d+)/getlist/$', get_patient_members), + re_path(r'^patients/$', get_patients_list), + re_path(r'^patient/add_sharing_patient/(?P\d+)/(?P\d+)$', add_sharing_patient), - url(r'^patient/remove_sharing_patient/(?P\d+)/(?P\d+)$', + re_path(r'^patient/remove_sharing_patient/(?P\d+)/(?P\d+)$', remove_sharing_patient), - url(r'^patient/change_sharing_my_story/(?P\d+)/(?P\d+)$', + re_path(r'^patient/change_sharing_my_story/(?P\d+)/(?P\d+)$', change_sharing_my_story), - url(r'^sharing_patients/(?P\d+)$', get_sharing_patients), - url(r'^patient/(?P\d+)/profile/update_note$', update_patient_note), - url(r'^todos_physicians/(?P\d+)$', get_todos_physicians), - url(r'^(?P\d+)/profile/last_access_tagged_todo$', update_last_access_tagged_todo), - url(r'^setting$', get_general_setting), - url(r'^update_setting$', update_general_setting), + re_path(r'^sharing_patients/(?P\d+)$', get_sharing_patients), + re_path(r'^patient/(?P\d+)/profile/update_note$', update_patient_note), + re_path(r'^todos_physicians/(?P\d+)$', get_todos_physicians), + re_path(r'^(?P\d+)/profile/last_access_tagged_todo$', update_last_access_tagged_todo), + re_path(r'^setting$', get_general_setting), + re_path(r'^update_setting$', update_general_setting), # URL for API patterns - url(r'^users/(?P\d+)/problems$', get_user_problem), - url(r'^users/(?P\d+)/todos$', get_user_todo), - url(r'^users/(?P\d+)/vitals$', get_user_vitals), - url(r'^users/(?P\d+)/medicare$', set_user_medicare), - url(r'^users/(?P\d+)/cover$', cover), + re_path(r'^users/(?P\d+)/problems$', get_user_problem), + re_path(r'^users/(?P\d+)/todos$', get_user_todo), + re_path(r'^users/(?P\d+)/vitals$', get_user_vitals), + re_path(r'^users/(?P\d+)/medicare$', set_user_medicare), + re_path(r'^users/(?P\d+)/cover$', cover), # GET most recent encounter - url(r'^users/(?P\d+)/encounters$', get_most_recent_encounter), + re_path(r'^users/(?P\d+)/encounters$', get_most_recent_encounter), - url(r'^users/(?P\d+)/add_narratives$', add_narratives), - url(r'^users/(?P\d+)/narratives$', get_user_narratives), - url(r'^users/(?P\d+)/get_all_narratives$', get_all_narratives), + re_path(r'^users/(?P\d+)/add_narratives$', add_narratives), + re_path(r'^users/(?P\d+)/narratives$', get_user_narratives), + re_path(r'^users/(?P\d+)/get_all_narratives$', get_all_narratives), ] diff --git a/apps/users_app/views.py b/apps/users_app/views.py index 49219bc0..81ef80e6 100644 --- a/apps/users_app/views.py +++ b/apps/users_app/views.py @@ -21,8 +21,7 @@ from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.db.models import Q -from django.shortcuts import render, render_to_response - +from django.shortcuts import render from users_app.operations import get_vitals_table_component try: @@ -30,32 +29,55 @@ except ImportError: import Image import ImageOps -import operator -from rest_framework.decorators import api_view -from common.views import * -from emr.models import UserProfile, Problem, Medication, MEDICATION_BLEEDING_RISK, GeneralSetting, \ - Document, ObservationValue, Narrative, VWTopPatients -from emr.models import Goal, ToDo -from emr.models import Encounter, EncounterEvent, EncounterProblemRecord -from emr.models import PhysicianTeam, PatientController, ProblemOrder, ProblemActivity -from emr.models import SharingPatient, CommonProblem -from emr.models import ProblemNote -from emr.models import MyStoryTab, MyStoryTextComponent +import datetime +import operator -from problems_app.serializers import ProblemSerializer, CommonProblemSerializer +from common.views import * +from emr.manage_patient_permissions import ROLE_PERMISSIONS, check_access +from emr.models import ( + MEDICATION_BLEEDING_RISK, + CommonProblem, + Document, + Encounter, + EncounterEvent, + EncounterProblemRecord, + GeneralSetting, + Goal, + Medication, + MyStoryTab, + MyStoryTextComponent, + Narrative, + ObservationValue, + PatientController, + PhysicianTeam, + Problem, + ProblemActivity, + ProblemNote, + ProblemOrder, + SharingPatient, + ToDo, + UserProfile, + VWTopPatients, +) +from encounters_app.serializers import EncounterEventSerializer, EncounterSerializer from goals_app.serializers import GoalSerializer -from .serializers import UserProfileSerializer, NarrativeSerializer, TopPatientSerializer +from problems_app.serializers import CommonProblemSerializer, ProblemSerializer +from rest_framework.decorators import api_view from todo_app.serializers import TodoSerializer -from encounters_app.serializers import EncounterSerializer, EncounterEventSerializer - -from .forms import LoginForm, RegisterForm, UpdateBasicProfileForm, UpdateProfileForm, UpdateEmailForm - -import datetime - -from emr.manage_patient_permissions import ROLE_PERMISSIONS -from emr.manage_patient_permissions import check_access +from .forms import ( + LoginForm, + RegisterForm, + UpdateBasicProfileForm, + UpdateEmailForm, + UpdateProfileForm, +) +from .serializers import ( + NarrativeSerializer, + TopPatientSerializer, + UserProfileSerializer, +) @timeit @@ -817,7 +839,8 @@ def search(request, user_id): context['patient_profile'] = patient_profile # context = RequestContext(request, context) - return render_to_response("patient-search.html", context) + return render(request, "patient-search.html", context) + # return render_to_response("patient-search.html", context) @login_required @@ -878,7 +901,8 @@ def staff_search(request): context['user_profile'] = user_profile # context = RequestContext(request, context) - return render_to_response("staff-search.html", context) + return render(request, "staff-search.html", context) + # return render_to_response("staff-search.html", context) @login_required diff --git a/init.sh b/init.sh new file mode 100644 index 00000000..9ba33064 --- /dev/null +++ b/init.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +gunicorn --workers=3 --worker-class=gevent --worker-connections=1000 project.wsgi:application -D +nginx -g "daemon off;" \ No newline at end of file diff --git a/manage.py b/manage.py index 82cfa83a..373f9415 100644 --- a/manage.py +++ b/manage.py @@ -2,8 +2,11 @@ import os import sys +from django import conf + if __name__ == "__main__": - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings") + # os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings") + os.environ["DJANGO_SETTINGS_MODULE"] = "project.settings" from django.core.management import execute_from_command_line diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 00000000..c23e2a33 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,18 @@ +error_log /dev/stdout info; +access_log /dev/stdout; + +server { + listen 80; + # server_name _; + + location / { + + proxy_pass http://127.0.0.1:8000; + proxy_redirect off; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Host $server_name; + + } +} \ No newline at end of file diff --git a/project/__init__.py b/project/__init__.py deleted file mode 100644 index c57accae..00000000 --- a/project/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -Copyright (c) Small Brain Records 2014-2018 Kevin Perdue, James Ryan with contributors Timothy Clemens and Dinh Ngoc Anh - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see -""" \ No newline at end of file diff --git a/project/local_settings.py b/project/local_settings.py deleted file mode 100644 index f063e085..00000000 --- a/project/local_settings.py +++ /dev/null @@ -1,44 +0,0 @@ -import os - -BASE_DIR = os.getcwd() - - - -PROBLEMS_PATH = os.path.join(BASE_DIR, 'static/js/problems') - - -COMPRESS_ENABLED = False - - -SNOMEDCT = { - 'snomedct': { - 'ssl': {'key':'/path/to/key','cert':'/path/to/cert','ca':'/path/to/ca'}, - 'host':'host', - 'user':'user', - 'passwd':'passwd', - 'db':'snomedct', - } -} - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': 'NAME', # Or path to database file if using sqlite3. - 'USER': 'USER', # Not used with sqlite3. - 'PASSWORD': 'PASSWORD', # Not used with sqlite3. - 'HOST': 'HOST', # Set to empty string for localhost. Not used with sqlite3. - 'PORT': 'PORT', # Set to empty string for default. Not used with sqlite3. - 'OPTIONS': {'ssl':{'key':'/path/to/key','cert':'/path/to/cert','ca':'/path/to/ca'}}, - } - } - -# DATABASES = { -# 'default': { -# 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. -# 'NAME': 'sbtest', # Or path to database file if using sqlite3. -# 'USER': 'root', # Not used with sqlite3. -# 'PASSWORD': 'Volatile0', # Not used with sqlite3. -# 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. -# 'PORT': '', # Set to empty string for default. Not used with sqlite3. -# } -# } diff --git a/project/local_settings.py.template b/project/local_settings.py.template deleted file mode 100644 index 81f8a497..00000000 --- a/project/local_settings.py.template +++ /dev/null @@ -1,77 +0,0 @@ -import os - -BASE_DIR = os.getcwd() - -ALLOWED_HOSTS = [ - '###.###.##.###', # IP address format - 'example.com', # Domain name format -] - -PROBLEMS_PATH = os.path.join(BASE_DIR, 'static/js/problems') - -ADMINS = ( - ('someadmin', 'someadmin@example.com'), ('anotheradmin', 'anotheradmin@example.com'), -) - -MANAGERS = ADMINS - -SITE_ID = - -# SECRET_KEY -with open('/path/to/secret_key.txt') as f: - SECRET_KEY = f.read().strip() - - -# Consider other options to connect to database(s). For example, Google Cloud Platform's -# Compute Engine allows connecting to SQL via the Cloud SQL Proxy, rather than over IP. - -# MAIN DB PASSWORD -with open('/path/to/db_pass.txt') as f: - db_pass = f.read().strip() - -# SNOMEDCT DB PASSWORD -with open('/path/to/db_snomed_pass.txt') as f: - db_snomed_pass = f.read().strip() - - -SNOMEDCT = { - 'ssl': {'key':'/path/to/key', 'cert':'/path/to/cert', 'ca':'/path/to/ca'}, - 'host':'', - 'user':'', - 'passwd':db_snomed_pass, - 'db':'snomedct', # Change to your SNOMED CT database name -} - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.mysql', - 'NAME': '', # Name of database - 'USER': '', # Create and use an app-specific DB user with minimum necessary privileges - 'PASSWORD': db_pass, - 'HOST': '', # Set to empty string for localhost. - 'PORT': '', # Set to empty string for default. - 'OPTIONS': {'ssl':{'key':'/path/to/key', 'cert':'/path/to/cert', 'ca':'/path/to/ca'}}, - } - } - - - -# Settings for error log reporting by email. Consider the security of the email accounts involved -# in this, especially for production sites. Sensitive information may be contained in the error -# reports that are emailed. - -EMAIL_USE_TLS = True -EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' -EMAIL_HOST = '' # example: 'smtp.gmail.com' -EMAIL_HOST_PASSWORD = '' # example: 'a gmail password' -EMAIL_HOST_USER = '' # example: 'a.gmail.address@gmail.com' -EMAIL_PORT = # example: 587 -DEFAULT_FROM_EMAIL = EMAIL_HOST_USER - - - -RAVEN_CONFIG = { - 'dsn': '', # See Raven Sentry Docs - # If you are using git, you can also automatically configure the - # release based on the git info. -} diff --git a/project/settings.py b/project/settings.py index 4ef4bc55..3c5c4814 100644 --- a/project/settings.py +++ b/project/settings.py @@ -22,17 +22,19 @@ # Django settings for emr project. -DEBUG = False # Never set 'DEBUG = True' in production environment +DEBUG = True # Never set 'DEBUG = True' in production environment COMPRESS_ENABLED = True # toggle experimental features VOICE_CONTROL = False SYNCING = False -os.environ['LANG'] = 'en_US.UTF-8' +SECRET_KEY = "{~9@e\1VKr|zlM&vl5ZJTOqBX#b!Aa1cv;pN!J\H=cL=<48<|7r4s1Z!U" + +os.environ["LANG"] = "en_US.UTF-8" BASE_DIR = os.path.dirname(os.path.dirname(__file__)) -APP_PATH = os.path.join(BASE_DIR, 'apps') +APP_PATH = os.path.join(BASE_DIR, "apps") sys.path.append(APP_PATH) AUTH_PROFILE_MODULE = "account.UserProfile" @@ -41,11 +43,11 @@ # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. # In a Windows environment this must be set to your system time zone. -TIME_ZONE = 'America/Detroit' +TIME_ZONE = "America/Detroit" # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html -LANGUAGE_CODE = 'en-us' +LANGUAGE_CODE = "en-us" # If you set this to False, Django will make some optimizations so as not # to load the internationalization machinery. @@ -60,22 +62,22 @@ # Absolute filesystem path to the directory that will hold user-uploaded files. # Example: "/home/media/media.lawrence.com/media/" -MEDIA_ROOT = os.path.join(BASE_DIR, 'media') +MEDIA_ROOT = os.path.join(BASE_DIR, "media") # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash. # Examples: "http://media.lawrence.com/media/", "http://example.com/media/" -MEDIA_URL = '/media/' +MEDIA_URL = "/media/" # Absolute path to the directory static files should be collected to. # Don't put anything in this directory yourself; store your static files # in apps' "static/" subdirectories and in STATICFILES_DIRS. # Example: "/home/media/media.lawrence.com/static/" -STATIC_ROOT = os.path.join(BASE_DIR, 'static') +STATIC_ROOT = os.path.join(BASE_DIR, "static") # URL prefix for static files. # Example: "http://media.lawrence.com/static/" -STATIC_URL = '/static/' +STATIC_URL = "/static/" # Additional locations of static files STATICFILES_DIRS = ( @@ -94,43 +96,49 @@ 'compressor.finders.CompressorFinder', ) -MIDDLEWARE_CLASSES = ( - 'django.middleware.common.CommonMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'session_security.middleware.SessionSecurityMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'reversion.middleware.RevisionMiddleware', - 'emr.middleware.AccessLogMiddleware', +MIDDLEWARE = ( + "django.middleware.common.CommonMiddleware", + "django.middleware.csrf.CsrfViewMiddleware", + "django.contrib.sessions.middleware.SessionMiddleware", + "django.contrib.auth.middleware.AuthenticationMiddleware", + "session_security.middleware.SessionSecurityMiddleware", + "django.contrib.messages.middleware.MessageMiddleware", + "reversion.middleware.RevisionMiddleware", + "emr.middleware.AccessLogMiddleware", ) -ROOT_URLCONF = 'project.urls' +SILENCED_SYSTEM_CHECKS = [ + "admin.E408", + "admin.E409", + "admin.E410" +] + +ROOT_URLCONF = "project.urls" # Python dotted path to the WSGI application used by Django's runserver. # WSGI_APPLICATION = 'project.wsgi.application' TEMPLATES = [ { - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [os.path.join(BASE_DIR, 'templates')], - 'OPTIONS': { - '' - 'context_processors': [ - 'django.template.context_processors.debug', - 'django.template.context_processors.i18n', - 'django.template.context_processors.media', - 'django.template.context_processors.static', - 'django.template.context_processors.request', - 'django.contrib.auth.context_processors.auth', - 'django.contrib.messages.context_processors.messages', + "BACKEND": "django.template.backends.django.DjangoTemplates", + "DIRS": [os.path.join(BASE_DIR, "templates")], + "OPTIONS": { + "" + "context_processors": [ + "django.template.context_processors.debug", + "django.template.context_processors.i18n", + "django.template.context_processors.media", + "django.template.context_processors.static", + "django.template.context_processors.request", + "django.contrib.auth.context_processors.auth", + "django.contrib.messages.context_processors.messages", ], - 'loaders': [ - 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader', + "loaders": [ + "django.template.loaders.filesystem.Loader", + "django.template.loaders.app_directories.Loader", ], - 'debug': True - } + "debug": True, + }, } ] @@ -149,7 +157,7 @@ 'reversion', 'emr', 'pain', - 'genericadmin', + # 'genericadmin', 'compressor', 'cronjobs', 'session_security', @@ -166,14 +174,14 @@ SESSION_SAVE_EVERY_REQUEST = True SESSION_SECURITY_WARN_AFTER = 1740 SESSION_SECURITY_EXPIRE_AFTER = 1800 -SESSION_SECURITY_PASSIVE_URLS = {} +SESSION_SECURITY_PASSIVE_URLS: dict = {} CSRF_COOKIE_SECURE = True SESSION_COOKIE_SECURE = True -LOGIN_URL = '/u/login/' -LOGIN_REDIRECT_URL = '/' -LOGIN_ERROR_URL = '/login-error/' +LOGIN_URL = "/u/login/" +LOGIN_REDIRECT_URL = "/" +LOGIN_ERROR_URL = "/login-error/" # A sample logging configuration. The only tangible logging # performed by this configuration is to send an email to @@ -181,41 +189,39 @@ # See http://docs.djangoproject.com/en/dev/topics/logging for # more details on how to customize your logging configuration. LOGGING = { - 'version': 1, - 'disable_existing_loggers': False, - 'filters': { - 'require_debug_false': { - '()': 'django.utils.log.RequireDebugFalse' - } - }, - 'handlers': { - 'null': { - 'level': 'DEBUG', - 'class': 'logging.NullHandler', + "version": 1, + "disable_existing_loggers": False, + "filters": {"require_debug_false": {"()": "django.utils.log.RequireDebugFalse"}}, + "handlers": { + "null": { + "level": "DEBUG", + "class": "logging.NullHandler", + }, + "mail_admins": { + "level": "ERROR", + "filters": ["require_debug_false"], + "class": "django.utils.log.AdminEmailHandler", }, - 'mail_admins': { - 'level': 'ERROR', - 'filters': ['require_debug_false'], - 'class': 'django.utils.log.AdminEmailHandler' - } }, - 'loggers': { - 'django.security.DisallowedHost': { - 'handlers': ['null'], - 'propagate': False, + "loggers": { + "django.security.DisallowedHost": { + "handlers": ["null"], + "propagate": False, }, - 'django.request': { - 'handlers': ['mail_admins'], - 'level': 'ERROR', - 'propagate': True, + "django.request": { + "handlers": ["mail_admins"], + "level": "ERROR", + "propagate": True, }, - } + }, } -SNOMEDCT = {} +SNOMEDCT: dict = {} + +ALLOWED_HOSTS = ["localhost", "127.0.0.1"] # ################################################################### -# LOCAL SETTINGS FILE IS USED TO IMPORT SENSITIVE CONFIGURATION INFO. +# LOCAL SETTINGS FILE IS USED TO IMPORT SENSITIVE CONFIGURATION INFO. # MODIFY THE INCLUDED TEMPLATE FOR YOUR OWN PARTICULAR ENVIRONMENT # ################################################################### diff --git a/project/urls.py b/project/urls.py index d0c06ae5..e9f1875b 100644 --- a/project/urls.py +++ b/project/urls.py @@ -15,122 +15,119 @@ along with this program. If not, see """ import django -import session_security -from django import contrib, views from django.conf.urls import include -from django.contrib import auth from django.contrib.auth import views -from django.views import static -from genericadmin.admin import * -from session_security import urls - -import a1c_app -import colons_app -import data_app -import document_app -import emr -import encounters_app -import goals_app -import inr_app -import medication_app -import my_story_app -import pain -import problems_app -import project_admin_app -import settings -import todo_app -import users_app -from a1c_app import urls -from colons_app import urls -from data_app import urls -from document_app import urls -from emr import views -from emr.views import LoginError -from encounters_app import urls -from goals_app import urls -from inr_app import urls -from medication_app import urls -from my_story_app import urls -from pain import views -from problems_app import urls -from project_admin_app import urls -from todo_app import urls -from users_app import urls -from views import home - -admin.autodiscover() +from django.urls import re_path + +from apps.a1c_app import urls as a1c_app_urls +from apps.colons_app import urls as colons_app_urls +from apps.data_app import urls as data_app_urls +from apps.document_app import urls +from apps.document_app import urls as document_app_urls +from apps.emr import views as emr_views +from apps.emr.views import LoginError +from apps.encounters_app import urls as encounters_app_urls +from apps.goals_app import urls as goals_app_urls +from apps.inr_app import urls as inr_app_urls +from apps.medication_app import urls as medication_app_urls +from apps.my_story_app import urls as my_story_app_urls +from apps.pain import views as pain_views +from apps.problems_app import urls as problems_app_urls +from apps.project_admin_app import urls as project_admin_app_urls +from apps.todo_app import urls as todo_app_urls +from apps.users_app import urls as users_app_urls + +# import settings +from project import settings +from project.views import home + +# from genericadmin.admin import * + + + + +# admin.autodiscover() + + urlpatterns = [ - url(r'^$', home,name='project_home'), + re_path(r'^$', home,name='project_home'), - url(r'^admin/', include(admin.site.urls)), + # re_path(r'^admin/', include(admin.site.urls)), - url(r'^project/admin/', include(project_admin_app.urls)), + re_path(r'^project/admin/', include(project_admin_app_urls)), - url(r'^pain/create_pain_avatar/(?P\d+)/$', pain.views.create_pain_avatar), - url(r'^pain/reset/$', pain.views.reset), - url(r'^login-error/$', LoginError.as_view()), + re_path(r'^pain/create_pain_avatar/(?P\d+)/$', pain_views.create_pain_avatar), + re_path(r'^pain/reset/$', pain_views.reset), + re_path(r'^login-error/$', LoginError.as_view()), # Old user views - url(r'^logout/$', django.contrib.auth.views.logout, {'next_page': '/'}), + re_path(r'^logout/$', django.contrib.auth.views.LogoutView.as_view(), {'next_page': '/'}), # Old views - url(r'^list_of_unregistered_users/$', emr.views.list_of_unregistered_users), - url(r'^register_users/$', emr.views.register_users), - url(r'^list_of_users/$', emr.views.list_users), + re_path(r'^list_of_unregistered_users/$', emr_views.list_of_unregistered_users), + re_path(r'^register_users/$', emr_views.register_users), + re_path(r'^list_of_users/$', emr_views.list_users), - url(r'^get_problems/(?P\d+)/$', emr.views.get_patient_data), - url(r'^change_status/$', emr.views.change_status), - url(r'^patient/(?P\d+)/add_problem/$', emr.views.add_problem), - url(r'^add_patient_summary/(?P\d+)/$', emr.views.save_patient_summary), + re_path(r'^get_problems/(?P\d+)/$', emr_views.get_patient_data), + re_path(r'^change_status/$', emr_views.change_status), + re_path(r'^patient/(?P\d+)/add_problem/$', emr_views.add_problem), + re_path(r'^add_patient_summary/(?P\d+)/$', emr_views.save_patient_summary), - url(r'^update/$', emr.views.update), + re_path(r'^update/$', emr_views.update), # New URLS - url(r'^list_terms/$', emr.views.list_snomed_terms), + re_path(r'^list_terms/$', emr_views.list_snomed_terms), # Users - url(r'^u/', include(users_app.urls)), + re_path(r'^u/', include(users_app_urls)), # Problems - url(r'^p/', include(problems_app.urls)), + re_path(r'^p/', include(problems_app_urls)), # Goals - url(r'^g/', include(goals_app.urls)), + re_path(r'^g/', include(goals_app_urls)), # Encounters - url(r'^enc/', include(encounters_app.urls)), + re_path(r'^enc/', include(encounters_app_urls)), # Todos - url(r'^todo/', include(todo_app.urls)), + re_path(r'^todo/', include(todo_app_urls)), # Observations - url(r'^a1c/', include(a1c_app.urls)), + re_path(r'^a1c/', include(a1c_app_urls)), # colon cancer - url(r'^colon_cancer/', include(colons_app.urls)), + re_path(r'^colon_cancer/', include(colons_app_urls)), # my story - url(r'^my_story/', include(my_story_app.urls)), + re_path(r'^my_story/', include(my_story_app_urls)), # data - url(r'^data/', include(data_app.urls)), + re_path(r'^data/', include(data_app_urls)), # inr - url(r'^inr/', include(inr_app.urls)), - url(r'^medication/', include(medication_app.urls)), + re_path(r'^inr/', include(inr_app_urls)), + re_path(r'^medication/', include(medication_app_urls)), # document - url(r'^docs/', include(document_app.urls)), + re_path(r'^docs/', include(document_app_urls)), # Pain Avatars - url(r'^patient/(?P\d+)/pain_avatars$', pain.views.patient_pain_avatars), - url(r'^patient/(?P\d+)/pain/add_pain_avatar$', pain.views.add_pain_avatar), + re_path(r'^patient/(?P\d+)/pain_avatars$', pain_views.patient_pain_avatars), + re_path(r'^patient/(?P\d+)/pain/add_pain_avatar$', pain_views.add_pain_avatar), - url(r'session_security/', include(session_security.urls)), + re_path(r'session_security/', include('session_security.urls')), # MEDIA AND STATIC FILES - url(r'^media/(?P.*)$', emr.views.serve_private_file), - url(r'^static/(?P.*)$', django.views.static.serve, + re_path(r'^media/(?P.*)$', emr_views.serve_private_file), + re_path(r'^static/(?P.*)$', django.views.static.serve, {'document_root': settings.STATIC_ROOT, 'show_indexes': True}) ] + +if settings.DEBUG: + import debug_toolbar + + urlpatterns += [ + re_path(r'^__debug__/', include(debug_toolbar.urls)), + ] \ No newline at end of file diff --git a/project/views.py b/project/views.py index 6e1fb36f..e93fcdf4 100644 --- a/project/views.py +++ b/project/views.py @@ -19,7 +19,7 @@ def home(request): - if not request.user.is_authenticated(): + if not request.user.is_authenticated: return render(request, 'index.html', {}) - elif request.user.is_authenticated(): + elif request.user.is_authenticated: return HttpResponseRedirect('/u/home/') diff --git a/project/foundation.wsgi b/project/wsgi.py similarity index 88% rename from project/foundation.wsgi rename to project/wsgi.py index 63ce36f1..546f1a2d 100755 --- a/project/foundation.wsgi +++ b/project/wsgi.py @@ -11,7 +11,8 @@ framework. """ -import os, sys +import os +import sys # We defer to a DJANGO_SETTINGS_MODULE already in the environment. This breaks # if running multiple sites in the same mod_wsgi process. To fix this, use @@ -28,7 +29,9 @@ sys.path.append(os.path.join(BASE_DIR, 'templates')) -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings") +# os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings") +os.environ["DJANGO_SETTINGS_MODULE"] = "" +os.environ["DJANGO_SETTINGS_MODULE"] = "project.settings" # This application object is used by any WSGI server configured to use this @@ -36,6 +39,7 @@ # setting points here. from django.core.wsgi import get_wsgi_application + application = get_wsgi_application() diff --git a/requirements.txt b/requirements.txt index 45626fe7..38fca2ac 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,46 +1,50 @@ -asgiref==2.3.2 -async-timeout==2.0.1 -attrs==18.2.0 -autobahn==19.1.1 -Automat==0.7.0 -certifi==2019.6.16 -channels==2.1.3 -constantly==15.1.0 -contextlib2==0.5.5 -coverage==4.5.3 -daphne==2.2.5 -Django==1.11.20 -django-appconf==1.0.2 -django-compressor==1.5 -django-cronjobs==0.2.3 -django-crontab==0.7.1 -django-genericadmin==0.7.0 -django-js-asset==1.2.1 -django-mptt==0.9.1 -django-mptt-admin==0.6.0 -django-ranged-response==0.2.0 -django-reversion==3.0.3 -django-session-security==2.6.5 -djangorestframework==3.6.4 -futures==3.2.0 -httplib2==0.12.0 -hyperlink==18.0.0 -idna==2.8 -incremental==17.5.0 -MySQL-python==1.2.5 -oauth2==1.9.0.post1 -pathlib==1.0.1 -Pillow==2.8.1 -PyHamcrest==1.9.0 -python-dateutil==2.8.0 -python-openid==2.2.5 -pytz==2018.9 -raven==6.10.0 -sentry-sdk==0.12.2 -six==1.12.0 -sqlparse==0.3.0 -Twisted==18.9.0 -txaio==18.8.1 -urllib3==1.25.3 -virtualenv==16.4.0 -zope.interface==4.6.0 +asgiref>=2.3.2 +async-timeout>=2.0.1 +attrs>=18.2.0 +autobahn>=19.1.1 +Automat>=0.7.0 +certifi>=2019.6.16 +channels>=2.1.3 +constantly>=15.1.0 +contextlib2>=0.5.5 +coverage>=4.5.3 +daphne>=2.2.5 +Django>=4.2 +django-appconf>=1.0.2 +django-compressor>=1.5 +django-cronjobs>=0.2.3 +django-crontab>=0.7.1 +# django-genericadmin>=0.7.0 +django-js-asset>=1.2.1 +django-mptt>=0.9.1 +django-mptt-admin>=0.6.0 +django-ranged-response>=0.2.0 +django-reversion>=3.0.3 +django-session-security>=2.6.5 +djangorestframework>=3.6.4 +futures +httplib2>=0.12.0 +hyperlink>=18.0.0 +idna>=2.8 +incremental>=17.5.0 +mysqlclient +oauth2>=1.9.0 +pathlib>=1.0.1 +Pillow>=2.8.1 +PyHamcrest>=1.9.0 +PyMySQL==1.1.0 +python-dateutil>=2.8.0 +python-openid>=2.2.5 +pytz>=2018.9 +raven>=6.10.0 +sentry-sdk>=0.14.4 +six>=1.12.0 +sqlparse>=0.3.0 +Twisted>=22.4.0 +txaio>=18.8.1 +urllib3>=1.25.3 +virtualenv>=16.4.0 +zope.interface>=4.6.0 +gunicorn +gevent +django-debug-toolbar \ No newline at end of file diff --git a/static/node_modules/angular-animate/LICENSE.md b/static/node_modules/angular-animate/LICENSE.md deleted file mode 100644 index 2c395eef..00000000 --- a/static/node_modules/angular-animate/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2016 Angular - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/static/node_modules/angular-animate/README.md b/static/node_modules/angular-animate/README.md deleted file mode 100644 index 8313da67..00000000 --- a/static/node_modules/angular-animate/README.md +++ /dev/null @@ -1,68 +0,0 @@ -# packaged angular-animate - -This repo is for distribution on `npm` and `bower`. The source for this module is in the -[main AngularJS repo](https://github.com/angular/angular.js/tree/master/src/ngAnimate). -Please file issues and pull requests against that repo. - -## Install - -You can install this package either with `npm` or with `bower`. - -### npm - -```shell -npm install angular-animate -``` - -Then add `ngAnimate` as a dependency for your app: - -```javascript -angular.module('myApp', [require('angular-animate')]); -``` - -### bower - -```shell -bower install angular-animate -``` - -Then add a ` -``` - -Then add `ngAnimate` as a dependency for your app: - -```javascript -angular.module('myApp', ['ngAnimate']); -``` - -## Documentation - -Documentation is available on the -[AngularJS docs site](http://docs.angularjs.org/api/ngAnimate). - -## License - -The MIT License - -Copyright (c) 2010-2015 Google, Inc. http://angularjs.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/static/node_modules/angular-animate/index.js b/static/node_modules/angular-animate/index.js deleted file mode 100644 index 6ec0a351..00000000 --- a/static/node_modules/angular-animate/index.js +++ /dev/null @@ -1,2 +0,0 @@ -require('./angular-animate'); -module.exports = 'ngAnimate'; diff --git a/static/node_modules/angular-chart.js/.codeclimate.yml b/static/node_modules/angular-chart.js/.codeclimate.yml deleted file mode 100644 index c41c0fa3..00000000 --- a/static/node_modules/angular-chart.js/.codeclimate.yml +++ /dev/null @@ -1,10 +0,0 @@ -languages: - Ruby: false - JavaScript: true - PHP: false -exclude_paths: -- "dist/*" -- "node_modules/*" -- "gulpfile.js" -- "examples/*" -- "test/fixtures/coverage.js" diff --git a/static/node_modules/angular-chart.js/.dockerignore b/static/node_modules/angular-chart.js/.dockerignore deleted file mode 100644 index b509c88b..00000000 --- a/static/node_modules/angular-chart.js/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -coverage/ -node_modules/ diff --git a/static/node_modules/angular-chart.js/.editorconfig b/static/node_modules/angular-chart.js/.editorconfig deleted file mode 100644 index 85653605..00000000 --- a/static/node_modules/angular-chart.js/.editorconfig +++ /dev/null @@ -1,18 +0,0 @@ -# This file is for unifying the coding style for different editors and IDEs -# editorconfig.org - -root = true - -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Tabs in JS unless otherwise specified -[**.js] -indent_style = space -indent_size = 2 - -[*.md] -trim_trailing_whitespace = false \ No newline at end of file diff --git a/static/node_modules/angular-chart.js/.jscsrc b/static/node_modules/angular-chart.js/.jscsrc deleted file mode 100644 index c2c7e3cd..00000000 --- a/static/node_modules/angular-chart.js/.jscsrc +++ /dev/null @@ -1,82 +0,0 @@ -{ - "requireCurlyBraces": [ - "try", - "catch", - "do" - ], - "requireCamelCaseOrUpperCaseIdentifiers": "ignoreProperties", - "requireCapitalizedConstructors": true, - "maximumLineLength": { - "value": 120, - "allowComments": true, - "allowRegex": true - }, - "validateIndentation": 2, - "validateQuoteMarks": "'", - - "disallowMultipleLineStrings": true, - "disallowMixedSpacesAndTabs": true, - "disallowTrailingWhitespace": true, - "disallowQuotedKeysInObjects": true, - "disallowSpaceAfterObjectKeys": true, - - "requireSpaceAfterKeywords": [ - "if", - "else", - "for", - "while", - "do", - "switch", - "return", - "try", - "catch", - "function", - "typeof" - ], - "requireSpaceBeforeBinaryOperators": [ - "=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=", - "&=", "|=", "^=", "+=", - - "+", "-", "*", "/", "%", "<<", ">>", ">>>", "&", - "|", "^", "&&", "||", "===", "==", ">=", - "<=", "<", ">", "!=", "!==" - ], - "requireSpaceAfterPrefixUnaryOperators": [ - "!" - ], - "requireSpacesInConditionalExpression": true, - "requireSpaceBeforeBlockStatements": true, - "requireSpacesInForStatement": true, - "requireLineFeedAtFileEnd": true, - "requireSpacesInFunctionExpression": { - "beforeOpeningCurlyBrace": true, - "beforeOpeningRoundBrace": true - }, - "requireSpacesInFunctionDeclaration": { - "beforeOpeningCurlyBrace": true, - "beforeOpeningRoundBrace": true - }, - "requireDotNotation": true, - "disallowSpacesInsideArrayBrackets": "all", - "disallowSpacesInsideParentheses": true, - - - "validateJSDoc": { - "checkParamNames": true, - "requireParamTypes": true - }, - - "disallowMultipleLineBreaks": true, - "disallowNewlineBeforeBlockStatements": true, - "disallowKeywords": [ "with" ], - - "excludeFiles": [ - "node_modules/**", - "dist/**", - "coverage/**", - "examples/bundle.js", - "examples/commonjs.bundle.js", - "examples/smoothscroll.min.js", - "test/fixtures/coverage.js" - ] -} diff --git a/static/node_modules/angular-chart.js/.jshintignore b/static/node_modules/angular-chart.js/.jshintignore deleted file mode 100644 index 283d79d9..00000000 --- a/static/node_modules/angular-chart.js/.jshintignore +++ /dev/null @@ -1,9 +0,0 @@ -node_modules/ -dist/ -tmp/ -examples/bundle.js -examples/commonjs.bundle.js -examples/smoothscroll.min.js -coverage/ -test/fixtures/coverage.js - diff --git a/static/node_modules/angular-chart.js/.jshintrc b/static/node_modules/angular-chart.js/.jshintrc deleted file mode 100644 index cd570bb7..00000000 --- a/static/node_modules/angular-chart.js/.jshintrc +++ /dev/null @@ -1,24 +0,0 @@ -{ - "strict" : true, // true: Requires all functions run in ES5 Strict Mode - "undef" : true, // true: Require all non-global variables to be declared (prevents global leaks) - "unused" : true, // true: Require all defined variables be used - "noempty" : true, // Prohibit use of empty blocks - "trailing" : true, // Prohibit trailing whitespaces. - "white" : false, // Check against strict whitespace and indentation rules. - "indent" : 2, // {int} Number of spaces to use for indentation - "maxcomplexity" : 10, // {int} Max number for cyclomatic complexity - "maxdepth" : 2, // {int} Max number for nesting blocks - "newcap" : true, // true: Require capitalization of all constructor functions e.g. `new F()` - "quotmark" : "single", // Quotation mark consistency - "-W058" : true, // Missing '()' invoking a constructor - "browser" : true, // Standard browser globals e.g. `window`, `document`. - "predef" : [ // Custom globals. - "angular", - "G_vmlCanvasManager", - "require", - "console", - "Chart", - "define", - "module" - ] -} diff --git a/static/node_modules/angular-chart.js/.node-version b/static/node_modules/angular-chart.js/.node-version deleted file mode 100644 index 9e3a9335..00000000 --- a/static/node_modules/angular-chart.js/.node-version +++ /dev/null @@ -1 +0,0 @@ -4.4.3 diff --git a/static/node_modules/angular-chart.js/.npmignore b/static/node_modules/angular-chart.js/.npmignore deleted file mode 100644 index 0523ae93..00000000 --- a/static/node_modules/angular-chart.js/.npmignore +++ /dev/null @@ -1,7 +0,0 @@ -.idea/ -*.iml -node_modules/ -test/fixtures/shots/ -coverage/ -examples/bundle.js -examples/commonjs.bundle.js diff --git a/static/node_modules/angular-chart.js/.travis.yml b/static/node_modules/angular-chart.js/.travis.yml deleted file mode 100644 index e8a9c962..00000000 --- a/static/node_modules/angular-chart.js/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -sudo: required -services: -- docker -install: -- docker build -t jtblin/angular-chart.js . -script: -- docker run --name angular-chart.js -it -e REPORTER=$REPORTER -e CODECLIMATE_REPO_TOKEN=$CODECLIMATE_REPO_TOKEN -e CI=$CI -e TOLERANCE=$TOLERANCE -e DELAY=$DELAY -e IMGUR_ID=$IMGUR_ID jtblin/angular-chart.js -after_success: -- docker start angular-chart.js -- docker exec -it angular-chart.js npm run codeclimate -after_script: -- docker stop angular-chart.js ||true -- docker rm angular-chart.js -env: - global: - - secure: YWABlINoIkwl9RFLOW9G0lATEP3aiXXi+DS6TWfvQWWG/jkS5sn7IqWC2U67LjwQ0lDg0yevo3ZD7FyYQ5lr8AVuScAZ6P2o2dm9t/HBKGTG4u016dxbWWYVZ8MAlKT7TfjVD8iDzcWyZedsbpuyaNNp4pGr/CNcvq7TGdJLNkU= - - CI=1 - - REPORTER=list - - TOLERANCE=0.001 diff --git a/static/node_modules/angular-chart.js/CONTRIBUTING.md b/static/node_modules/angular-chart.js/CONTRIBUTING.md deleted file mode 100644 index 3f2f6b21..00000000 --- a/static/node_modules/angular-chart.js/CONTRIBUTING.md +++ /dev/null @@ -1,9 +0,0 @@ -### Contributing - -1. Create an issue -1. Fork the repo -1. Install dependencies: `npm install` and `bower install` -1. Make your changes -1. Install [GraphicsMagick](http://www.graphicsmagick.org/) -1. Run linter and tests: `gulp check` -1. Submit pull request diff --git a/static/node_modules/angular-chart.js/Dockerfile b/static/node_modules/angular-chart.js/Dockerfile deleted file mode 100644 index 267c61b1..00000000 --- a/static/node_modules/angular-chart.js/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM jtblin/debian-node-graphicsmagick:stretch-node-v4.4.7-gm-v1.3.24 -WORKDIR /src -ADD . ./ -RUN chown -R node:node /src -USER node -RUN npm install -CMD ["npm", "test"] diff --git a/static/node_modules/angular-chart.js/ISSUE_TEMPLATE.md b/static/node_modules/angular-chart.js/ISSUE_TEMPLATE.md deleted file mode 100644 index 8bc79535..00000000 --- a/static/node_modules/angular-chart.js/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,39 +0,0 @@ - - -### Overview - -Describe the issue. What is the issue and what did you expect? - -Please make sure to review and check all of these items: - -- [ ] Use latest version of the library -- [ ] Make sure you've included all the dependencies e.g Chart.js, angular, etc. -- [ ] Include a repro case, see below. - - -### Step to reproduce - -**Ensure you add a link to a plunker, jsbin, or equivalent. Issues without repro steps may be closed immediately.** - -Here is a [jsbin template for 0.x version](http://jsbin.com/cucoqe/1/edit?html,js,output) and [one for 1.x](http://jsbin.com/rodunob/edit?html,js,output) for convenience. - - diff --git a/static/node_modules/angular-chart.js/LICENSE b/static/node_modules/angular-chart.js/LICENSE deleted file mode 100644 index f3bd7149..00000000 --- a/static/node_modules/angular-chart.js/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) Jerome Touffe-Blin ("Author") -All rights reserved. - -The BSD License - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/static/node_modules/angular-chart.js/PULL_REQUEST_TEMPLATE.md b/static/node_modules/angular-chart.js/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index a6508304..00000000 --- a/static/node_modules/angular-chart.js/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,15 +0,0 @@ - - -### Description of change - - - -### Pull Request check-list - -- [ ] Run `gulp test` to ensure there are no linting, or style issues and all tests pass. -- [ ] Squash your commits into a few commits only. -- [ ] Make sure the commit message is short, concise and descriptive of the issues you're fixing. -- [ ] Avoid mixing up multiple issues and/or features, open one pull request for each issue. -- [ ] Have you updated the documentation and / or examples? -- [ ] Have you included a new test? diff --git a/static/node_modules/angular-chart.js/README.md b/static/node_modules/angular-chart.js/README.md deleted file mode 100644 index fdc9df20..00000000 --- a/static/node_modules/angular-chart.js/README.md +++ /dev/null @@ -1,284 +0,0 @@ -# angular-chart.js - -[![Bower version](https://badge.fury.io/bo/angular-chart.js.svg)](http://badge.fury.io/bo/angular-chart.js) -[![npm version](https://badge.fury.io/js/angular-chart.js.svg)](http://badge.fury.io/js/angular-chart.js) -[![Build Status](https://travis-ci.org/jtblin/angular-chart.js.svg?branch=master)](https://travis-ci.org/jtblin/angular-chart.js) -[![Codacy Badge](https://api.codacy.com/project/badge/grade/6aa5ba92f4984a24874e5976ee541623)](https://www.codacy.com/app/jtblin/angular-chart-js) -[![Code Coverage](https://d3s6mut3hikguw.cloudfront.net/github/jtblin/angular-chart.js/badges/coverage.svg)](https://codeclimate.com/github/jtblin/angular-chart.js) -[![npm](https://img.shields.io/npm/dm/angular-chart.js.svg?maxAge=2592000)](https://www.npmjs.com/package/angular-chart.js) - -Beautiful, reactive, responsive charts for Angular.JS using [Chart.js](http://www.chartjs.org/). - -Have a look at the [demo site](http://jtblin.github.io/angular-chart.js/) to see examples with detailed markup, -script and options. - -# Installation - -This is the `1.x` branch which requires Chart.js 2.x version. Following semantic versioning, -there are numerous **breaking changes** since 0.x, notably: - -* all options now need to use the `chart-` prefix -* `chart-colours` is now `chart-colors` and `chart-get-colour` is now `chart-get-color` -* chart types are in `camelCase` e.g. `line` and `polarArea` -* legend is now a Chart.js option so the `chart-legend` attribute has been removed -* events emitted on creation and update are now prefixed with `chart-` e.g. `chart-create` -* `$scope.$apply` is not called anymore on mouse hover functions calls -* obviously all Chart.js breaking changes as well in how options are set, etc. -* disabling the `responsive` option doesn't work via global `Chart.defaults.global.responsive` anymore, -but must be set via standard options e.g. `ChartJsProvider.setOptions({ responsive: false });` -* factory now returns a module name instead of a module instance - -### npm - - npm install --save angular-chart.js - -### cdn - - //cdn.jsdelivr.net/angular.chartjs/latest/angular-chart.min.js - -### bower - - bower install --save angular-chart.js - -### manually - -or copy the files from `dist/`. - -Then add the sources to your code (adjust paths as needed) after -adding the dependencies for Angular and Chart.js first: - -```html - - ... - - - ... - - - - -``` - -# Utilisation - -There are 8 types of charts so 8 directives: `chart-line`, `chart-bar`, `chart-horizontal-bar`, `chart-radar`, -`chart-pie`, `chart-polar-area`, `chart-doughnut`, `chart-bubble`. - -Here are the options for all directives: - -- `chart-data`: series data -- `chart-labels`: x axis labels (line, bar, horizontal bar, radar, bubble) or series labels (pie, doughnut, polar area) -- `chart-options`: chart options (as from [Chart.js documentation](http://www.chartjs.org/docs/)) -- `chart-series`: (default: `[]`): series labels (line, bar, radar) -- `chart-colors`: data colors (will use default colors if not specified) -- `chart-get-color`: function that returns a color in case there are not enough (will use random colors if not specified) -- `chart-click`: onclick event handler -- `chart-hover`: onmousemove event handler -- `chart-dataset-override`: override individual datasets to allow per dataset configuration e.g. y-axis, mixed type chart - -There is another directive `chart-base` that takes an extra attribute `chart-type` to define the type -dynamically. - -You can create mixed type chart using the `chart-dataset-override`, see -[bar-line example](http://jtblin.github.io/angular-chart.js/examples/dataset-override.html). - -See also [stacked bar example](http://jtblin.github.io/angular-chart.js/examples/stacked-bars.html). - -# Example - -## Markup - -```html - -``` - -## Javascript - -```javascript -angular.module("app", ["chart.js"]) - // Optional configuration - .config(['ChartJsProvider', function (ChartJsProvider) { - // Configure all charts - ChartJsProvider.setOptions({ - chartColors: ['#FF5252', '#FF8A80'], - responsive: false - }); - // Configure all line charts - ChartJsProvider.setOptions('line', { - showLines: false - }); - }]) - .controller("LineCtrl", ['$scope', '$timeout', function ($scope, $timeout) { - - $scope.labels = ["January", "February", "March", "April", "May", "June", "July"]; - $scope.series = ['Series A', 'Series B']; - $scope.data = [ - [65, 59, 80, 81, 56, 55, 40], - [28, 48, 40, 19, 86, 27, 90] - ]; - $scope.onClick = function (points, evt) { - console.log(points, evt); - }; - - // Simulate async data update - $timeout(function () { - $scope.data = [ - [28, 48, 40, 19, 86, 27, 90], - [65, 59, 80, 81, 56, 55, 40] - ]; - }, 3000); -}]); -``` - -## AMD RequireJS - -See [a simple AMD example](examples/amd.js) - -## CommonJS e.g. webpack - -Module should work with CommonJS out of the box e.g. [browserify](http://browserify.org/) or -[webpack](http://webpack.github.io/), see a [webpack example](examples/webpack.commonjs.js). - -# Reactive - -angular-chart.js watch updates on data, series, labels, colors and options and will update, or destroy and recreate, -the chart on changes. - -# Events - -angular-chart.js listens to the following events on the `scope` and acts accordingly: - -* `$destroy`: call `.destroy()` on the chart -* `$resize`: call `.resize()` on the chart - -angular-chart.js emits the following events on the `scope` and pass the chart as argument: - -* `chart-create`: when chart is created -* `chart-update`: when chart is updated -* `chart-destroy`: when chart is destroyed - -``` -$scope.$on('chart-create', function (evt, chart) { - console.log(chart); -}); -``` - -**Note**: the event can be emitted multiple times for each chart as the chart can be destroyed and -created multiple times during angular `watch` lifecycle. - -angular-chart.js listens to the scope `$destroy` event and destroys the chart when it happens. - -# Colors - -There are a set of 7 default colors. Colors can be replaced using the `colors` attribute. -If there is more data than colors, colors are generated randomly or can be provided -via a function through the `getColor` attribute. - -Hex colors are converted to Chart.js colors automatically, -including different shades for highlight, fill, stroke, etc. - -RGB colors may be input by using a string in the format "rgb(r,g,b)". - -## Example - RGB Colors - -``` -angular.module('app',['chart.js']) - .controller('MainController', function($scope){ - $scope.colors = ["rgb(159,204,0)","rgb(250,109,33)","rgb(154,154,154)"]; - $scope.labels = ["Green", "Orange", "Grey"]; - $scope.data = [300, 500, 100]; - }); -``` - -RGBA colors may also be input by using a string in the format "rgba(r,g,b,a)". -They may be used alongside RGB colors and/or Hex colors. - -## Example - RGBA Colors -``` -angular.module('app',['chart.js']) - .controller('MainController', function($scope){ - $scope.colors = ["rgba(159,204,0,0.5)","rgba(250,109,33,0.7)","rgba(154,154,154,0.5)"]; - $scope.labels = ["Green", "Orange", "Grey"]; - $scope.data = [300, 500, 100]; - }); -``` - -Colors may also be input as an object by using the format in the example below. -Colors input as objects, Hex colors, RGB, and RGBA colors may be mixed and matched. - -## Example - input color as an object -``` -angular.module('app',['chart.js']) - .controller('MainController', function($scope){ - $scope.colors = [ - { - backgroundColor: "rgba(159,204,0, 0.2)", - pointBackgroundColor: "rgba(159,204,0, 1)", - pointHoverBackgroundColor: "rgba(159,204,0, 0.8)", - borderColor: "rgba(159,204,0, 1)", - pointBorderColor: '#fff', - pointHoverBorderColor: "rgba(159,204,0, 1)" - },"rgba(250,109,33,0.5)","#9a9a9a","rgb(233,177,69)" - ]; - $scope.labels = ["Green", "Peach", "Grey", "Orange"]; - $scope.data = [300, 500, 100, 150]; - }); -``` - -## Browser compatibility - -For IE8 and older browsers, you will need -to include [excanvas](https://code.google.com/p/explorercanvas/wiki/Instructions). -You will also need a [shim](https://github.com/es-shims/es5-shim) for ES5 functions. - -You also need to have ```height``` and ```width``` attributes for the `````` tag of your chart -if using IE8 and older browsers. If you *do not* have these attributes, you will need a -[getComputedStyle shim](https://github.com/Financial-Times/polyfill-service/blob/master/polyfills/getComputedStyle/polyfill.js) -and the line ```document.defaultView = window;```, but there still may be errors (due to code in Chart.js). - -```html - - - -``` - -# Issues - -**Issues or feature requests for Chart.js (e.g. new chart type, new axis, etc.) need to be opened on -[Chart.js issues tracker](https://github.com/nnnick/Chart.js/issues)** - -**For general questions about usage, please use [http://stackoverflow.com/](http://stackoverflow.com/)** - -Please check if issue exists first, otherwise open issue in [github](https://github.com/jtblin/angular-chart.js/issues). -**Ensure you add a link to a plunker, jsbin, or equivalent.** - -Here is a [jsbin template](http://jsbin.com/rodunob/edit?html,js,output) for convenience. - -# v0.x - Chart.js v1.x - deprecated - -This is the deprecated version of angular-chart.js that uses the v1.x version of Chart.js. -If you want to use this version, please checkout the -[chartjs-1.x branch](https://github.com/jtblin/angular-chart.js/tree/chartjs-1.x) - -# Contributing - -Pull requests welcome! - -See [CONTRIBUTING.md](CONTRIBUTING.md). - -## Contributors - -Thank you to the [contributors](https://github.com/jtblin/angular-chart.js/graphs/contributors)! - -# Author - -Jerome Touffe-Blin, [@jtblin](https://twitter.com/jtblin), [About me](http://about.me/jtblin) - -# License - -angular-chart.js is copyright 2016 Jerome Touffe-Blin and contributors. -It is licensed under the BSD license. See the include LICENSE file for details. diff --git a/static/node_modules/angular-chart.js/angular-chart.js b/static/node_modules/angular-chart.js/angular-chart.js deleted file mode 100644 index 9a3f267a..00000000 --- a/static/node_modules/angular-chart.js/angular-chart.js +++ /dev/null @@ -1,391 +0,0 @@ -(function (factory) { - 'use strict'; - if (typeof exports === 'object') { - // Node/CommonJS - module.exports = factory( - typeof angular !== 'undefined' ? angular : require('angular'), - typeof Chart !== 'undefined' ? Chart : require('chart.js')); - } else if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['angular', 'chart'], factory); - } else { - // Browser globals - if (typeof angular === 'undefined') { - throw new Error('AngularJS framework needs to be included, see https://angularjs.org/'); - } else if (typeof Chart === 'undefined') { - throw new Error('Chart.js library needs to be included, see http://jtblin.github.io/angular-chart.js/'); - } - factory(angular, Chart); - } -}(function (angular, Chart) { - 'use strict'; - - Chart.defaults.global.multiTooltipTemplate = '<%if (datasetLabel){%><%=datasetLabel%>: <%}%><%= value %>'; - Chart.defaults.global.tooltips.mode = 'label'; - Chart.defaults.global.elements.line.borderWidth = 2; - Chart.defaults.global.elements.rectangle.borderWidth = 2; - Chart.defaults.global.legend.display = false; - Chart.defaults.global.colors = [ - '#97BBCD', // blue - '#DCDCDC', // light grey - '#F7464A', // red - '#46BFBD', // green - '#FDB45C', // yellow - '#949FB1', // grey - '#4D5360' // dark grey - ]; - - var useExcanvas = typeof window.G_vmlCanvasManager === 'object' && - window.G_vmlCanvasManager !== null && - typeof window.G_vmlCanvasManager.initElement === 'function'; - - if (useExcanvas) Chart.defaults.global.animation = false; - - return angular.module('chart.js', []) - .provider('ChartJs', ChartJsProvider) - .factory('ChartJsFactory', ['ChartJs', '$timeout', ChartJsFactory]) - .directive('chartBase', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory(); }]) - .directive('chartLine', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('line'); }]) - .directive('chartBar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('bar'); }]) - .directive('chartHorizontalBar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('horizontalBar'); }]) - .directive('chartRadar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('radar'); }]) - .directive('chartDoughnut', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('doughnut'); }]) - .directive('chartPie', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('pie'); }]) - .directive('chartPolarArea', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('polarArea'); }]) - .directive('chartBubble', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('bubble'); }]) - .name; - - /** - * Wrapper for chart.js - * Allows configuring chart js using the provider - * - * angular.module('myModule', ['chart.js']).config(function(ChartJsProvider) { - * ChartJsProvider.setOptions({ responsive: false }); - * ChartJsProvider.setOptions('Line', { responsive: true }); - * }))) - */ - function ChartJsProvider () { - var options = { responsive: true }; - var ChartJs = { - Chart: Chart, - getOptions: function (type) { - var typeOptions = type && options[type] || {}; - return angular.extend({}, options, typeOptions); - } - }; - - /** - * Allow to set global options during configuration - */ - this.setOptions = function (type, customOptions) { - // If no type was specified set option for the global object - if (! customOptions) { - customOptions = type; - options = angular.merge(options, customOptions); - } else { - // Set options for the specific chart - options[type] = angular.merge(options[type] || {}, customOptions); - } - - angular.merge(ChartJs.Chart.defaults, options); - }; - - this.$get = function () { - return ChartJs; - }; - } - - function ChartJsFactory (ChartJs, $timeout) { - return function chart (type) { - return { - restrict: 'CA', - scope: { - chartGetColor: '=?', - chartType: '=', - chartData: '=?', - chartLabels: '=?', - chartOptions: '=?', - chartSeries: '=?', - chartColors: '=?', - chartClick: '=?', - chartHover: '=?', - chartDatasetOverride: '=?' - }, - link: function (scope, elem/*, attrs */) { - if (useExcanvas) window.G_vmlCanvasManager.initElement(elem[0]); - - // Order of setting "watch" matter - scope.$watch('chartData', watchData, true); - scope.$watch('chartSeries', watchOther, true); - scope.$watch('chartLabels', watchOther, true); - scope.$watch('chartOptions', watchOther, true); - scope.$watch('chartColors', watchOther, true); - scope.$watch('chartDatasetOverride', watchOther, true); - scope.$watch('chartType', watchType, false); - - scope.$on('$destroy', function () { - destroyChart(scope); - }); - - scope.$on('$resize', function () { - if (scope.chart) scope.chart.resize(); - }); - - function watchData (newVal, oldVal) { - if (! newVal || ! newVal.length || (Array.isArray(newVal[0]) && ! newVal[0].length)) { - destroyChart(scope); - return; - } - var chartType = type || scope.chartType; - if (! chartType) return; - - if (scope.chart && canUpdateChart(newVal, oldVal)) - return updateChart(newVal, scope); - - createChart(chartType, scope, elem); - } - - function watchOther (newVal, oldVal) { - if (isEmpty(newVal)) return; - if (angular.equals(newVal, oldVal)) return; - var chartType = type || scope.chartType; - if (! chartType) return; - - // chart.update() doesn't work for series and labels - // so we have to re-create the chart entirely - createChart(chartType, scope, elem); - } - - function watchType (newVal, oldVal) { - if (isEmpty(newVal)) return; - if (angular.equals(newVal, oldVal)) return; - createChart(newVal, scope, elem); - } - } - }; - }; - - function createChart (type, scope, elem) { - var options = getChartOptions(type, scope); - if (! hasData(scope) || ! canDisplay(type, scope, elem, options)) return; - - var cvs = elem[0]; - var ctx = cvs.getContext('2d'); - - scope.chartGetColor = getChartColorFn(scope); - var data = getChartData(type, scope); - // Destroy old chart if it exists to avoid ghost charts issue - // https://github.com/jtblin/angular-chart.js/issues/187 - destroyChart(scope); - - scope.chart = new ChartJs.Chart(ctx, { - type: type, - data: data, - options: options - }); - scope.$emit('chart-create', scope.chart); - bindEvents(cvs, scope); - } - - function canUpdateChart (newVal, oldVal) { - if (newVal && oldVal && newVal.length && oldVal.length) { - return Array.isArray(newVal[0]) ? - newVal.length === oldVal.length && newVal.every(function (element, index) { - return element.length === oldVal[index].length; }) : - oldVal.reduce(sum, 0) > 0 ? newVal.length === oldVal.length : false; - } - return false; - } - - function sum (carry, val) { - return carry + val; - } - - function getEventHandler (scope, action, triggerOnlyOnChange) { - var lastState = { - point: void 0, - points: void 0 - }; - return function (evt) { - var atEvent = scope.chart.getElementAtEvent || scope.chart.getPointAtEvent; - var atEvents = scope.chart.getElementsAtEvent || scope.chart.getPointsAtEvent; - if (atEvents) { - var points = atEvents.call(scope.chart, evt); - var point = atEvent ? atEvent.call(scope.chart, evt)[0] : void 0; - - if (triggerOnlyOnChange === false || - (! angular.equals(lastState.points, points) && ! angular.equals(lastState.point, point)) - ) { - lastState.point = point; - lastState.points = points; - scope[action](points, evt, point); - } - } - }; - } - - function getColors (type, scope) { - var colors = angular.copy(scope.chartColors || - ChartJs.getOptions(type).chartColors || - Chart.defaults.global.colors - ); - var notEnoughColors = colors.length < scope.chartData.length; - while (colors.length < scope.chartData.length) { - colors.push(scope.chartGetColor()); - } - // mutate colors in this case as we don't want - // the colors to change on each refresh - if (notEnoughColors) scope.chartColors = colors; - return colors.map(convertColor); - } - - function convertColor (color) { - // Allows RGB and RGBA colors to be input as a string: e.g.: "rgb(159,204,0)", "rgba(159,204,0, 0.5)" - if (typeof color === 'string' && color[0] === 'r') return getColor(rgbStringToRgb(color)); - // Allows hex colors to be input as a string. - if (typeof color === 'string' && color[0] === '#') return getColor(hexToRgb(color.substr(1))); - // Allows colors to be input as an object, bypassing getColor() entirely - if (typeof color === 'object' && color !== null) return color; - return getRandomColor(); - } - - function getRandomColor () { - var color = [getRandomInt(0, 255), getRandomInt(0, 255), getRandomInt(0, 255)]; - return getColor(color); - } - - function getColor (color) { - var alpha = color[3] || 1; - color = color.slice(0, 3); - return { - backgroundColor: rgba(color, 0.2), - pointBackgroundColor: rgba(color, alpha), - pointHoverBackgroundColor: rgba(color, 0.8), - borderColor: rgba(color, alpha), - pointBorderColor: '#fff', - pointHoverBorderColor: rgba(color, alpha) - }; - } - - function getRandomInt (min, max) { - return Math.floor(Math.random() * (max - min + 1)) + min; - } - - function rgba (color, alpha) { - // rgba not supported by IE8 - return useExcanvas ? 'rgb(' + color.join(',') + ')' : 'rgba(' + color.concat(alpha).join(',') + ')'; - } - - // Credit: http://stackoverflow.com/a/11508164/1190235 - function hexToRgb (hex) { - var bigint = parseInt(hex, 16), - r = (bigint >> 16) & 255, - g = (bigint >> 8) & 255, - b = bigint & 255; - - return [r, g, b]; - } - - function rgbStringToRgb (color) { - var match = color.match(/^rgba?\(([\d,.]+)\)$/); - if (! match) throw new Error('Cannot parse rgb value'); - color = match[1].split(','); - return color.map(Number); - } - - function hasData (scope) { - return scope.chartData && scope.chartData.length; - } - - function getChartColorFn (scope) { - return typeof scope.chartGetColor === 'function' ? scope.chartGetColor : getRandomColor; - } - - function getChartData (type, scope) { - var colors = getColors(type, scope); - return Array.isArray(scope.chartData[0]) ? - getDataSets(scope.chartLabels, scope.chartData, scope.chartSeries || [], colors, scope.chartDatasetOverride) : - getData(scope.chartLabels, scope.chartData, colors, scope.chartDatasetOverride); - } - - function getDataSets (labels, data, series, colors, datasetOverride) { - return { - labels: labels, - datasets: data.map(function (item, i) { - var dataset = angular.extend({}, colors[i], { - label: series[i], - data: item - }); - if (datasetOverride && datasetOverride.length >= i) { - angular.merge(dataset, datasetOverride[i]); - } - return dataset; - }) - }; - } - - function getData (labels, data, colors, datasetOverride) { - var dataset = { - labels: labels, - datasets: [{ - data: data, - backgroundColor: colors.map(function (color) { - return color.pointBackgroundColor; - }), - hoverBackgroundColor: colors.map(function (color) { - return color.backgroundColor; - }) - }] - }; - if (datasetOverride) { - angular.merge(dataset.datasets[0], datasetOverride); - } - return dataset; - } - - function getChartOptions (type, scope) { - return angular.extend({}, ChartJs.getOptions(type), scope.chartOptions); - } - - function bindEvents (cvs, scope) { - cvs.onclick = scope.chartClick ? getEventHandler(scope, 'chartClick', false) : angular.noop; - cvs.onmousemove = scope.chartHover ? getEventHandler(scope, 'chartHover', true) : angular.noop; - } - - function updateChart (values, scope) { - if (Array.isArray(scope.chartData[0])) { - scope.chart.data.datasets.forEach(function (dataset, i) { - dataset.data = values[i]; - }); - } else { - scope.chart.data.datasets[0].data = values; - } - - scope.chart.update(); - scope.$emit('chart-update', scope.chart); - } - - function isEmpty (value) { - return ! value || - (Array.isArray(value) && ! value.length) || - (typeof value === 'object' && ! Object.keys(value).length); - } - - function canDisplay (type, scope, elem, options) { - // TODO: check parent? - if (options.responsive && elem[0].clientHeight === 0) { - $timeout(function () { - createChart(type, scope, elem); - }, 50, false); - return false; - } - return true; - } - - function destroyChart(scope) { - if(! scope.chart) return; - scope.chart.destroy(); - scope.$emit('chart-destroy', scope.chart); - } - } -})); diff --git a/static/node_modules/angular-chart.js/bower.json b/static/node_modules/angular-chart.js/bower.json deleted file mode 100644 index c4868566..00000000 --- a/static/node_modules/angular-chart.js/bower.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "angular-chart.js", - "version": "1.1.1", - "main": [ - "./dist/angular-chart.js" - ], - "authors": [ - "Jerome Touffe-Blin " - ], - "repository": { - "type": "git", - "url": "git://github.com/jtblin/angular-chart.js.git" - }, - "description": "An angular.js wrapper for Chart.js - reactive, responsive, beautiful charts.", - "moduleType": [ - "globals" - ], - "keywords": [ - "angular", - "angular.js", - "chartjs", - "chart", - "reactive", - "responsive", - "graph", - "bar", - "line", - "area", - "donut" - ], - "license": "BSD", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "examples", - "test", - "tests" - ], - "dependencies": { - "angular": "1.x", - "chart.js": "2.x" - } -} diff --git a/static/node_modules/angular-chart.js/dist/angular-chart.js b/static/node_modules/angular-chart.js/dist/angular-chart.js deleted file mode 100644 index 3a7d5bc8..00000000 --- a/static/node_modules/angular-chart.js/dist/angular-chart.js +++ /dev/null @@ -1,400 +0,0 @@ -/*! - * angular-chart.js - An angular.js wrapper for Chart.js - * http://jtblin.github.io/angular-chart.js/ - * Version: 1.1.1 - * - * Copyright 2016 Jerome Touffe-Blin - * Released under the BSD-2-Clause license - * https://github.com/jtblin/angular-chart.js/blob/master/LICENSE - */ -(function (factory) { - 'use strict'; - if (typeof exports === 'object') { - // Node/CommonJS - module.exports = factory( - typeof angular !== 'undefined' ? angular : require('angular'), - typeof Chart !== 'undefined' ? Chart : require('chart.js')); - } else if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define(['angular', 'chart'], factory); - } else { - // Browser globals - if (typeof angular === 'undefined') { - throw new Error('AngularJS framework needs to be included, see https://angularjs.org/'); - } else if (typeof Chart === 'undefined') { - throw new Error('Chart.js library needs to be included, see http://jtblin.github.io/angular-chart.js/'); - } - factory(angular, Chart); - } -}(function (angular, Chart) { - 'use strict'; - - Chart.defaults.global.multiTooltipTemplate = '<%if (datasetLabel){%><%=datasetLabel%>: <%}%><%= value %>'; - Chart.defaults.global.tooltips.mode = 'label'; - Chart.defaults.global.elements.line.borderWidth = 2; - Chart.defaults.global.elements.rectangle.borderWidth = 2; - Chart.defaults.global.legend.display = false; - Chart.defaults.global.colors = [ - '#97BBCD', // blue - '#DCDCDC', // light grey - '#F7464A', // red - '#46BFBD', // green - '#FDB45C', // yellow - '#949FB1', // grey - '#4D5360' // dark grey - ]; - - var useExcanvas = typeof window.G_vmlCanvasManager === 'object' && - window.G_vmlCanvasManager !== null && - typeof window.G_vmlCanvasManager.initElement === 'function'; - - if (useExcanvas) Chart.defaults.global.animation = false; - - return angular.module('chart.js', []) - .provider('ChartJs', ChartJsProvider) - .factory('ChartJsFactory', ['ChartJs', '$timeout', ChartJsFactory]) - .directive('chartBase', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory(); }]) - .directive('chartLine', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('line'); }]) - .directive('chartBar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('bar'); }]) - .directive('chartHorizontalBar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('horizontalBar'); }]) - .directive('chartRadar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('radar'); }]) - .directive('chartDoughnut', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('doughnut'); }]) - .directive('chartPie', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('pie'); }]) - .directive('chartPolarArea', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('polarArea'); }]) - .directive('chartBubble', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('bubble'); }]) - .name; - - /** - * Wrapper for chart.js - * Allows configuring chart js using the provider - * - * angular.module('myModule', ['chart.js']).config(function(ChartJsProvider) { - * ChartJsProvider.setOptions({ responsive: false }); - * ChartJsProvider.setOptions('Line', { responsive: true }); - * }))) - */ - function ChartJsProvider () { - var options = { responsive: true }; - var ChartJs = { - Chart: Chart, - getOptions: function (type) { - var typeOptions = type && options[type] || {}; - return angular.extend({}, options, typeOptions); - } - }; - - /** - * Allow to set global options during configuration - */ - this.setOptions = function (type, customOptions) { - // If no type was specified set option for the global object - if (! customOptions) { - customOptions = type; - options = angular.merge(options, customOptions); - } else { - // Set options for the specific chart - options[type] = angular.merge(options[type] || {}, customOptions); - } - - angular.merge(ChartJs.Chart.defaults, options); - }; - - this.$get = function () { - return ChartJs; - }; - } - - function ChartJsFactory (ChartJs, $timeout) { - return function chart (type) { - return { - restrict: 'CA', - scope: { - chartGetColor: '=?', - chartType: '=', - chartData: '=?', - chartLabels: '=?', - chartOptions: '=?', - chartSeries: '=?', - chartColors: '=?', - chartClick: '=?', - chartHover: '=?', - chartDatasetOverride: '=?' - }, - link: function (scope, elem/*, attrs */) { - if (useExcanvas) window.G_vmlCanvasManager.initElement(elem[0]); - - // Order of setting "watch" matter - scope.$watch('chartData', watchData, true); - scope.$watch('chartSeries', watchOther, true); - scope.$watch('chartLabels', watchOther, true); - scope.$watch('chartOptions', watchOther, true); - scope.$watch('chartColors', watchOther, true); - scope.$watch('chartDatasetOverride', watchOther, true); - scope.$watch('chartType', watchType, false); - - scope.$on('$destroy', function () { - destroyChart(scope); - }); - - scope.$on('$resize', function () { - if (scope.chart) scope.chart.resize(); - }); - - function watchData (newVal, oldVal) { - if (! newVal || ! newVal.length || (Array.isArray(newVal[0]) && ! newVal[0].length)) { - destroyChart(scope); - return; - } - var chartType = type || scope.chartType; - if (! chartType) return; - - if (scope.chart && canUpdateChart(newVal, oldVal)) - return updateChart(newVal, scope); - - createChart(chartType, scope, elem); - } - - function watchOther (newVal, oldVal) { - if (isEmpty(newVal)) return; - if (angular.equals(newVal, oldVal)) return; - var chartType = type || scope.chartType; - if (! chartType) return; - - // chart.update() doesn't work for series and labels - // so we have to re-create the chart entirely - createChart(chartType, scope, elem); - } - - function watchType (newVal, oldVal) { - if (isEmpty(newVal)) return; - if (angular.equals(newVal, oldVal)) return; - createChart(newVal, scope, elem); - } - } - }; - }; - - function createChart (type, scope, elem) { - var options = getChartOptions(type, scope); - if (! hasData(scope) || ! canDisplay(type, scope, elem, options)) return; - - var cvs = elem[0]; - var ctx = cvs.getContext('2d'); - - scope.chartGetColor = getChartColorFn(scope); - var data = getChartData(type, scope); - // Destroy old chart if it exists to avoid ghost charts issue - // https://github.com/jtblin/angular-chart.js/issues/187 - destroyChart(scope); - - scope.chart = new ChartJs.Chart(ctx, { - type: type, - data: data, - options: options - }); - scope.$emit('chart-create', scope.chart); - bindEvents(cvs, scope); - } - - function canUpdateChart (newVal, oldVal) { - if (newVal && oldVal && newVal.length && oldVal.length) { - return Array.isArray(newVal[0]) ? - newVal.length === oldVal.length && newVal.every(function (element, index) { - return element.length === oldVal[index].length; }) : - oldVal.reduce(sum, 0) > 0 ? newVal.length === oldVal.length : false; - } - return false; - } - - function sum (carry, val) { - return carry + val; - } - - function getEventHandler (scope, action, triggerOnlyOnChange) { - var lastState = { - point: void 0, - points: void 0 - }; - return function (evt) { - var atEvent = scope.chart.getElementAtEvent || scope.chart.getPointAtEvent; - var atEvents = scope.chart.getElementsAtEvent || scope.chart.getPointsAtEvent; - if (atEvents) { - var points = atEvents.call(scope.chart, evt); - var point = atEvent ? atEvent.call(scope.chart, evt)[0] : void 0; - - if (triggerOnlyOnChange === false || - (! angular.equals(lastState.points, points) && ! angular.equals(lastState.point, point)) - ) { - lastState.point = point; - lastState.points = points; - scope[action](points, evt, point); - } - } - }; - } - - function getColors (type, scope) { - var colors = angular.copy(scope.chartColors || - ChartJs.getOptions(type).chartColors || - Chart.defaults.global.colors - ); - var notEnoughColors = colors.length < scope.chartData.length; - while (colors.length < scope.chartData.length) { - colors.push(scope.chartGetColor()); - } - // mutate colors in this case as we don't want - // the colors to change on each refresh - if (notEnoughColors) scope.chartColors = colors; - return colors.map(convertColor); - } - - function convertColor (color) { - // Allows RGB and RGBA colors to be input as a string: e.g.: "rgb(159,204,0)", "rgba(159,204,0, 0.5)" - if (typeof color === 'string' && color[0] === 'r') return getColor(rgbStringToRgb(color)); - // Allows hex colors to be input as a string. - if (typeof color === 'string' && color[0] === '#') return getColor(hexToRgb(color.substr(1))); - // Allows colors to be input as an object, bypassing getColor() entirely - if (typeof color === 'object' && color !== null) return color; - return getRandomColor(); - } - - function getRandomColor () { - var color = [getRandomInt(0, 255), getRandomInt(0, 255), getRandomInt(0, 255)]; - return getColor(color); - } - - function getColor (color) { - var alpha = color[3] || 1; - color = color.slice(0, 3); - return { - backgroundColor: rgba(color, 0.2), - pointBackgroundColor: rgba(color, alpha), - pointHoverBackgroundColor: rgba(color, 0.8), - borderColor: rgba(color, alpha), - pointBorderColor: '#fff', - pointHoverBorderColor: rgba(color, alpha) - }; - } - - function getRandomInt (min, max) { - return Math.floor(Math.random() * (max - min + 1)) + min; - } - - function rgba (color, alpha) { - // rgba not supported by IE8 - return useExcanvas ? 'rgb(' + color.join(',') + ')' : 'rgba(' + color.concat(alpha).join(',') + ')'; - } - - // Credit: http://stackoverflow.com/a/11508164/1190235 - function hexToRgb (hex) { - var bigint = parseInt(hex, 16), - r = (bigint >> 16) & 255, - g = (bigint >> 8) & 255, - b = bigint & 255; - - return [r, g, b]; - } - - function rgbStringToRgb (color) { - var match = color.match(/^rgba?\(([\d,.]+)\)$/); - if (! match) throw new Error('Cannot parse rgb value'); - color = match[1].split(','); - return color.map(Number); - } - - function hasData (scope) { - return scope.chartData && scope.chartData.length; - } - - function getChartColorFn (scope) { - return typeof scope.chartGetColor === 'function' ? scope.chartGetColor : getRandomColor; - } - - function getChartData (type, scope) { - var colors = getColors(type, scope); - return Array.isArray(scope.chartData[0]) ? - getDataSets(scope.chartLabels, scope.chartData, scope.chartSeries || [], colors, scope.chartDatasetOverride) : - getData(scope.chartLabels, scope.chartData, colors, scope.chartDatasetOverride); - } - - function getDataSets (labels, data, series, colors, datasetOverride) { - return { - labels: labels, - datasets: data.map(function (item, i) { - var dataset = angular.extend({}, colors[i], { - label: series[i], - data: item - }); - if (datasetOverride && datasetOverride.length >= i) { - angular.merge(dataset, datasetOverride[i]); - } - return dataset; - }) - }; - } - - function getData (labels, data, colors, datasetOverride) { - var dataset = { - labels: labels, - datasets: [{ - data: data, - backgroundColor: colors.map(function (color) { - return color.pointBackgroundColor; - }), - hoverBackgroundColor: colors.map(function (color) { - return color.backgroundColor; - }) - }] - }; - if (datasetOverride) { - angular.merge(dataset.datasets[0], datasetOverride); - } - return dataset; - } - - function getChartOptions (type, scope) { - return angular.extend({}, ChartJs.getOptions(type), scope.chartOptions); - } - - function bindEvents (cvs, scope) { - cvs.onclick = scope.chartClick ? getEventHandler(scope, 'chartClick', false) : angular.noop; - cvs.onmousemove = scope.chartHover ? getEventHandler(scope, 'chartHover', true) : angular.noop; - } - - function updateChart (values, scope) { - if (Array.isArray(scope.chartData[0])) { - scope.chart.data.datasets.forEach(function (dataset, i) { - dataset.data = values[i]; - }); - } else { - scope.chart.data.datasets[0].data = values; - } - - scope.chart.update(); - scope.$emit('chart-update', scope.chart); - } - - function isEmpty (value) { - return ! value || - (Array.isArray(value) && ! value.length) || - (typeof value === 'object' && ! Object.keys(value).length); - } - - function canDisplay (type, scope, elem, options) { - // TODO: check parent? - if (options.responsive && elem[0].clientHeight === 0) { - $timeout(function () { - createChart(type, scope, elem); - }, 50, false); - return false; - } - return true; - } - - function destroyChart(scope) { - if(! scope.chart) return; - scope.chart.destroy(); - scope.$emit('chart-destroy', scope.chart); - } - } -})); diff --git a/static/node_modules/angular-chart.js/dist/angular-chart.js.tar.gz b/static/node_modules/angular-chart.js/dist/angular-chart.js.tar.gz deleted file mode 100644 index 6b2cc3e8..00000000 Binary files a/static/node_modules/angular-chart.js/dist/angular-chart.js.tar.gz and /dev/null differ diff --git a/static/node_modules/angular-chart.js/dist/angular-chart.min.js b/static/node_modules/angular-chart.js/dist/angular-chart.min.js deleted file mode 100644 index 7e017db5..00000000 --- a/static/node_modules/angular-chart.js/dist/angular-chart.min.js +++ /dev/null @@ -1,11 +0,0 @@ -/*! - * angular-chart.js - An angular.js wrapper for Chart.js - * http://jtblin.github.io/angular-chart.js/ - * Version: 1.1.1 - * - * Copyright 2016 Jerome Touffe-Blin - * Released under the BSD-2-Clause license - * https://github.com/jtblin/angular-chart.js/blob/master/LICENSE - */ -!function(t){"use strict";if("object"==typeof exports)module.exports=t("undefined"!=typeof angular?angular:require("angular"),"undefined"!=typeof Chart?Chart:require("chart.js"));else if("function"==typeof define&&define.amd)define(["angular","chart"],t);else{if("undefined"==typeof angular)throw new Error("AngularJS framework needs to be included, see https://angularjs.org/");if("undefined"==typeof Chart)throw new Error("Chart.js library needs to be included, see http://jtblin.github.io/angular-chart.js/");t(angular,Chart)}}(function(t,r){"use strict";function e(){var e={responsive:!0},a={Chart:r,getOptions:function(r){var a=r&&e[r]||{};return t.extend({},e,a)}};this.setOptions=function(r,n){n?e[r]=t.merge(e[r]||{},n):(n=r,e=t.merge(e,n)),t.merge(a.Chart.defaults,e)},this.$get=function(){return a}}function a(e,a){function o(t,r,a){var n=D(t,r);if(C(r)&&k(t,r,a,n)){var o=a[0],c=o.getContext("2d");r.chartGetColor=y(r);var i=b(t,r);F(r),r.chart=new e.Chart(c,{type:t,data:i,options:n}),r.$emit("chart-create",r.chart),A(o,r)}}function c(t,r){return!!(t&&r&&t.length&&r.length)&&(Array.isArray(t[0])?t.length===r.length&&t.every(function(t,e){return t.length===r[e].length}):r.reduce(i,0)>0&&t.length===r.length)}function i(t,r){return t+r}function u(r,e,a){var n={point:void 0,points:void 0};return function(o){var c=r.chart.getElementAtEvent||r.chart.getPointAtEvent,i=r.chart.getElementsAtEvent||r.chart.getPointsAtEvent;if(i){var u=i.call(r.chart,o),l=c?c.call(r.chart,o)[0]:void 0;a!==!1&&(t.equals(n.points,u)||t.equals(n.point,l))||(n.point=l,n.points=u,r[e](u,o,l))}}}function l(a,n){for(var o=t.copy(n.chartColors||e.getOptions(a).chartColors||r.defaults.global.colors),c=o.length>16&255,a=r>>8&255,n=255&r;return[e,a,n]}function v(t){var r=t.match(/^rgba?\(([\d,.]+)\)$/);if(!r)throw new Error("Cannot parse rgb value");return t=r[1].split(","),t.map(Number)}function C(t){return t.chartData&&t.chartData.length}function y(t){return"function"==typeof t.chartGetColor?t.chartGetColor:s}function b(t,r){var e=l(t,r);return Array.isArray(r.chartData[0])?m(r.chartLabels,r.chartData,r.chartSeries||[],e,r.chartDatasetOverride):w(r.chartLabels,r.chartData,e,r.chartDatasetOverride)}function m(r,e,a,n,o){return{labels:r,datasets:e.map(function(r,e){var c=t.extend({},n[e],{label:a[e],data:r});return o&&o.length>=e&&t.merge(c,o[e]),c})}}function w(r,e,a,n){var o={labels:r,datasets:[{data:e,backgroundColor:a.map(function(t){return t.pointBackgroundColor}),hoverBackgroundColor:a.map(function(t){return t.backgroundColor})}]};return n&&t.merge(o.datasets[0],n),o}function D(r,a){return t.extend({},e.getOptions(r),a.chartOptions)}function A(r,e){r.onclick=e.chartClick?u(e,"chartClick",!1):t.noop,r.onmousemove=e.chartHover?u(e,"chartHover",!0):t.noop}function B(t,r){Array.isArray(r.chartData[0])?r.chart.data.datasets.forEach(function(r,e){r.data=t[e]}):r.chart.data.datasets[0].data=t,r.chart.update(),r.$emit("chart-update",r.chart)}function $(t){return!t||Array.isArray(t)&&!t.length||"object"==typeof t&&!Object.keys(t).length}function k(t,r,e,n){return!n.responsive||0!==e[0].clientHeight||(a(function(){o(t,r,e)},50,!1),!1)}function F(t){t.chart&&(t.chart.destroy(),t.$emit("chart-destroy",t.chart))}return function(r){return{restrict:"CA",scope:{chartGetColor:"=?",chartType:"=",chartData:"=?",chartLabels:"=?",chartOptions:"=?",chartSeries:"=?",chartColors:"=?",chartClick:"=?",chartHover:"=?",chartDatasetOverride:"=?"},link:function(e,a){function i(t,n){if(!t||!t.length||Array.isArray(t[0])&&!t[0].length)return void F(e);var i=r||e.chartType;if(i)return e.chart&&c(t,n)?B(t,e):void o(i,e,a)}function u(n,c){if(!$(n)&&!t.equals(n,c)){var i=r||e.chartType;i&&o(i,e,a)}}function l(r,n){$(r)||t.equals(r,n)||o(r,e,a)}n&&window.G_vmlCanvasManager.initElement(a[0]),e.$watch("chartData",i,!0),e.$watch("chartSeries",u,!0),e.$watch("chartLabels",u,!0),e.$watch("chartOptions",u,!0),e.$watch("chartColors",u,!0),e.$watch("chartDatasetOverride",u,!0),e.$watch("chartType",l,!1),e.$on("$destroy",function(){F(e)}),e.$on("$resize",function(){e.chart&&e.chart.resize()})}}}}r.defaults.global.multiTooltipTemplate="<%if (datasetLabel){%><%=datasetLabel%>: <%}%><%= value %>",r.defaults.global.tooltips.mode="label",r.defaults.global.elements.line.borderWidth=2,r.defaults.global.elements.rectangle.borderWidth=2,r.defaults.global.legend.display=!1,r.defaults.global.colors=["#97BBCD","#DCDCDC","#F7464A","#46BFBD","#FDB45C","#949FB1","#4D5360"];var n="object"==typeof window.G_vmlCanvasManager&&null!==window.G_vmlCanvasManager&&"function"==typeof window.G_vmlCanvasManager.initElement;return n&&(r.defaults.global.animation=!1),t.module("chart.js",[]).provider("ChartJs",e).factory("ChartJsFactory",["ChartJs","$timeout",a]).directive("chartBase",["ChartJsFactory",function(t){return new t}]).directive("chartLine",["ChartJsFactory",function(t){return new t("line")}]).directive("chartBar",["ChartJsFactory",function(t){return new t("bar")}]).directive("chartHorizontalBar",["ChartJsFactory",function(t){return new t("horizontalBar")}]).directive("chartRadar",["ChartJsFactory",function(t){return new t("radar")}]).directive("chartDoughnut",["ChartJsFactory",function(t){return new t("doughnut")}]).directive("chartPie",["ChartJsFactory",function(t){return new t("pie")}]).directive("chartPolarArea",["ChartJsFactory",function(t){return new t("polarArea")}]).directive("chartBubble",["ChartJsFactory",function(t){return new t("bubble")}]).name}); -//# sourceMappingURL=angular-chart.min.js.map diff --git a/static/node_modules/angular-chart.js/dist/angular-chart.min.js.map b/static/node_modules/angular-chart.js/dist/angular-chart.min.js.map deleted file mode 100644 index e8454a98..00000000 --- a/static/node_modules/angular-chart.js/dist/angular-chart.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["angular-chart.js"],"names":["factory","exports","module","angular","require","Chart","define","amd","Error","ChartJsProvider","options","responsive","ChartJs","getOptions","type","typeOptions","extend","this","setOptions","customOptions","merge","defaults","$get","ChartJsFactory","$timeout","createChart","scope","elem","getChartOptions","hasData","canDisplay","cvs","ctx","getContext","chartGetColor","getChartColorFn","data","getChartData","destroyChart","chart","$emit","bindEvents","canUpdateChart","newVal","oldVal","length","Array","isArray","every","element","index","reduce","sum","carry","val","getEventHandler","action","triggerOnlyOnChange","lastState","point","points","evt","atEvent","getElementAtEvent","getPointAtEvent","atEvents","getElementsAtEvent","getPointsAtEvent","call","equals","getColors","colors","copy","chartColors","global","notEnoughColors","chartData","push","map","convertColor","color","getColor","rgbStringToRgb","hexToRgb","substr","getRandomColor","getRandomInt","alpha","slice","backgroundColor","rgba","pointBackgroundColor","pointHoverBackgroundColor","borderColor","pointBorderColor","pointHoverBorderColor","min","max","Math","floor","random","useExcanvas","join","concat","hex","bigint","parseInt","r","g","b","match","split","Number","getDataSets","chartLabels","chartSeries","chartDatasetOverride","getData","labels","series","datasetOverride","datasets","item","i","dataset","label","hoverBackgroundColor","chartOptions","onclick","chartClick","noop","onmousemove","chartHover","updateChart","values","forEach","update","isEmpty","value","Object","keys","clientHeight","destroy","restrict","chartType","link","watchData","watchOther","watchType","window","G_vmlCanvasManager","initElement","$watch","$on","resize","multiTooltipTemplate","tooltips","mode","elements","line","borderWidth","rectangle","legend","display","animation","provider","directive","name"],"mappings":";;;;;;;;;CAAA,SAAAA,GACA,YACA,IAAA,gBAAAC,SAEAC,OAAAD,QAAAD,EACA,mBAAAG,SAAAA,QAAAC,QAAA,WACA,mBAAAC,OAAAA,MAAAD,QAAA,iBACA,IAAA,kBAAAE,SAAAA,OAAAC,IAEAD,QAAA,UAAA,SAAAN,OACA,CAEA,GAAA,mBAAAG,SACA,KAAA,IAAAK,OAAA,uEACA,IAAA,mBAAAH,OACA,KAAA,IAAAG,OAAA,uFAEAR,GAAAG,QAAAE,SAEA,SAAAF,EAAAE,GACA,YA8CA,SAAAI,KACA,GAAAC,IAAAC,YAAA,GACAC,GACAP,MAAAA,EACAQ,WAAA,SAAAC,GACA,GAAAC,GAAAD,GAAAJ,EAAAI,MACA,OAAAX,GAAAa,UAAAN,EAAAK,IAOAE,MAAAC,WAAA,SAAAJ,EAAAK,GAEAA,EAKAT,EAAAI,GAAAX,EAAAiB,MAAAV,EAAAI,OAAAK,IAJAA,EAAAL,EACAJ,EAAAP,EAAAiB,MAAAV,EAAAS,IAMAhB,EAAAiB,MAAAR,EAAAP,MAAAgB,SAAAX,IAGAO,KAAAK,KAAA,WACA,MAAAV,IAIA,QAAAW,GAAAX,EAAAY,GAsEA,QAAAC,GAAAX,EAAAY,EAAAC,GACA,GAAAjB,GAAAkB,EAAAd,EAAAY,EACA,IAAAG,EAAAH,IAAAI,EAAAhB,EAAAY,EAAAC,EAAAjB,GAAA,CAEA,GAAAqB,GAAAJ,EAAA,GACAK,EAAAD,EAAAE,WAAA,KAEAP,GAAAQ,cAAAC,EAAAT,EACA,IAAAU,GAAAC,EAAAvB,EAAAY,EAGAY,GAAAZ,GAEAA,EAAAa,MAAA,GAAA3B,GAAAP,MAAA2B,GACAlB,KAAAA,EACAsB,KAAAA,EACA1B,QAAAA,IAEAgB,EAAAc,MAAA,eAAAd,EAAAa,OACAE,EAAAV,EAAAL,IAGA,QAAAgB,GAAAC,EAAAC,GACA,SAAAD,GAAAC,GAAAD,EAAAE,QAAAD,EAAAC,UACAC,MAAAC,QAAAJ,EAAA,IACAA,EAAAE,SAAAD,EAAAC,QAAAF,EAAAK,MAAA,SAAAC,EAAAC,GACA,MAAAD,GAAAJ,SAAAD,EAAAM,GAAAL,SACAD,EAAAO,OAAAC,EAAA,GAAA,GAAAT,EAAAE,SAAAD,EAAAC,QAKA,QAAAO,GAAAC,EAAAC,GACA,MAAAD,GAAAC,EAGA,QAAAC,GAAA7B,EAAA8B,EAAAC,GACA,GAAAC,IACAC,MAAA,OACAC,OAAA,OAEA,OAAA,UAAAC,GACA,GAAAC,GAAApC,EAAAa,MAAAwB,mBAAArC,EAAAa,MAAAyB,gBACAC,EAAAvC,EAAAa,MAAA2B,oBAAAxC,EAAAa,MAAA4B,gBACA,IAAAF,EAAA,CACA,GAAAL,GAAAK,EAAAG,KAAA1C,EAAAa,MAAAsB,GACAF,EAAAG,EAAAA,EAAAM,KAAA1C,EAAAa,MAAAsB,GAAA,GAAA,MAEAJ,MAAA,IACAtD,EAAAkE,OAAAX,EAAAE,OAAAA,IAAAzD,EAAAkE,OAAAX,EAAAC,MAAAA,MAEAD,EAAAC,MAAAA,EACAD,EAAAE,OAAAA,EACAlC,EAAA8B,GAAAI,EAAAC,EAAAF,MAMA,QAAAW,GAAAxD,EAAAY,GAMA,IALA,GAAA6C,GAAApE,EAAAqE,KAAA9C,EAAA+C,aACA7D,EAAAC,WAAAC,GAAA2D,aACApE,EAAAgB,SAAAqD,OAAAH,QAEAI,EAAAJ,EAAA1B,OAAAnB,EAAAkD,UAAA/B,OACA0B,EAAA1B,OAAAnB,EAAAkD,UAAA/B,QACA0B,EAAAM,KAAAnD,EAAAQ,gBAKA,OADAyC,KAAAjD,EAAA+C,YAAAF,GACAA,EAAAO,IAAAC,GAGA,QAAAA,GAAAC,GAEA,MAAA,gBAAAA,IAAA,MAAAA,EAAA,GAAAC,EAAAC,EAAAF,IAEA,gBAAAA,IAAA,MAAAA,EAAA,GAAAC,EAAAE,EAAAH,EAAAI,OAAA,KAEA,gBAAAJ,IAAA,OAAAA,EAAAA,EACAK,IAGA,QAAAA,KACA,GAAAL,IAAAM,EAAA,EAAA,KAAAA,EAAA,EAAA,KAAAA,EAAA,EAAA,KACA,OAAAL,GAAAD,GAGA,QAAAC,GAAAD,GACA,GAAAO,GAAAP,EAAA,IAAA,CAEA,OADAA,GAAAA,EAAAQ,MAAA,EAAA,IAEAC,gBAAAC,EAAAV,EAAA,IACAW,qBAAAD,EAAAV,EAAAO,GACAK,0BAAAF,EAAAV,EAAA,IACAa,YAAAH,EAAAV,EAAAO,GACAO,iBAAA,OACAC,sBAAAL,EAAAV,EAAAO,IAIA,QAAAD,GAAAU,EAAAC,GACA,MAAAC,MAAAC,MAAAD,KAAAE,UAAAH,EAAAD,EAAA,IAAAA,EAGA,QAAAN,GAAAV,EAAAO,GAEA,MAAAc,GAAA,OAAArB,EAAAsB,KAAA,KAAA,IAAA,QAAAtB,EAAAuB,OAAAhB,GAAAe,KAAA,KAAA,IAIA,QAAAnB,GAAAqB,GACA,GAAAC,GAAAC,SAAAF,EAAA,IACAG,EAAAF,GAAA,GAAA,IACAG,EAAAH,GAAA,EAAA,IACAI,EAAA,IAAAJ,CAEA,QAAAE,EAAAC,EAAAC,GAGA,QAAA3B,GAAAF,GACA,GAAA8B,GAAA9B,EAAA8B,MAAA,uBACA,KAAAA,EAAA,KAAA,IAAAtG,OAAA,yBAEA,OADAwE,GAAA8B,EAAA,GAAAC,MAAA,KACA/B,EAAAF,IAAAkC,QAGA,QAAAnF,GAAAH,GACA,MAAAA,GAAAkD,WAAAlD,EAAAkD,UAAA/B,OAGA,QAAAV,GAAAT,GACA,MAAA,kBAAAA,GAAAQ,cAAAR,EAAAQ,cAAAmD,EAGA,QAAAhD,GAAAvB,EAAAY,GACA,GAAA6C,GAAAD,EAAAxD,EAAAY,EACA,OAAAoB,OAAAC,QAAArB,EAAAkD,UAAA,IACAqC,EAAAvF,EAAAwF,YAAAxF,EAAAkD,UAAAlD,EAAAyF,gBAAA5C,EAAA7C,EAAA0F,sBACAC,EAAA3F,EAAAwF,YAAAxF,EAAAkD,UAAAL,EAAA7C,EAAA0F,sBAGA,QAAAH,GAAAK,EAAAlF,EAAAmF,EAAAhD,EAAAiD,GACA,OACAF,OAAAA,EACAG,SAAArF,EAAA0C,IAAA,SAAA4C,EAAAC,GACA,GAAAC,GAAAzH,EAAAa,UAAAuD,EAAAoD,IACAE,MAAAN,EAAAI,GACAvF,KAAAsF,GAKA,OAHAF,IAAAA,EAAA3E,QAAA8E,GACAxH,EAAAiB,MAAAwG,EAAAJ,EAAAG,IAEAC,KAKA,QAAAP,GAAAC,EAAAlF,EAAAmC,EAAAiD,GACA,GAAAI,IACAN,OAAAA,EACAG,WACArF,KAAAA,EACAqD,gBAAAlB,EAAAO,IAAA,SAAAE,GACA,MAAAA,GAAAW,uBAEAmC,qBAAAvD,EAAAO,IAAA,SAAAE,GACA,MAAAA,GAAAS,oBAOA,OAHA+B,IACArH,EAAAiB,MAAAwG,EAAAH,SAAA,GAAAD,GAEAI,EAGA,QAAAhG,GAAAd,EAAAY,GACA,MAAAvB,GAAAa,UAAAJ,EAAAC,WAAAC,GAAAY,EAAAqG,cAGA,QAAAtF,GAAAV,EAAAL,GACAK,EAAAiG,QAAAtG,EAAAuG,WAAA1E,EAAA7B,EAAA,cAAA,GAAAvB,EAAA+H,KACAnG,EAAAoG,YAAAzG,EAAA0G,WAAA7E,EAAA7B,EAAA,cAAA,GAAAvB,EAAA+H,KAGA,QAAAG,GAAAC,EAAA5G,GACAoB,MAAAC,QAAArB,EAAAkD,UAAA,IACAlD,EAAAa,MAAAH,KAAAqF,SAAAc,QAAA,SAAAX,EAAAD,GACAC,EAAAxF,KAAAkG,EAAAX,KAGAjG,EAAAa,MAAAH,KAAAqF,SAAA,GAAArF,KAAAkG,EAGA5G,EAAAa,MAAAiG,SACA9G,EAAAc,MAAA,eAAAd,EAAAa,OAGA,QAAAkG,GAAAC,GACA,OAAAA,GACA5F,MAAAC,QAAA2F,KAAAA,EAAA7F,QACA,gBAAA6F,KAAAC,OAAAC,KAAAF,GAAA7F,OAGA,QAAAf,GAAAhB,EAAAY,EAAAC,EAAAjB,GAEA,OAAAA,EAAAC,YAAA,IAAAgB,EAAA,GAAAkH,eACArH,EAAA,WACAC,EAAAX,EAAAY,EAAAC,IACA,IAAA,IACA,GAKA,QAAAW,GAAAZ,GACAA,EAAAa,QACAb,EAAAa,MAAAuG,UACApH,EAAAc,MAAA,gBAAAd,EAAAa,QAjSA,MAAA,UAAAzB,GACA,OACAiI,SAAA,KACArH,OACAQ,cAAA,KACA8G,UAAA,IACApE,UAAA,KACAsC,YAAA,KACAa,aAAA,KACAZ,YAAA,KACA1C,YAAA,KACAwD,WAAA,KACAG,WAAA,KACAhB,qBAAA,MAEA6B,KAAA,SAAAvH,EAAAC,GAoBA,QAAAuH,GAAAvG,EAAAC,GACA,IAAAD,IAAAA,EAAAE,QAAAC,MAAAC,QAAAJ,EAAA,MAAAA,EAAA,GAAAE,OAEA,WADAP,GAAAZ,EAGA,IAAAsH,GAAAlI,GAAAY,EAAAsH,SACA,IAAAA,EAEA,MAAAtH,GAAAa,OAAAG,EAAAC,EAAAC,GACAyF,EAAA1F,EAAAjB,OAEAD,GAAAuH,EAAAtH,EAAAC,GAGA,QAAAwH,GAAAxG,EAAAC,GACA,IAAA6F,EAAA9F,KACAxC,EAAAkE,OAAA1B,EAAAC,GAAA,CACA,GAAAoG,GAAAlI,GAAAY,EAAAsH,SACAA,IAIAvH,EAAAuH,EAAAtH,EAAAC,IAGA,QAAAyH,GAAAzG,EAAAC,GACA6F,EAAA9F,IACAxC,EAAAkE,OAAA1B,EAAAC,IACAnB,EAAAkB,EAAAjB,EAAAC,GA/CA0E,GAAAgD,OAAAC,mBAAAC,YAAA5H,EAAA,IAGAD,EAAA8H,OAAA,YAAAN,GAAA,GACAxH,EAAA8H,OAAA,cAAAL,GAAA,GACAzH,EAAA8H,OAAA,cAAAL,GAAA,GACAzH,EAAA8H,OAAA,eAAAL,GAAA,GACAzH,EAAA8H,OAAA,cAAAL,GAAA,GACAzH,EAAA8H,OAAA,uBAAAL,GAAA,GACAzH,EAAA8H,OAAA,YAAAJ,GAAA,GAEA1H,EAAA+H,IAAA,WAAA,WACAnH,EAAAZ,KAGAA,EAAA+H,IAAA,UAAA,WACA/H,EAAAa,OAAAb,EAAAa,MAAAmH,cA5GArJ,EAAAgB,SAAAqD,OAAAiF,qBAAA,6DACAtJ,EAAAgB,SAAAqD,OAAAkF,SAAAC,KAAA,QACAxJ,EAAAgB,SAAAqD,OAAAoF,SAAAC,KAAAC,YAAA,EACA3J,EAAAgB,SAAAqD,OAAAoF,SAAAG,UAAAD,YAAA,EACA3J,EAAAgB,SAAAqD,OAAAwF,OAAAC,SAAA,EACA9J,EAAAgB,SAAAqD,OAAAH,QACA,UACA,UACA,UACA,UACA,UACA,UACA,UAGA,IAAA8B,GAAA,gBAAAgD,QAAAC,oBACA,OAAAD,OAAAC,oBACA,kBAAAD,QAAAC,mBAAAC,WAIA,OAFAlD,KAAAhG,EAAAgB,SAAAqD,OAAA0F,WAAA,GAEAjK,EAAAD,OAAA,eACAmK,SAAA,UAAA5J,GACAT,QAAA,kBAAA,UAAA,WAAAuB,IACA+I,UAAA,aAAA,iBAAA,SAAA/I,GAAA,MAAA,IAAAA,MACA+I,UAAA,aAAA,iBAAA,SAAA/I,GAAA,MAAA,IAAAA,GAAA,WACA+I,UAAA,YAAA,iBAAA,SAAA/I,GAAA,MAAA,IAAAA,GAAA,UACA+I,UAAA,sBAAA,iBAAA,SAAA/I,GAAA,MAAA,IAAAA,GAAA,oBACA+I,UAAA,cAAA,iBAAA,SAAA/I,GAAA,MAAA,IAAAA,GAAA,YACA+I,UAAA,iBAAA,iBAAA,SAAA/I,GAAA,MAAA,IAAAA,GAAA,eACA+I,UAAA,YAAA,iBAAA,SAAA/I,GAAA,MAAA,IAAAA,GAAA,UACA+I,UAAA,kBAAA,iBAAA,SAAA/I,GAAA,MAAA,IAAAA,GAAA,gBACA+I,UAAA,eAAA,iBAAA,SAAA/I,GAAA,MAAA,IAAAA,GAAA,aACAgJ","file":"angular-chart.min.js","sourcesContent":["(function (factory) {\n 'use strict';\n if (typeof exports === 'object') {\n // Node/CommonJS\n module.exports = factory(\n typeof angular !== 'undefined' ? angular : require('angular'),\n typeof Chart !== 'undefined' ? Chart : require('chart.js'));\n } else if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define(['angular', 'chart'], factory);\n } else {\n // Browser globals\n if (typeof angular === 'undefined') {\n throw new Error('AngularJS framework needs to be included, see https://angularjs.org/');\n } else if (typeof Chart === 'undefined') {\n throw new Error('Chart.js library needs to be included, see http://jtblin.github.io/angular-chart.js/');\n }\n factory(angular, Chart);\n }\n}(function (angular, Chart) {\n 'use strict';\n\n Chart.defaults.global.multiTooltipTemplate = '<%if (datasetLabel){%><%=datasetLabel%>: <%}%><%= value %>';\n Chart.defaults.global.tooltips.mode = 'label';\n Chart.defaults.global.elements.line.borderWidth = 2;\n Chart.defaults.global.elements.rectangle.borderWidth = 2;\n Chart.defaults.global.legend.display = false;\n Chart.defaults.global.colors = [\n '#97BBCD', // blue\n '#DCDCDC', // light grey\n '#F7464A', // red\n '#46BFBD', // green\n '#FDB45C', // yellow\n '#949FB1', // grey\n '#4D5360' // dark grey\n ];\n\n var useExcanvas = typeof window.G_vmlCanvasManager === 'object' &&\n window.G_vmlCanvasManager !== null &&\n typeof window.G_vmlCanvasManager.initElement === 'function';\n\n if (useExcanvas) Chart.defaults.global.animation = false;\n\n return angular.module('chart.js', [])\n .provider('ChartJs', ChartJsProvider)\n .factory('ChartJsFactory', ['ChartJs', '$timeout', ChartJsFactory])\n .directive('chartBase', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory(); }])\n .directive('chartLine', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('line'); }])\n .directive('chartBar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('bar'); }])\n .directive('chartHorizontalBar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('horizontalBar'); }])\n .directive('chartRadar', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('radar'); }])\n .directive('chartDoughnut', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('doughnut'); }])\n .directive('chartPie', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('pie'); }])\n .directive('chartPolarArea', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('polarArea'); }])\n .directive('chartBubble', ['ChartJsFactory', function (ChartJsFactory) { return new ChartJsFactory('bubble'); }])\n .name;\n\n /**\n * Wrapper for chart.js\n * Allows configuring chart js using the provider\n *\n * angular.module('myModule', ['chart.js']).config(function(ChartJsProvider) {\n * ChartJsProvider.setOptions({ responsive: false });\n * ChartJsProvider.setOptions('Line', { responsive: true });\n * })))\n */\n function ChartJsProvider () {\n var options = { responsive: true };\n var ChartJs = {\n Chart: Chart,\n getOptions: function (type) {\n var typeOptions = type && options[type] || {};\n return angular.extend({}, options, typeOptions);\n }\n };\n\n /**\n * Allow to set global options during configuration\n */\n this.setOptions = function (type, customOptions) {\n // If no type was specified set option for the global object\n if (! customOptions) {\n customOptions = type;\n options = angular.merge(options, customOptions);\n } else {\n // Set options for the specific chart\n options[type] = angular.merge(options[type] || {}, customOptions);\n }\n\n angular.merge(ChartJs.Chart.defaults, options);\n };\n\n this.$get = function () {\n return ChartJs;\n };\n }\n\n function ChartJsFactory (ChartJs, $timeout) {\n return function chart (type) {\n return {\n restrict: 'CA',\n scope: {\n chartGetColor: '=?',\n chartType: '=',\n chartData: '=?',\n chartLabels: '=?',\n chartOptions: '=?',\n chartSeries: '=?',\n chartColors: '=?',\n chartClick: '=?',\n chartHover: '=?',\n chartDatasetOverride: '=?'\n },\n link: function (scope, elem/*, attrs */) {\n if (useExcanvas) window.G_vmlCanvasManager.initElement(elem[0]);\n\n // Order of setting \"watch\" matter\n scope.$watch('chartData', watchData, true);\n scope.$watch('chartSeries', watchOther, true);\n scope.$watch('chartLabels', watchOther, true);\n scope.$watch('chartOptions', watchOther, true);\n scope.$watch('chartColors', watchOther, true);\n scope.$watch('chartDatasetOverride', watchOther, true);\n scope.$watch('chartType', watchType, false);\n\n scope.$on('$destroy', function () {\n destroyChart(scope);\n });\n\n scope.$on('$resize', function () {\n if (scope.chart) scope.chart.resize();\n });\n\n function watchData (newVal, oldVal) {\n if (! newVal || ! newVal.length || (Array.isArray(newVal[0]) && ! newVal[0].length)) {\n destroyChart(scope);\n return;\n }\n var chartType = type || scope.chartType;\n if (! chartType) return;\n\n if (scope.chart && canUpdateChart(newVal, oldVal))\n return updateChart(newVal, scope);\n\n createChart(chartType, scope, elem);\n }\n\n function watchOther (newVal, oldVal) {\n if (isEmpty(newVal)) return;\n if (angular.equals(newVal, oldVal)) return;\n var chartType = type || scope.chartType;\n if (! chartType) return;\n\n // chart.update() doesn't work for series and labels\n // so we have to re-create the chart entirely\n createChart(chartType, scope, elem);\n }\n\n function watchType (newVal, oldVal) {\n if (isEmpty(newVal)) return;\n if (angular.equals(newVal, oldVal)) return;\n createChart(newVal, scope, elem);\n }\n }\n };\n };\n\n function createChart (type, scope, elem) {\n var options = getChartOptions(type, scope);\n if (! hasData(scope) || ! canDisplay(type, scope, elem, options)) return;\n\n var cvs = elem[0];\n var ctx = cvs.getContext('2d');\n\n scope.chartGetColor = getChartColorFn(scope);\n var data = getChartData(type, scope);\n // Destroy old chart if it exists to avoid ghost charts issue\n // https://github.com/jtblin/angular-chart.js/issues/187\n destroyChart(scope);\n\n scope.chart = new ChartJs.Chart(ctx, {\n type: type,\n data: data,\n options: options\n });\n scope.$emit('chart-create', scope.chart);\n bindEvents(cvs, scope);\n }\n\n function canUpdateChart (newVal, oldVal) {\n if (newVal && oldVal && newVal.length && oldVal.length) {\n return Array.isArray(newVal[0]) ?\n newVal.length === oldVal.length && newVal.every(function (element, index) {\n return element.length === oldVal[index].length; }) :\n oldVal.reduce(sum, 0) > 0 ? newVal.length === oldVal.length : false;\n }\n return false;\n }\n\n function sum (carry, val) {\n return carry + val;\n }\n\n function getEventHandler (scope, action, triggerOnlyOnChange) {\n var lastState = {\n point: void 0,\n points: void 0\n };\n return function (evt) {\n var atEvent = scope.chart.getElementAtEvent || scope.chart.getPointAtEvent;\n var atEvents = scope.chart.getElementsAtEvent || scope.chart.getPointsAtEvent;\n if (atEvents) {\n var points = atEvents.call(scope.chart, evt);\n var point = atEvent ? atEvent.call(scope.chart, evt)[0] : void 0;\n\n if (triggerOnlyOnChange === false ||\n (! angular.equals(lastState.points, points) && ! angular.equals(lastState.point, point))\n ) {\n lastState.point = point;\n lastState.points = points;\n scope[action](points, evt, point);\n }\n }\n };\n }\n\n function getColors (type, scope) {\n var colors = angular.copy(scope.chartColors ||\n ChartJs.getOptions(type).chartColors ||\n Chart.defaults.global.colors\n );\n var notEnoughColors = colors.length < scope.chartData.length;\n while (colors.length < scope.chartData.length) {\n colors.push(scope.chartGetColor());\n }\n // mutate colors in this case as we don't want\n // the colors to change on each refresh\n if (notEnoughColors) scope.chartColors = colors;\n return colors.map(convertColor);\n }\n\n function convertColor (color) {\n // Allows RGB and RGBA colors to be input as a string: e.g.: \"rgb(159,204,0)\", \"rgba(159,204,0, 0.5)\"\n if (typeof color === 'string' && color[0] === 'r') return getColor(rgbStringToRgb(color));\n // Allows hex colors to be input as a string.\n if (typeof color === 'string' && color[0] === '#') return getColor(hexToRgb(color.substr(1)));\n // Allows colors to be input as an object, bypassing getColor() entirely\n if (typeof color === 'object' && color !== null) return color;\n return getRandomColor();\n }\n\n function getRandomColor () {\n var color = [getRandomInt(0, 255), getRandomInt(0, 255), getRandomInt(0, 255)];\n return getColor(color);\n }\n\n function getColor (color) {\n var alpha = color[3] || 1;\n color = color.slice(0, 3);\n return {\n backgroundColor: rgba(color, 0.2),\n pointBackgroundColor: rgba(color, alpha),\n pointHoverBackgroundColor: rgba(color, 0.8),\n borderColor: rgba(color, alpha),\n pointBorderColor: '#fff',\n pointHoverBorderColor: rgba(color, alpha)\n };\n }\n\n function getRandomInt (min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n }\n\n function rgba (color, alpha) {\n // rgba not supported by IE8\n return useExcanvas ? 'rgb(' + color.join(',') + ')' : 'rgba(' + color.concat(alpha).join(',') + ')';\n }\n\n // Credit: http://stackoverflow.com/a/11508164/1190235\n function hexToRgb (hex) {\n var bigint = parseInt(hex, 16),\n r = (bigint >> 16) & 255,\n g = (bigint >> 8) & 255,\n b = bigint & 255;\n\n return [r, g, b];\n }\n\n function rgbStringToRgb (color) {\n var match = color.match(/^rgba?\\(([\\d,.]+)\\)$/);\n if (! match) throw new Error('Cannot parse rgb value');\n color = match[1].split(',');\n return color.map(Number);\n }\n\n function hasData (scope) {\n return scope.chartData && scope.chartData.length;\n }\n\n function getChartColorFn (scope) {\n return typeof scope.chartGetColor === 'function' ? scope.chartGetColor : getRandomColor;\n }\n\n function getChartData (type, scope) {\n var colors = getColors(type, scope);\n return Array.isArray(scope.chartData[0]) ?\n getDataSets(scope.chartLabels, scope.chartData, scope.chartSeries || [], colors, scope.chartDatasetOverride) :\n getData(scope.chartLabels, scope.chartData, colors, scope.chartDatasetOverride);\n }\n\n function getDataSets (labels, data, series, colors, datasetOverride) {\n return {\n labels: labels,\n datasets: data.map(function (item, i) {\n var dataset = angular.extend({}, colors[i], {\n label: series[i],\n data: item\n });\n if (datasetOverride && datasetOverride.length >= i) {\n angular.merge(dataset, datasetOverride[i]);\n }\n return dataset;\n })\n };\n }\n\n function getData (labels, data, colors, datasetOverride) {\n var dataset = {\n labels: labels,\n datasets: [{\n data: data,\n backgroundColor: colors.map(function (color) {\n return color.pointBackgroundColor;\n }),\n hoverBackgroundColor: colors.map(function (color) {\n return color.backgroundColor;\n })\n }]\n };\n if (datasetOverride) {\n angular.merge(dataset.datasets[0], datasetOverride);\n }\n return dataset;\n }\n\n function getChartOptions (type, scope) {\n return angular.extend({}, ChartJs.getOptions(type), scope.chartOptions);\n }\n\n function bindEvents (cvs, scope) {\n cvs.onclick = scope.chartClick ? getEventHandler(scope, 'chartClick', false) : angular.noop;\n cvs.onmousemove = scope.chartHover ? getEventHandler(scope, 'chartHover', true) : angular.noop;\n }\n\n function updateChart (values, scope) {\n if (Array.isArray(scope.chartData[0])) {\n scope.chart.data.datasets.forEach(function (dataset, i) {\n dataset.data = values[i];\n });\n } else {\n scope.chart.data.datasets[0].data = values;\n }\n\n scope.chart.update();\n scope.$emit('chart-update', scope.chart);\n }\n\n function isEmpty (value) {\n return ! value ||\n (Array.isArray(value) && ! value.length) ||\n (typeof value === 'object' && ! Object.keys(value).length);\n }\n\n function canDisplay (type, scope, elem, options) {\n // TODO: check parent?\n if (options.responsive && elem[0].clientHeight === 0) {\n $timeout(function () {\n createChart(type, scope, elem);\n }, 50, false);\n return false;\n }\n return true;\n }\n\n function destroyChart(scope) {\n if(! scope.chart) return;\n scope.chart.destroy();\n scope.$emit('chart-destroy', scope.chart);\n }\n }\n}));\n"]} \ No newline at end of file diff --git a/static/node_modules/angular-chart.js/examples/amd.html b/static/node_modules/angular-chart.js/examples/amd.html deleted file mode 100644 index a1946efd..00000000 --- a/static/node_modules/angular-chart.js/examples/amd.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - AMD - - - -
-
-
-
-
-
AMD require.js
-
- -
-
-
-
-
- - - - diff --git a/static/node_modules/angular-chart.js/examples/amd.js b/static/node_modules/angular-chart.js/examples/amd.js deleted file mode 100644 index 0c04eaab..00000000 --- a/static/node_modules/angular-chart.js/examples/amd.js +++ /dev/null @@ -1,32 +0,0 @@ -(function () { - 'use strict'; - - require.config({ - paths: { - angular: '../node_modules/angular/angular.min', - chart: '../node_modules/chart.js/dist/Chart.min', - 'angular-chart': '../angular-chart' - }, - shim: { - angular: { - exports: 'angular' - }, - 'chart.js': { - deps: ['angular', 'chart'] - } - } - }); - - define(['angular', 'angular-chart'], function (angular/*, angularChart*/) { - var app = angular.module('examples', ['chart.js']); - app.controller('RequireCtrl', ['$scope', function ($scope) { - $scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; - $scope.series = ['Series A', 'Series B']; - $scope.data = [ - [65, 59, 80, 81, 56, 55, 40], - [28, 48, 40, 19, 86, 27, 90] - ]; - }]); - }); - -})(); diff --git a/static/node_modules/angular-chart.js/examples/app.css b/static/node_modules/angular-chart.js/examples/app.css deleted file mode 100644 index 8b18814c..00000000 --- a/static/node_modules/angular-chart.js/examples/app.css +++ /dev/null @@ -1,80 +0,0 @@ -body { padding-top: 50px; } - -.nav, .pagination, .carousel, .panel-title a { cursor: pointer; } - -#hero-bar { - position: absolute; - left: 0; - top: 0; - z-index: 1; - padding-right: 0; -} - -.container-fluid { - padding-left: 0; - padding-right: 0; -} - -.aspect-ratio { - width: 100%; - padding-bottom: 25%; - position: relative; -} - -.header { - position: absolute; - left: 0; - width: 100%; - top: 50%; - font-size: larger; - z-index: 500; -} - -.panel-heading { - font-weight: bold; -} - -.code .nav-tabs>li.active>a, .code .nav-tabs>li.active>a:hover, .code .nav-tabs>li.active>a:focus { - background-color: #f8f8f8; - border: 1px solid #ccc; - border-bottom-color: transparent; -} - -.code pre, .code code { - background-color: #f8f8f8; - border-top: none; - border-top-left-radius: 0; - border-top-right-radius: 0; -} - -.settings > a, .settings { - background-color: white ! important; -} - -.nav-tabs > li > a { - border-bottom: 1px solid #ccc; - margin-right: 0; -} - -.settings > a.active { - border: 1px solid transparent; -} - -div.settings { - border: 1px solid #ccc; - border-top: 0; - padding: 9.5px; - margin: 0 0 10px -} - -div.settings > code { - border-top: 1px solid #eaeaea; -} - -.footer { - text-align: center; - padding: 30px 0; - margin-top: 70px; - border-top: 1px solid #e5e5e5; - background-color: #f5f5f5; -} \ No newline at end of file diff --git a/static/node_modules/angular-chart.js/examples/app.js b/static/node_modules/angular-chart.js/examples/app.js deleted file mode 100644 index 282edaaf..00000000 --- a/static/node_modules/angular-chart.js/examples/app.js +++ /dev/null @@ -1,311 +0,0 @@ -(function () { - 'use strict'; - - var app = angular.module('examples', ['chart.js', 'ui.bootstrap']); - - app.config(function (ChartJsProvider) { - // Configure all charts - ChartJsProvider.setOptions({ - colors: ['#97BBCD', '#DCDCDC', '#F7464A', '#46BFBD', '#FDB45C', '#949FB1', '#4D5360'] - }); - // Configure all doughnut charts - ChartJsProvider.setOptions('doughnut', { - cutoutPercentage: 60 - }); - ChartJsProvider.setOptions('bubble', { - tooltips: { enabled: false } - }); - }); - - app.controller('MenuCtrl', ['$scope', function ($scope) { - $scope.isCollapsed = true; - $scope.charts = ['Line', 'Bar', 'Doughnut', 'Pie', 'Polar Area', 'Radar', 'Horizontal Bar', 'Bubble', 'Base']; - }]); - - app.controller('LineCtrl', ['$scope', function ($scope) { - $scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; - $scope.series = ['Series A', 'Series B']; - $scope.data = [ - [65, 59, 80, 81, 56, 55, 40], - [28, 48, 40, 19, 86, 27, 90] - ]; - $scope.onClick = function (points, evt) { - console.log(points, evt); - }; - $scope.onHover = function (points) { - if (points.length > 0) { - console.log('Point', points[0].value); - } else { - console.log('No point'); - } - }; - $scope.datasetOverride = [{ yAxisID: 'y-axis-1' }, { yAxisID: 'y-axis-2' }]; - - $scope.options = { - scales: { - yAxes: [ - { - id: 'y-axis-1', - type: 'linear', - display: true, - position: 'left' - }, - { - id: 'y-axis-2', - type: 'linear', - display: true, - position: 'right' - } - ] - } - }; - }]); - - app.controller('BarCtrl', ['$scope', function ($scope) { - $scope.options = { legend: { display: true } }; - $scope.labels = ['2006', '2007', '2008', '2009', '2010', '2011', '2012']; - $scope.series = ['Series A', 'Series B']; - $scope.data = [ - [65, 59, 80, 81, 56, 55, 40], - [28, 48, 40, 19, 86, 27, 90] - ]; - }]); - - app.controller('DoughnutCtrl', ['$scope', '$timeout', function ($scope, $timeout) { - $scope.labels = ['Download Sales', 'In-Store Sales', 'Mail-Order Sales']; - $scope.data = [0, 0, 0]; - - $timeout(function () { - $scope.data = [350, 450, 100]; - }, 500); - }]); - - app.controller('PieCtrl', ['$scope', function ($scope) { - $scope.labels = ['Download Sales', 'In-Store Sales', 'Mail Sales']; - $scope.data = [300, 500, 100]; - $scope.options = { legend: { display: false } }; - }]); - - app.controller('PolarAreaCtrl', ['$scope', function ($scope) { - $scope.labels = ['Download Sales', 'In-Store Sales', 'Mail Sales', 'Telesales', 'Corporate Sales']; - $scope.data = [300, 500, 100, 40, 120]; - $scope.options = { legend: { display: false } }; - }]); - - app.controller('BaseCtrl', ['$scope', function ($scope) { - $scope.labels = ['Download Sales', 'Store Sales', 'Mail Sales', 'Telesales', 'Corporate Sales']; - $scope.data = [300, 500, 100, 40, 120]; - $scope.type = 'polarArea'; - - $scope.toggle = function () { - $scope.type = $scope.type === 'polarArea' ? 'pie' : 'polarArea'; - }; - }]); - - app.controller('RadarCtrl', ['$scope', function ($scope) { - $scope.labels = ['Eating', 'Drinking', 'Sleeping', 'Designing', 'Coding', 'Cycling', 'Running']; - $scope.options = { legend: { display: false } }; - - $scope.data = [ - [65, 59, 90, 81, 56, 55, 40], - [28, 48, 40, 19, 96, 27, 100] - ]; - - $scope.onClick = function (points, evt) { - console.log(points, evt); - }; - }]); - - app.controller('StackedBarCtrl', ['$scope', function ($scope) { - $scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; - $scope.type = 'StackedBar'; - $scope.series = ['2015', '2016']; - $scope.options = { - scales: { - xAxes: [{ - stacked: true, - }], - yAxes: [{ - stacked: true - }] - } - }; - - $scope.data = [ - [65, 59, 90, 81, 56, 55, 40], - [28, 48, 40, 19, 96, 27, 100] - ]; - }]); - - app.controller('TabsCtrl', ['$scope', function ($scope) { - $scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; - $scope.active = true; - $scope.data = [ - [65, 59, 90, 81, 56, 55, 40], - [28, 48, 40, 19, 96, 27, 100] - ]; - }]); - - app.controller('MixedChartCtrl', ['$scope', function ($scope) { - $scope.colors = ['#45b7cd', '#ff6384', '#ff8e72']; - - $scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; - $scope.data = [ - [65, -59, 80, 81, -56, 55, -40], - [28, 48, -40, 19, 86, 27, 90] - ]; - $scope.datasetOverride = [ - { - label: 'Bar chart', - borderWidth: 1, - type: 'bar' - }, - { - label: 'Line chart', - borderWidth: 3, - hoverBackgroundColor: 'rgba(255,99,132,0.4)', - hoverBorderColor: 'rgba(255,99,132,1)', - type: 'line' - } - ]; - }]); - - app.controller('DataTablesCtrl', ['$scope', function ($scope) { - $scope.labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July']; - $scope.data = [ - [65, 59, 80, 81, 56, 55, 40], - [28, 48, 40, 19, 86, 27, 90] - ]; - $scope.colors = [ - { // grey - backgroundColor: 'rgba(148,159,177,0.2)', - pointBackgroundColor: 'rgba(148,159,177,1)', - pointHoverBackgroundColor: 'rgba(148,159,177,1)', - borderColor: 'rgba(148,159,177,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(148,159,177,0.8)' - }, - { // dark grey - backgroundColor: 'rgba(77,83,96,0.2)', - pointBackgroundColor: 'rgba(77,83,96,1)', - pointHoverBackgroundColor: 'rgba(77,83,96,1)', - borderColor: 'rgba(77,83,96,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(77,83,96,0.8)' - } - ]; - $scope.options = { legend: { display: false } }; - $scope.randomize = function () { - $scope.data = $scope.data.map(function (data) { - return data.map(function (y) { - y = y + Math.random() * 10 - 5; - return parseInt(y < 0 ? 0 : y > 100 ? 100 : y); - }); - }); - }; - }]); - - app.controller('BubbleCtrl', ['$scope', '$interval', function ($scope, $interval) { - $scope.options = { - scales: { - xAxes: [{ - display: false, - ticks: { - max: 125, - min: -125, - stepSize: 10 - } - }], - yAxes: [{ - display: false, - ticks: { - max: 125, - min: -125, - stepSize: 10 - } - }] - } - }; - - createChart(); - $interval(createChart, 2000); - - function createChart () { - $scope.data = []; - for (var i = 0; i < 50; i++) { - $scope.data.push([{ - x: randomScalingFactor(), - y: randomScalingFactor(), - r: randomRadius() - }]); - } - } - - function randomScalingFactor () { - return (Math.random() > 0.5 ? 1.0 : -1.0) * Math.round(Math.random() * 100); - } - - function randomRadius () { - return Math.abs(randomScalingFactor()) / 4; - } - }]); - - app.controller('TicksCtrl', ['$scope', '$interval', function ($scope, $interval) { - var maximum = document.getElementById('container').clientWidth / 2 || 300; - $scope.data = [[]]; - $scope.labels = []; - $scope.options = { - animation: { - duration: 0 - }, - elements: { - line: { - borderWidth: 0.5 - }, - point: { - radius: 0 - } - }, - legend: { - display: false - }, - scales: { - xAxes: [{ - display: false - }], - yAxes: [{ - display: false - }], - gridLines: { - display: false - } - }, - tooltips: { - enabled: false - } - }; - - // Update the dataset at 25FPS for a smoothly-animating chart - $interval(function () { - getLiveChartData(); - }, 40); - - function getLiveChartData () { - if ($scope.data[0].length) { - $scope.labels = $scope.labels.slice(1); - $scope.data[0] = $scope.data[0].slice(1); - } - - while ($scope.data[0].length < maximum) { - $scope.labels.push(''); - $scope.data[0].push(getRandomValue($scope.data[0])); - } - } - }]); - - function getRandomValue (data) { - var l = data.length, previous = l ? data[l - 1] : 50; - var y = previous + Math.random() * 10 - 5; - return y < 0 ? 0 : y > 100 ? 100 : y; - } -})(); diff --git a/static/node_modules/angular-chart.js/examples/bubble.html b/static/node_modules/angular-chart.js/examples/bubble.html deleted file mode 100644 index bdc233bc..00000000 --- a/static/node_modules/angular-chart.js/examples/bubble.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - Bubble chart - - - -
-
-
-
-
-
Bubble chart
-
- -
-
-
-
-
- - - - - - - diff --git a/static/node_modules/angular-chart.js/examples/bubble.js b/static/node_modules/angular-chart.js/examples/bubble.js deleted file mode 100644 index 4ae5a126..00000000 --- a/static/node_modules/angular-chart.js/examples/bubble.js +++ /dev/null @@ -1,55 +0,0 @@ -angular.module('app', ['chart.js']) - .config(['ChartJsProvider', function (ChartJsProvider) { - 'use strict'; - ChartJsProvider.setOptions({ - tooltips: { enabled: false } - }); - }]) - .controller('BubbleCtrl', ['$scope', '$interval', function ($scope, $interval) { - 'use strict'; - - $scope.options = { - scales: { - xAxes: [{ - display: false, - ticks: { - max: 125, - min: -125, - stepSize: 10 - } - }], - yAxes: [{ - display: false, - ticks: { - max: 125, - min: -125, - stepSize: 10 - } - }] - } - }; - - createChart(); - $interval(createChart, 2000); - - function createChart () { - $scope.series = []; - $scope.data = []; - for (var i = 0; i < 50; i++) { - $scope.series.push(`Series ${i}`); - $scope.data.push([{ - x: randomScalingFactor(), - y: randomScalingFactor(), - r: randomRadius() - }]); - } - } - - function randomScalingFactor () { - return (Math.random() > 0.5 ? 1.0 : -1.0) * Math.round(Math.random() * 100); - } - - function randomRadius () { - return Math.abs(randomScalingFactor()) / 4; - } - }]); diff --git a/static/node_modules/angular-chart.js/examples/charts.html b/static/node_modules/angular-chart.js/examples/charts.html deleted file mode 100644 index 2365d4a9..00000000 --- a/static/node_modules/angular-chart.js/examples/charts.html +++ /dev/null @@ -1,701 +0,0 @@ - - - - - Charts - - - - - - - - -
-
- -
-

- Angular Chart -

- -

Reactive, responsive, beautiful charts for AngularJS based on Chart.js

- -

- Code on Github - - Download (1.1.1) - -

-
-
-
-
-
- -

Dependencies

-

- This repository contains a set of native AngularJS directives for Chart.js. The only required dependencies are: -

- -

Files to download

-

- The easiest is to download with npm: -

npm install angular-chart.js --save
- Alternatively files can be downloaded from Github or via PolarArea. - See readme for more information. -

-

Whichever method you choose the good news is that the overall size is very small: - <5kb for all directives (~1kb with gzip compression!)

-

Installation

-

You need to include the dependencies in your page:

-
<script src="node_modules/chart.js/Chart.min.js"></script>
-<script src="node_modules/angular-chart.js/dist/angular-chart.min.js"></script>
-

As soon as you've got all the files downloaded and included in your page you just need to declare - a dependency on the chart.js module:
-

angular.module('myModule', ['chart.js']);
-

-

CSS

-

-

Colors

-

Series have beautiful pre-sets colors (to a maximum of 7 series, after that colors will be randomly generated). - They can be overwritten using Chart.defaults.global.colors.

-
    -
  1. Blue
  2. -
  3. Light grey
  4. -
  5. Red
  6. -
  7. Green
  8. -
  9. Yellow
  10. -
  11. Grey
  12. -
  13. Dark Grey
  14. -
-

You can also use the provider : ChartJsProvider in a .config()

-

(function (ChartJsProvider) {
-  ChartJsProvider.setOptions({ colors : [ '#803690', '#00ADF9', '#DCDCDC', '#46BFBD', '#FDB45C', '#949FB1', '#4D5360'] });
-}); 

-
-
- -
-
-
-
Line Chart
-
- -
-
-
-
- - -
- .chart-line -
    -
  • chart-data: series data
  • -
  • chart-labels: x axis labels
  • -
  • chart-options (default: {}): Chart.js options
  • -
  • chart-series (default: []): series labels
  • -
  • chart-click (optional): onclick event handler
  • -
  • chart-hover (optional): onmousemove event handler
  • -
  • chart-colors (default to global colors): colors for the chart
  • -
  • chart-dataset-override (optional): override datasets individually
  • -
-
-
- -
<canvas id="line" class="chart chart-line" chart-data="data"
-chart-labels="labels" chart-series="series" chart-options="options"
-chart-dataset-override="datasetOverride" chart-click="onClick">
-</canvas>
-
- -
angular.module("app", ["chart.js"]).controller("LineCtrl", function ($scope) {
-
-  $scope.labels = ["January", "February", "March", "April", "May", "June", "July"];
-  $scope.series = ['Series A', 'Series B'];
-  $scope.data = [
-    [65, 59, 80, 81, 56, 55, 40],
-    [28, 48, 40, 19, 86, 27, 90]
-  ];
-  $scope.onClick = function (points, evt) {
-    console.log(points, evt);
-  };
-  $scope.datasetOverride = [{ yAxisID: 'y-axis-1' }, { yAxisID: 'y-axis-2' }];
-  $scope.options = {
-    scales: {
-      yAxes: [
-        {
-          id: 'y-axis-1',
-          type: 'linear',
-          display: true,
-          position: 'left'
-        },
-        {
-          id: 'y-axis-2',
-          type: 'linear',
-          display: true,
-          position: 'right'
-        }
-      ]
-    }
-  };
-});
-              
-
-
-
-
-
-
- - -
- .chart-bar -
    -
  • chart-data: series data
  • -
  • chart-labels: x axis labels
  • -
  • chart-options (default: {}): Chart.js options
  • -
  • chart-series (default: []): series labels
  • -
  • chart-click (optional): onclick event handler
  • -
  • chart-hover (optional): onmousemove event handler
  • -
  • chart-colors (default to global colors): colors for the chart
  • -
  • chart-dataset-override (optional): override datasets individually
  • -
-
-
- -
<canvas id="bar" class="chart chart-bar"
-  chart-data="data" chart-labels="labels"> chart-series="series"
-</canvas>
-
- -
angular.module("app", ["chart.js"]).controller("BarCtrl", function ($scope) {
-  $scope.labels = ['2006', '2007', '2008', '2009', '2010', '2011', '2012'];
-  $scope.series = ['Series A', 'Series B'];
-
-  $scope.data = [
-    [65, 59, 80, 81, 56, 55, 40],
-    [28, 48, 40, 19, 86, 27, 90]
-  ];
-});
-              
-
-
-
-
-
-
Bar Chart
-
- -
-
-
-
-
-
-
-
Doughnut Chart
-
- -
-
-
-
- - -
- .chart-doughnut -
    -
  • chart-data: series data
  • -
  • chart-labels: series labels
  • -
  • chart-options (default: {}): Chart.js options
  • -
  • chart-click (optional): onclick event handler
  • -
  • chart-hover (optional): onmousemove event handler
  • -
  • chart-colors (default to global colors): colors for the chart
  • -
  • chart-dataset-override (optional): override datasets individually
  • -
-
-
- -
<canvas id="doughnut" class="chart chart-doughnut"
-  chart-data="data" chart-labels="labels">
-</canvas> 
-
- -
angular.module("app", ["chart.js"]).controller("DoughnutCtrl", function ($scope) {
-  $scope.labels = ["Download Sales", "In-Store Sales", "Mail-Order Sales"];
-  $scope.data = [300, 500, 100];
-});
-              
-
-
-
-
-
-
- - -
- .chart-radar -
    -
  • chart-data: series data
  • -
  • chart-labels: series labels
  • -
  • chart-options (default: {}): Chart.js options
  • -
  • chart-series (default: []): series labels
  • -
  • chart-click (optional): onclick event handler
  • -
  • chart-hover (optional): onmousemove event handler
  • -
  • chart-colors (default to global colors): colors for the chart
  • -
  • chart-dataset-override (optional): override datasets individually
  • -
-
-
- -
<canvas id="radar" class="chart chart-radar"
-  chart-data="data" chart-options="options" chart-labels="labels">
-</canvas> 
-
- -
angular.module("app", ["chart.js"]).controller("RadarCtrl", function ($scope) {
-  $scope.labels =["Eating", "Drinking", "Sleeping", "Designing", "Coding", "Cycling", "Running"];
-
-  $scope.data = [
-    [65, 59, 90, 81, 56, 55, 40],
-    [28, 48, 40, 19, 96, 27, 100]
-  ];
-});
-              
-
-
-
-
-
-
Radar Chart
-
- -
-
-
-
-
-
-
-
Pie Chart
-
- -
-
-
-
- - -
- .chart-pie -
    -
  • chart-data: series data
  • -
  • chart-labels: series labels
  • -
  • chart-options (default: {}): Chart.js options
  • -
  • chart-click (optional): onclick event handler
  • -
  • chart-hover (optional): onmousemove event handler
  • -
  • chart-colors (default to global colors): colors for the chart
  • -
  • chart-dataset-override (optional): override datasets individually
  • -
-
-
- -
<canvas id="pie" class="chart chart-pie"
-  chart-data="data" chart-labels="labels" chart-options="options">
-</canvas> 
-
- -
angular.module("app", ["chart.js"]).controller("PieCtrl", function ($scope) {
-  $scope.labels = ["Download Sales", "In-Store Sales", "Mail-Order Sales"];
-  $scope.data = [300, 500, 100];
-});
-              
-
-
-
-
-
-
- - -
- .chart-polar-area -
    -
  • chart-data: series data
  • -
  • chart-labels: series labels
  • -
  • chart-options (default: {}): Chart.js options
  • -
  • chart-click (optional): onclick event handler
  • -
  • chart-hover (optional): onmousemove event handler
  • -
  • chart-colors (default to global colors): colors for the chart
  • -
  • chart-dataset-override (optional): override datasets individually
  • -
-
-
- -
<canvas id="polar-area" class="chart chart-polar-area"
-  chart-data="data" chart-labels="labels" chart-options="options">
-</canvas> 
-
- -
angular.module("app", ["chart.js"]).controller("PolarAreaCtrl", function ($scope) {
-  $scope.labels = ["Download Sales", "In-Store Sales", "Mail-Order Sales", "Tele Sales", "Corporate Sales"];
-  $scope.data = [300, 500, 100, 40, 120];
-});
-              
-
-
-
-
-
-
Polar Area Chart
-
- -
-
-
-
-
-
-
-
Horizontal Bar Chart
-
- -
-
-
-
- - -
- .chart-horizontal-bar -
    -
  • chart-data: series data
  • -
  • chart-labels: x axis labels
  • -
  • chart-options (default: {}): Chart.js options
  • -
  • chart-series (default: []): series labels
  • -
  • chart-click (optional): onclick event handler
  • -
  • chart-hover (optional): onmousemove event handler
  • -
  • chart-colors (default to global colors): colors for the chart
  • -
  • chart-dataset-override (optional): override datasets individually
  • -
-
-
- -
<canvas id="base" class="chart-horizontal-bar"
-  chart-data="data" chart-labels="labels" >
-</canvas> 
-
- -
angular.module("app", ["chart.js"]).controller("BarCtrl",
-  function ($scope) {
-    $scope.labels = ['2006', '2007', '2008', '2009', '2010', '2011', '2012'];
-    $scope.series = ['Series A', 'Series B'];
-
-    $scope.data = [
-      [65, 59, 80, 81, 56, 55, 40],
-      [28, 48, 40, 19, 86, 27, 90]
-    ];
-});
-              
-
-
-
-
-
-
- - -
- .chart-bubble -
    -
  • chart-data: series data
  • -
  • chart-labels: x axis labels
  • -
  • chart-options (default: {}): Chart.js options
  • -
  • chart-series (default: []): series labels
  • -
  • chart-click (optional): onclick event handler
  • -
  • chart-hover (optional): onmousemove event handler
  • -
  • chart-colors (default to global colors): colors for the chart
  • -
  • chart-dataset-override (optional): override datasets individually
  • -
-
-
- -

-<canvas id="base" class="chart-bubble" chart-data="data"
-  chart-series="series" >
-</canvas> 
-
- -
angular.module("app", ["chart.js"]).controller("BubbleCtrl",
-  function ($scope) {
-    // see examples/bubble.js for random bubbles source code
-    $scope.series = ['Series A', 'Series B'];
-
-    $scope.data = [
-      [{
-        x: 40,
-        y: 10,
-        r: 20
-      }],
-      [{
-        x: 10,
-        y: 40,
-        r: 50
-      }]
-    ];
-});
-              
-
-
-
-
-
-
Bubble Chart
-
- -
-
-
-
-
-
-
-
Dynamic Chart
-
- -
-
- -
-
- - -
- .chart-base -
    -
  • chart-type: chart type e.g. bar, polarArea, etc. or other plugins
  • -
  • other options according to chart type
  • -
-
-
- -
<canvas id="base" class="chart-base" chart-type="type"
-  chart-data="data" chart-labels="labels" >
-</canvas> 
-
- -
angular.module("app", ["chart.js"]).controller("BaseCtrl",
-  function ($scope) {
-    $scope.labels = ["Download Sales", "In-Store Sales", "Mail-Order Sales", "Tele Sales", "Corporate Sales"];
-    $scope.data = [300, 500, 100, 40, 120];
-    $scope.type = 'polarArea';
-
-    $scope.toggle = function () {
-      $scope.type = $scope.type === 'polarArea' ?
-        'pie' : 'polarArea';
-    };
-});
-              
-
-
-
-
-
-
- -
-
-
-
Reactive Chart
-
- -
-
-
-
-
-
Chart Data
-
- - - - - - - -
{{label}}
{{data[$parent.$index][$index]}}
- -
-
-
-
-
-
- -
-
- - -
<canvas id="base" class="chart-bar"
-  chart-data="data" chart-labels="labels" chart-colors="colors"
-  chart-dataset-override="datasetOverride" >
-</canvas> 
-
- -
angular.module("app", ["chart.js"]).controller("MixedChartCtrl",
-  function ($scope) {
-    $scope.colors = ['#45b7cd', '#ff6384', '#ff8e72'];
-
-    $scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
-    $scope.data = [
-      [65, -59, 80, 81, -56, 55, -40],
-      [28, 48, -40, 19, 86, 27, 90]
-    ];
-    $scope.datasetOverride = [
-      {
-        label: "Bar chart",
-        borderWidth: 1,
-        type: 'bar'
-      },
-      {
-        label: "Line chart",
-        borderWidth: 3,
-        hoverBackgroundColor: "rgba(255,99,132,0.4)",
-        hoverBorderColor: "rgba(255,99,132,1)",
-        type: 'line'
-      }
-    ];
-});
-              
-
-
-
-
-
-
Bar line Chart
-
- -
-
-
-
-
-
- - - - - - - - - - - - - - diff --git a/static/node_modules/angular-chart.js/examples/charts.template.html b/static/node_modules/angular-chart.js/examples/charts.template.html deleted file mode 100644 index db723dd1..00000000 --- a/static/node_modules/angular-chart.js/examples/charts.template.html +++ /dev/null @@ -1,701 +0,0 @@ - - - - - Charts - - - - - - - - -
-
- -
-

- Angular Chart -

- -

Reactive, responsive, beautiful charts for AngularJS based on Chart.js

- -

- Code on Github - - Download () - -

-
-
-
-
-
- -

Dependencies

-

- This repository contains a set of native AngularJS directives for Chart.js. The only required dependencies are: -

- -

Files to download

-

- The easiest is to download with npm: -

npm install angular-chart.js --save
- Alternatively files can be downloaded from Github or via PolarArea. - See readme for more information. -

-

Whichever method you choose the good news is that the overall size is very small: - <5kb for all directives (~1kb with gzip compression!)

-

Installation

-

You need to include the dependencies in your page:

-
<script src="node_modules/chart.js/Chart.min.js"></script>
-<script src="node_modules/angular-chart.js/dist/angular-chart.min.js"></script>
-

As soon as you've got all the files downloaded and included in your page you just need to declare - a dependency on the chart.js module:
-

angular.module('myModule', ['chart.js']);
-

-

CSS

-

-

Colors

-

Series have beautiful pre-sets colors (to a maximum of 7 series, after that colors will be randomly generated). - They can be overwritten using Chart.defaults.global.colors.

-
    -
  1. Blue
  2. -
  3. Light grey
  4. -
  5. Red
  6. -
  7. Green
  8. -
  9. Yellow
  10. -
  11. Grey
  12. -
  13. Dark Grey
  14. -
-

You can also use the provider : ChartJsProvider in a .config()

-

(function (ChartJsProvider) {
-  ChartJsProvider.setOptions({ colors : [ '#803690', '#00ADF9', '#DCDCDC', '#46BFBD', '#FDB45C', '#949FB1', '#4D5360'] });
-}); 

-
-
- -
-
-
-
Line Chart
-
- -
-
-
-
- - -
- .chart-line -
    -
  • chart-data: series data
  • -
  • chart-labels: x axis labels
  • -
  • chart-options (default: {}): Chart.js options
  • -
  • chart-series (default: []): series labels
  • -
  • chart-click (optional): onclick event handler
  • -
  • chart-hover (optional): onmousemove event handler
  • -
  • chart-colors (default to global colors): colors for the chart
  • -
  • chart-dataset-override (optional): override datasets individually
  • -
-
-
- -
<canvas id="line" class="chart chart-line" chart-data="data"
-chart-labels="labels" chart-series="series" chart-options="options"
-chart-dataset-override="datasetOverride" chart-click="onClick">
-</canvas>
-
- -
angular.module("app", ["chart.js"]).controller("LineCtrl", function ($scope) {
-
-  $scope.labels = ["January", "February", "March", "April", "May", "June", "July"];
-  $scope.series = ['Series A', 'Series B'];
-  $scope.data = [
-    [65, 59, 80, 81, 56, 55, 40],
-    [28, 48, 40, 19, 86, 27, 90]
-  ];
-  $scope.onClick = function (points, evt) {
-    console.log(points, evt);
-  };
-  $scope.datasetOverride = [{ yAxisID: 'y-axis-1' }, { yAxisID: 'y-axis-2' }];
-  $scope.options = {
-    scales: {
-      yAxes: [
-        {
-          id: 'y-axis-1',
-          type: 'linear',
-          display: true,
-          position: 'left'
-        },
-        {
-          id: 'y-axis-2',
-          type: 'linear',
-          display: true,
-          position: 'right'
-        }
-      ]
-    }
-  };
-});
-              
-
-
-
-
-
-
- - -
- .chart-bar -
    -
  • chart-data: series data
  • -
  • chart-labels: x axis labels
  • -
  • chart-options (default: {}): Chart.js options
  • -
  • chart-series (default: []): series labels
  • -
  • chart-click (optional): onclick event handler
  • -
  • chart-hover (optional): onmousemove event handler
  • -
  • chart-colors (default to global colors): colors for the chart
  • -
  • chart-dataset-override (optional): override datasets individually
  • -
-
-
- -
<canvas id="bar" class="chart chart-bar"
-  chart-data="data" chart-labels="labels"> chart-series="series"
-</canvas>
-
- -
angular.module("app", ["chart.js"]).controller("BarCtrl", function ($scope) {
-  $scope.labels = ['2006', '2007', '2008', '2009', '2010', '2011', '2012'];
-  $scope.series = ['Series A', 'Series B'];
-
-  $scope.data = [
-    [65, 59, 80, 81, 56, 55, 40],
-    [28, 48, 40, 19, 86, 27, 90]
-  ];
-});
-              
-
-
-
-
-
-
Bar Chart
-
- -
-
-
-
-
-
-
-
Doughnut Chart
-
- -
-
-
-
- - -
- .chart-doughnut -
    -
  • chart-data: series data
  • -
  • chart-labels: series labels
  • -
  • chart-options (default: {}): Chart.js options
  • -
  • chart-click (optional): onclick event handler
  • -
  • chart-hover (optional): onmousemove event handler
  • -
  • chart-colors (default to global colors): colors for the chart
  • -
  • chart-dataset-override (optional): override datasets individually
  • -
-
-
- -
<canvas id="doughnut" class="chart chart-doughnut"
-  chart-data="data" chart-labels="labels">
-</canvas> 
-
- -
angular.module("app", ["chart.js"]).controller("DoughnutCtrl", function ($scope) {
-  $scope.labels = ["Download Sales", "In-Store Sales", "Mail-Order Sales"];
-  $scope.data = [300, 500, 100];
-});
-              
-
-
-
-
-
-
- - -
- .chart-radar -
    -
  • chart-data: series data
  • -
  • chart-labels: series labels
  • -
  • chart-options (default: {}): Chart.js options
  • -
  • chart-series (default: []): series labels
  • -
  • chart-click (optional): onclick event handler
  • -
  • chart-hover (optional): onmousemove event handler
  • -
  • chart-colors (default to global colors): colors for the chart
  • -
  • chart-dataset-override (optional): override datasets individually
  • -
-
-
- -
<canvas id="radar" class="chart chart-radar"
-  chart-data="data" chart-options="options" chart-labels="labels">
-</canvas> 
-
- -
angular.module("app", ["chart.js"]).controller("RadarCtrl", function ($scope) {
-  $scope.labels =["Eating", "Drinking", "Sleeping", "Designing", "Coding", "Cycling", "Running"];
-
-  $scope.data = [
-    [65, 59, 90, 81, 56, 55, 40],
-    [28, 48, 40, 19, 96, 27, 100]
-  ];
-});
-              
-
-
-
-
-
-
Radar Chart
-
- -
-
-
-
-
-
-
-
Pie Chart
-
- -
-
-
-
- - -
- .chart-pie -
    -
  • chart-data: series data
  • -
  • chart-labels: series labels
  • -
  • chart-options (default: {}): Chart.js options
  • -
  • chart-click (optional): onclick event handler
  • -
  • chart-hover (optional): onmousemove event handler
  • -
  • chart-colors (default to global colors): colors for the chart
  • -
  • chart-dataset-override (optional): override datasets individually
  • -
-
-
- -
<canvas id="pie" class="chart chart-pie"
-  chart-data="data" chart-labels="labels" chart-options="options">
-</canvas> 
-
- -
angular.module("app", ["chart.js"]).controller("PieCtrl", function ($scope) {
-  $scope.labels = ["Download Sales", "In-Store Sales", "Mail-Order Sales"];
-  $scope.data = [300, 500, 100];
-});
-              
-
-
-
-
-
-
- - -
- .chart-polar-area -
    -
  • chart-data: series data
  • -
  • chart-labels: series labels
  • -
  • chart-options (default: {}): Chart.js options
  • -
  • chart-click (optional): onclick event handler
  • -
  • chart-hover (optional): onmousemove event handler
  • -
  • chart-colors (default to global colors): colors for the chart
  • -
  • chart-dataset-override (optional): override datasets individually
  • -
-
-
- -
<canvas id="polar-area" class="chart chart-polar-area"
-  chart-data="data" chart-labels="labels" chart-options="options">
-</canvas> 
-
- -
angular.module("app", ["chart.js"]).controller("PolarAreaCtrl", function ($scope) {
-  $scope.labels = ["Download Sales", "In-Store Sales", "Mail-Order Sales", "Tele Sales", "Corporate Sales"];
-  $scope.data = [300, 500, 100, 40, 120];
-});
-              
-
-
-
-
-
-
Polar Area Chart
-
- -
-
-
-
-
-
-
-
Horizontal Bar Chart
-
- -
-
-
-
- - -
- .chart-horizontal-bar -
    -
  • chart-data: series data
  • -
  • chart-labels: x axis labels
  • -
  • chart-options (default: {}): Chart.js options
  • -
  • chart-series (default: []): series labels
  • -
  • chart-click (optional): onclick event handler
  • -
  • chart-hover (optional): onmousemove event handler
  • -
  • chart-colors (default to global colors): colors for the chart
  • -
  • chart-dataset-override (optional): override datasets individually
  • -
-
-
- -
<canvas id="base" class="chart-horizontal-bar"
-  chart-data="data" chart-labels="labels" >
-</canvas> 
-
- -
angular.module("app", ["chart.js"]).controller("BarCtrl",
-  function ($scope) {
-    $scope.labels = ['2006', '2007', '2008', '2009', '2010', '2011', '2012'];
-    $scope.series = ['Series A', 'Series B'];
-
-    $scope.data = [
-      [65, 59, 80, 81, 56, 55, 40],
-      [28, 48, 40, 19, 86, 27, 90]
-    ];
-});
-              
-
-
-
-
-
-
- - -
- .chart-bubble -
    -
  • chart-data: series data
  • -
  • chart-labels: x axis labels
  • -
  • chart-options (default: {}): Chart.js options
  • -
  • chart-series (default: []): series labels
  • -
  • chart-click (optional): onclick event handler
  • -
  • chart-hover (optional): onmousemove event handler
  • -
  • chart-colors (default to global colors): colors for the chart
  • -
  • chart-dataset-override (optional): override datasets individually
  • -
-
-
- -

-<canvas id="base" class="chart-bubble" chart-data="data"
-  chart-series="series" >
-</canvas> 
-
- -
angular.module("app", ["chart.js"]).controller("BubbleCtrl",
-  function ($scope) {
-    // see examples/bubble.js for random bubbles source code
-    $scope.series = ['Series A', 'Series B'];
-
-    $scope.data = [
-      [{
-        x: 40,
-        y: 10,
-        r: 20
-      }],
-      [{
-        x: 10,
-        y: 40,
-        r: 50
-      }]
-    ];
-});
-              
-
-
-
-
-
-
Bubble Chart
-
- -
-
-
-
-
-
-
-
Dynamic Chart
-
- -
-
- -
-
- - -
- .chart-base -
    -
  • chart-type: chart type e.g. bar, polarArea, etc. or other plugins
  • -
  • other options according to chart type
  • -
-
-
- -
<canvas id="base" class="chart-base" chart-type="type"
-  chart-data="data" chart-labels="labels" >
-</canvas> 
-
- -
angular.module("app", ["chart.js"]).controller("BaseCtrl",
-  function ($scope) {
-    $scope.labels = ["Download Sales", "In-Store Sales", "Mail-Order Sales", "Tele Sales", "Corporate Sales"];
-    $scope.data = [300, 500, 100, 40, 120];
-    $scope.type = 'polarArea';
-
-    $scope.toggle = function () {
-      $scope.type = $scope.type === 'polarArea' ?
-        'pie' : 'polarArea';
-    };
-});
-              
-
-
-
-
-
-
- -
-
-
-
Reactive Chart
-
- -
-
-
-
-
-
Chart Data
-
- - - - - - - -
{{label}}
{{data[$parent.$index][$index]}}
- -
-
-
-
-
-
- -
-
- - -
<canvas id="base" class="chart-bar"
-  chart-data="data" chart-labels="labels" chart-colors="colors"
-  chart-dataset-override="datasetOverride" >
-</canvas> 
-
- -
angular.module("app", ["chart.js"]).controller("MixedChartCtrl",
-  function ($scope) {
-    $scope.colors = ['#45b7cd', '#ff6384', '#ff8e72'];
-
-    $scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
-    $scope.data = [
-      [65, -59, 80, 81, -56, 55, -40],
-      [28, 48, -40, 19, 86, 27, 90]
-    ];
-    $scope.datasetOverride = [
-      {
-        label: "Bar chart",
-        borderWidth: 1,
-        type: 'bar'
-      },
-      {
-        label: "Line chart",
-        borderWidth: 3,
-        hoverBackgroundColor: "rgba(255,99,132,0.4)",
-        hoverBorderColor: "rgba(255,99,132,1)",
-        type: 'line'
-      }
-    ];
-});
-              
-
-
-
-
-
-
Bar line Chart
-
- -
-
-
-
-
-
- - - - - - - - - - - - - - diff --git a/static/node_modules/angular-chart.js/examples/commonjs.html b/static/node_modules/angular-chart.js/examples/commonjs.html deleted file mode 100644 index b038f950..00000000 --- a/static/node_modules/angular-chart.js/examples/commonjs.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - - CommonJS - - - -
-
-
-
-
-
CommonJS
-
- -
-
-
-
-
- - - - diff --git a/static/node_modules/angular-chart.js/examples/commonjs.js b/static/node_modules/angular-chart.js/examples/commonjs.js deleted file mode 100644 index 23157482..00000000 --- a/static/node_modules/angular-chart.js/examples/commonjs.js +++ /dev/null @@ -1,19 +0,0 @@ -(function () { - 'use strict'; - - var angular = require('angular'); - - var app = angular.module('app', [ - require('angular-chart') - ]); - - app.controller('CommonJSCtrl', ['$scope', function ($scope) { - $scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; - $scope.series = ['Series A', 'Series B']; - $scope.data = [ - [65, 59, 80, 81, 56, 55, 40], - [28, 48, 40, 19, 86, 27, 90] - ]; - }]); - -})(); diff --git a/static/node_modules/angular-chart.js/examples/dataset-override.html b/static/node_modules/angular-chart.js/examples/dataset-override.html deleted file mode 100644 index 7d60e395..00000000 --- a/static/node_modules/angular-chart.js/examples/dataset-override.html +++ /dev/null @@ -1,38 +0,0 @@ - - - - - Charts with datasets overrides - - - -
-
-
-
-
-
Mixed chart
-
- -
-
-
-
-
-
Doughnut dataset override
-
- -
-
-
-
-
- - - - - - - diff --git a/static/node_modules/angular-chart.js/examples/dataset-override.js b/static/node_modules/angular-chart.js/examples/dataset-override.js deleted file mode 100644 index e7cf76da..00000000 --- a/static/node_modules/angular-chart.js/examples/dataset-override.js +++ /dev/null @@ -1,32 +0,0 @@ -angular.module('app', ['chart.js']).controller('OverrideCtrl', ['$scope', function ($scope) { - 'use strict'; - - $scope.colors = ['#45b7cd', '#ff6384', '#ff8e72']; - - $scope.labels1 = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; - $scope.data1 = [ - [65, -59, 80, 81, -56, 55, -40], - [28, 48, -40, 19, 86, 27, 90] - ]; - $scope.datasetOverride1 = [ - { - label: 'Override Series A', - borderWidth: 1, - type: 'bar' - }, - { - label: 'Override Series B', - borderWidth: 3, - hoverBackgroundColor: 'rgba(255,99,132,0.4)', - hoverBorderColor: 'rgba(255,99,132,1)', - type: 'line' - } - ]; - - $scope.labels2 = ['Download Sales', 'In-Store Sales', 'Mail-Order Sales']; - $scope.data2 = [350, 450, 100]; - $scope.datasetOverride2 = { - hoverBackgroundColor: ['#45b7cd', '#ff6384', '#ff8e72'], - hoverBorderColor: ['#45b7cd', '#ff6384', '#ff8e72'] - }; -}]); diff --git a/static/node_modules/angular-chart.js/examples/scatter.html b/static/node_modules/angular-chart.js/examples/scatter.html deleted file mode 100644 index 82c54d85..00000000 --- a/static/node_modules/angular-chart.js/examples/scatter.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - Bubble chart - - - -
-
-
-
-
-
Scatter chart
-
- -
-
-
-
-
- - - - - - - diff --git a/static/node_modules/angular-chart.js/examples/scatter.js b/static/node_modules/angular-chart.js/examples/scatter.js deleted file mode 100644 index 5d60f6b2..00000000 --- a/static/node_modules/angular-chart.js/examples/scatter.js +++ /dev/null @@ -1,30 +0,0 @@ -(function () { - 'use strict'; - - var app = angular.module('app', ['chart.js']); - - app.controller('ScatterCtrl', ['$scope', function ($scope) { - $scope.data = [[{ - x: -10, - y: -5 - }, { - x: 0, - y: 10 - }, { - x: 10, - y: 5 - }]]; - - $scope.options = { - scales: { - xAxes: [{ - type: 'linear', - position: 'bottom' - }] - } - }; - - }]); - - -})(); diff --git a/static/node_modules/angular-chart.js/examples/smoothscroll.min.js b/static/node_modules/angular-chart.js/examples/smoothscroll.min.js deleted file mode 100644 index 631953c3..00000000 --- a/static/node_modules/angular-chart.js/examples/smoothscroll.min.js +++ /dev/null @@ -1 +0,0 @@ -window.smoothScroll=function(){if(document.querySelectorAll===void 0||window.pageYOffset===void 0||history.pushState===void 0){return}var e=function(e){if(e.nodeName==="HTML")return-window.pageYOffset;return e.getBoundingClientRect().top+window.pageYOffset};var t=function(e){return e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1};var n=function(e,n,r,i){if(r>i)return n;return e+(n-e)*t(r/i)};var r=function(t,r,i){r=r||500;var s=window.pageYOffset;if(typeof t==="number"){var o=parseInt(t)}else{var o=e(t)}var u=Date.now();var a=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(e){window.setTimeout(e,15)};var f=function(){var e=Date.now()-u;window.scroll(0,n(s,o,e,r));if(e>r){if(typeof i==="function"){i(t)}}else{a(f)}};f()};var i=function(e){e.preventDefault();if(location.hash!==this.hash)window.history.pushState(null,null,this.hash);r(document.getElementById(this.hash.substring(1)),500,function(e){location.replace("#"+e.id)})};document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll('a[href^="#"]'),t;for(var n=e.length;t=e[--n];){t.addEventListener("click",i,false)}});return r}() diff --git a/static/node_modules/angular-chart.js/examples/stacked-bars.html b/static/node_modules/angular-chart.js/examples/stacked-bars.html deleted file mode 100644 index ce78e7fb..00000000 --- a/static/node_modules/angular-chart.js/examples/stacked-bars.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - Stacked Bar chart - - - -
-
-
-
-
-
-
Stacked Bar Chart
-
- -
-
-
-
-
- - - - - - - - diff --git a/static/node_modules/angular-chart.js/examples/tables.html b/static/node_modules/angular-chart.js/examples/tables.html deleted file mode 100644 index f21e5349..00000000 --- a/static/node_modules/angular-chart.js/examples/tables.html +++ /dev/null @@ -1,45 +0,0 @@ - - - - - Data tables - - - -
-
-
-
-
-
Chart Data
-
- - - - - - - -
{{label}}
{{data[$parent.$index][$index]}}
- -
-
-
-
-
-
Reactive Chart
-
- -
-
-
-
-
- - - - - - - - diff --git a/static/node_modules/angular-chart.js/examples/tabs.html b/static/node_modules/angular-chart.js/examples/tabs.html deleted file mode 100644 index 32091f1f..00000000 --- a/static/node_modules/angular-chart.js/examples/tabs.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - Charts in tabs - - - -
-
-
- - -
- -
-
- -
- -
-
-
-
-
- - - - - - - - diff --git a/static/node_modules/angular-chart.js/examples/ticks.html b/static/node_modules/angular-chart.js/examples/ticks.html deleted file mode 100644 index 6e2885cf..00000000 --- a/static/node_modules/angular-chart.js/examples/ticks.html +++ /dev/null @@ -1,30 +0,0 @@ - - - - - Realtime ticks - - - -
-
-
-
-
-
Ticks Chart
-
- -
-
-
-
-
- - - - - - - - diff --git a/static/node_modules/angular-chart.js/examples/webpack.commonjs.js b/static/node_modules/angular-chart.js/examples/webpack.commonjs.js deleted file mode 100644 index 528eba9e..00000000 --- a/static/node_modules/angular-chart.js/examples/webpack.commonjs.js +++ /dev/null @@ -1,18 +0,0 @@ -(function () { - 'use strict'; - - // install with npm: npm i --save angular-chart.js - // build with `npm bin`/webpack --config examples/webpack.commonjs.js --display-modules --progress - module.exports = { - entry: './examples/commonjs.js', - output: { - filename: './examples/commonjs.bundle.js' - }, - resolve: { - alias: { - 'angular-chart': '../angular-chart.js' // not required when you install with npm - } - } - }; - -})(); diff --git a/static/node_modules/angular-chart.js/examples/webpack.config.js b/static/node_modules/angular-chart.js/examples/webpack.config.js deleted file mode 100644 index 6eb06580..00000000 --- a/static/node_modules/angular-chart.js/examples/webpack.config.js +++ /dev/null @@ -1,12 +0,0 @@ -// install with npm: npm i --save angular-chart.js -module.exports = { - entry: './amd.js', - output: { - filename: './bundle.js' - }, - resolve: { - alias: { - 'angular-chart': '../angular-chart.js' // should not be required if you installed with npm - } - } -}; diff --git a/static/node_modules/angular-chart.js/examples/xy.html b/static/node_modules/angular-chart.js/examples/xy.html deleted file mode 100644 index 08950b76..00000000 --- a/static/node_modules/angular-chart.js/examples/xy.html +++ /dev/null @@ -1,28 +0,0 @@ - - - - - Charts with { x, y } - - - -
-
-
-
-
-
x y
-
- -
-
-
-
-
- - - - - - - diff --git a/static/node_modules/angular-chart.js/examples/xy.js b/static/node_modules/angular-chart.js/examples/xy.js deleted file mode 100644 index df6dcd11..00000000 --- a/static/node_modules/angular-chart.js/examples/xy.js +++ /dev/null @@ -1,18 +0,0 @@ -angular.module('app', ['chart.js']).controller('LineCtrl', ['$scope', function ($scope) { - 'use strict'; - - $scope.series = ['Series A', 'Series B']; - $scope.data = [ - [ {x: 0, y: 10}, {x: 0, y: 1}, {x: 1, y: 6}, {x: 4, y: 2} ], - [ {x: 0, y: 2}, {x: 5, y: 7}, {x: 4, y: 2}, {x: 2, y: 9} ] - ]; - $scope.options = { - scales: { - xAxes: [{ - type: 'linear', - position: 'bottom' - }] - } - }; -}]); - diff --git a/static/node_modules/angular-chart.js/gulpfile.js b/static/node_modules/angular-chart.js/gulpfile.js deleted file mode 100644 index 31636709..00000000 --- a/static/node_modules/angular-chart.js/gulpfile.js +++ /dev/null @@ -1,170 +0,0 @@ -(function () { - 'use strict'; - - var bumper = require('gulp-bump'); - var fs = require('fs'); - var git = require('gulp-git'); - var gulp = require('gulp'); - var gzip = require('gulp-gzip'); - var header = require('gulp-header'); - var istanbul = require('gulp-istanbul'); - var istanbulReport = require('gulp-istanbul-report'); - var jshint = require('gulp-jshint'); - var jscs = require('gulp-jscs'); - var mocha = require('gulp-spawn-mocha'); - var mochaPhantomJS = require('gulp-mocha-phantomjs'); - var path = require('path'); - var pkg = require('./package.json'); - var rename = require('gulp-rename'); - var rimraf = require('gulp-rimraf'); - var sequence = require('gulp-sequence'); - var shell = require('gulp-shell'); - var sourcemaps = require('gulp-sourcemaps'); - var stylish = require('jshint-stylish'); - var tar = require('gulp-tar'); - var uglify = require('gulp-uglify'); - - var banner = ['/*!', - ' * <%= pkg.name %> - <%= pkg.description %>', - ' * <%= pkg.homepage %>', - ' * Version: <%= version %>', - ' *', - ' * Copyright 2016 Jerome Touffe-Blin', - ' * Released under the <%= pkg.license %> license', - ' * https://github.com/jtblin/angular-chart.js/blob/master/LICENSE', - ' */', - '' - ].join('\n'); - - gulp.task('clean', function () { - return gulp.src('./dist/*', { read: false }) - .pipe(rimraf()); - }); - - gulp.task('lint', function () { - return gulp.src('**/*.js') - .pipe(jshint()) - .pipe(jshint.reporter(stylish)); - }); - - gulp.task('style', function () { - return gulp.src('**/*.js') - .pipe(jscs()); - }); - - gulp.task('cover', function () { - return gulp.src('angular-chart.js') - .pipe(istanbul({ coverageVariable: '__coverage__' })) - .pipe(rename('coverage.js')) - .pipe(gulp.dest('test/fixtures')); - }); - - gulp.task('unit', function () { - return gulp.src('test/index.html', { read: false }) - .pipe(mochaPhantomJS({ - phantomjs: { - hooks: 'mocha-phantomjs-istanbul', - coverageFile: 'coverage/coverage.json' - }, - reporter: process.env.REPORTER || 'spec' - })); - }); - - gulp.task('integration', function () { - return gulp.src(path.join('test', 'test.integration.js'), { read: false }) - .pipe(mocha({ reporter: 'list', timeout: 20000, require: 'test/support/setup.js' })); - }); - - gulp.task('report', function () { - return gulp.src('coverage/coverage.json') - .pipe(istanbulReport({ reporters: ['lcov'] })); - }); - - gulp.task('bump-patch', bump('patch')); - gulp.task('bump-minor', bump('minor')); - gulp.task('bump-major', bump('major')); - - gulp.task('bower', function () { - return gulp.src('./angular-chart.js') - .pipe(header(banner, { pkg : pkg, version: version() } )) - .pipe(gulp.dest('./dist')); - }); - - gulp.task('js', ['lint', 'style', 'bower'], function () { - return gulp.src('./angular-chart.js') - .pipe(header(banner, { pkg : pkg, version: version() } )) - .pipe(rename('angular-chart.min.js')) - .pipe(sourcemaps.init()) - .pipe(uglify({ preserveComments: 'license' })) - .pipe(sourcemaps.write('./')) - .pipe(gulp.dest('./dist')); - }); - - gulp.task('build', function () { - return gulp.src(['dist/*', '!./dist/*.tar.gz']) - .pipe(tar('angular-chart.js.tar')) - .pipe(gzip({ gzipOptions: { level: 9 } })) - .pipe(gulp.dest('dist/')); - }); - - gulp.task('update', function (cb) { - fs.readFile('./examples/charts.template.html', 'utf8', function (err, file) { - if (err) return cb(err); - file = file.replace('', version()); - fs.writeFile('./examples/charts.html', file, cb); - }); - }); - - gulp.task('git-commit', function () { - var v = version(); - gulp.src(['./dist/*', './package.json', './bower.json', './examples/charts.html', './test/fixtures/coverage.js']) - .pipe(git.add()) - .pipe(git.commit(v)) - ; - }); - - gulp.task('git-push', function (cb) { - var v = version(); - git.push('origin', 'master', function (err) { - if (err) return cb(err); - git.tag(v, v, function (err) { - if (err) return cb(err); - git.push('origin', 'master', {args: '--tags' }, cb); - }); - }); - }); - - gulp.task('npm', shell.task([ - 'npm publish' - ])); - - gulp.task('watch', function () { - gulp.watch('./*.js', ['js']); - return true; - }); - - gulp.task('docker-test', shell.task([ - 'npm run docker-test' - ])); - - function bump (level) { - return function () { - return gulp.src(['./package.json', './bower.json']) - .pipe(bumper({type: level})) - .pipe(gulp.dest('./')); - }; - } - - function version () { - return JSON.parse(fs.readFileSync('package.json', 'utf8')).version; - } - - gulp.task('default', sequence('docker-test', 'assets')); - gulp.task('assets', sequence('clean', 'js', 'build')); - gulp.task('test', sequence('cover', 'unit', 'integration', 'report')); - gulp.task('check', sequence(['lint', 'style'], 'test')); - gulp.task('deploy-patch', sequence('docker-test', 'bump-patch', 'assets', 'update', 'git-commit', 'git-push', 'npm')); - gulp.task('deploy-minor', sequence('docker-test', 'bump-minor', 'assets', 'update', 'git-commit', 'git-push', 'npm')); - gulp.task('deploy-major', sequence('docker-test', 'bump-patch', 'assets', 'update', 'git-commit', 'git-push', 'npm')); - -})(); diff --git a/static/node_modules/angular-chart.js/package.json b/static/node_modules/angular-chart.js/package.json deleted file mode 100644 index 43459960..00000000 --- a/static/node_modules/angular-chart.js/package.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "_args": [ - [ - "angular-chart.js@1.1.1", - "D:\\Workspace\\Git\\foundation\\static" - ] - ], - "_from": "angular-chart.js@1.1.1", - "_id": "angular-chart.js@1.1.1", - "_inBundle": false, - "_integrity": "sha1-SfDhjQgXYrbUyXkeSHr/L7sw9a4=", - "_location": "/angular-chart.js", - "_phantomChildren": {}, - "_requested": { - "type": "version", - "registry": true, - "raw": "angular-chart.js@1.1.1", - "name": "angular-chart.js", - "escapedName": "angular-chart.js", - "rawSpec": "1.1.1", - "saveSpec": null, - "fetchSpec": "1.1.1" - }, - "_requiredBy": [ - "/" - ], - "_resolved": "https://registry.npmjs.org/angular-chart.js/-/angular-chart.js-1.1.1.tgz", - "_spec": "1.1.1", - "_where": "D:\\Workspace\\Git\\foundation\\static", - "author": { - "name": "Jerome Touffe-Blin", - "email": "jtblin@gmail.com" - }, - "bugs": { - "url": "https://github.com/jtblin/angular-chart.js/issues" - }, - "dependencies": { - "angular": "1.x", - "chart.js": "2.3.x" - }, - "description": "An angular.js wrapper for Chart.js", - "devDependencies": { - "Rainbow": "git+https://github.com/ccampbell/rainbow.git", - "angular-bootstrap": "^0.12.2", - "angular-mocks": "^1.5.7", - "bootstrap": "^3.3.7", - "chai": "^3.4.1", - "chai-string": "^1.2.0", - "codeclimate-test-reporter": "^0.3.1", - "cp": "^0.2.0", - "font-awesome": "^4.6.3", - "gm": "^1.22.0", - "gulp": "^3.9.0", - "gulp-bump": "^2.1.0", - "gulp-git": "^1.7.1", - "gulp-gzip": "^1.2.0", - "gulp-header": "^1.8.3", - "gulp-istanbul": "^1.0.0", - "gulp-istanbul-report": "^0.0.1", - "gulp-jscs": "^3.0.2", - "gulp-jshint": "^2.0.0", - "gulp-mocha-phantomjs": "^0.11.0", - "gulp-rename": "^1.2.0", - "gulp-rimraf": "^0.2.0", - "gulp-sequence": "^0.4.1", - "gulp-shell": "^0.5.1", - "gulp-sourcemaps": "^1.0.0", - "gulp-spawn-mocha": "^2.0.1", - "gulp-tar": "^1.9.0", - "gulp-uglify": "^1.5.3", - "imgur-node-api": "^0.1.0", - "jshint": "^2.9.1", - "jshint-stylish": "^2.0.1", - "mkdirp": "^0.5.0", - "mocha": "^2.1.0", - "mocha-phantomjs-istanbul": "^0.0.2", - "requirejs": "^2.2.0", - "sinon": "^1.12.2", - "sinon-chai": "^2.7.0", - "testatic": "^0.1.0", - "tmp-sync": "^1.1.0", - "webpack": "^1.13.1", - "webshot": "^0.18.0" - }, - "directories": { - "example": "examples" - }, - "homepage": "http://jtblin.github.io/angular-chart.js/", - "license": "BSD-2-Clause", - "main": "dist/angular-chart.js", - "name": "angular-chart.js", - "repository": { - "type": "git", - "url": "git://github.com/jtblin/angular-chart.js.git" - }, - "scripts": { - "codeclimate": "./node_modules/codeclimate-test-reporter/bin/codeclimate.js < coverage/lcov.info", - "docker": "npm run docker-build && npm run docker-test", - "docker-build": "docker build -t angular-chart.js .", - "docker-test": "docker run --rm -i -v $(pwd)/coverage/:/src/coverage/ -v $(pwd)/test/:/src/test/ -v $(pwd)/angular-chart.js:/src/angular-chart.js angular-chart.js", - "test": "gulp check" - }, - "version": "1.1.1" -} diff --git a/static/node_modules/angular-chart.js/test/fixtures/29-tabs.html b/static/node_modules/angular-chart.js/test/fixtures/29-tabs.html deleted file mode 100644 index 6c988877..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/29-tabs.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - Charts in tabs - - - -
-
-
- - -
- -
-
- -
- -
-
-
-
-
- - - - - - - - diff --git a/static/node_modules/angular-chart.js/test/fixtures/29-tabs.js b/static/node_modules/angular-chart.js/test/fixtures/29-tabs.js deleted file mode 100644 index b29dab73..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/29-tabs.js +++ /dev/null @@ -1,18 +0,0 @@ -(function () { - 'use strict'; - - var app = angular.module('examples', ['chart.js', 'ui.bootstrap']); - Chart.defaults.global.legend = { - display: false - }; - - app.controller('TabsCtrl', function ($scope) { - $scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; - $scope.active = true; - $scope.data = [ - [65, 59, 90, 81, 56, 55, 40], - [28, 48, 40, 19, 96, 27, 100] - ]; - }); - -})(); diff --git a/static/node_modules/angular-chart.js/test/fixtures/29-tabs.png b/static/node_modules/angular-chart.js/test/fixtures/29-tabs.png deleted file mode 100644 index 62bd3549..00000000 Binary files a/static/node_modules/angular-chart.js/test/fixtures/29-tabs.png and /dev/null differ diff --git a/static/node_modules/angular-chart.js/test/fixtures/51-pie-update-colours.html b/static/node_modules/angular-chart.js/test/fixtures/51-pie-update-colours.html deleted file mode 100644 index 2010ea12..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/51-pie-update-colours.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - Pie update colors - - - -
-
- - -
-
- - - - - - - diff --git a/static/node_modules/angular-chart.js/test/fixtures/51-pie-update-colours.js b/static/node_modules/angular-chart.js/test/fixtures/51-pie-update-colours.js deleted file mode 100644 index 9265754d..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/51-pie-update-colours.js +++ /dev/null @@ -1,34 +0,0 @@ -(function () { - 'use strict'; - - var app = angular.module('pie', ['chart.js']); - Chart.defaults.global.legend = { - display: false - }; - - app.controller('PieCtrl', ['$scope', '$timeout', function ($scope, $timeout) { - $scope.labels = ['Series A', 'Series B']; - $scope.data = [65, 59]; - $scope.colors = [{ // red - backgroundColor: 'rgba(247,70,74,0.2)', - borderColor: 'rgba(247,70,74,1)', - pointBackgroundColor: 'rgba(247,70,74,1)', - pointBorderColor: '#fff', - pointHoverBackgroundColor: '#fff', - pointHoverBorderColor: 'rgba(247,70,74,0.8)' - }, - { // green - backgroundColor: 'rgba(70,191,189,0.2)', - borderColor: 'rgba(70,191,189,1)', - pointBackgroundColor: 'rgba(70,191,189,1)', - pointBorderColor: '#fff', - pointHoverBackgroundColor: '#fff', - pointHoverBorderColor: 'rgba(70,191,189,0.8)' - }]; - - $timeout(function () { - $scope.data = [49, 65]; - }, 0); - }]); - -})(); diff --git a/static/node_modules/angular-chart.js/test/fixtures/51-pie-update-colours.png b/static/node_modules/angular-chart.js/test/fixtures/51-pie-update-colours.png deleted file mode 100644 index 89c44069..00000000 Binary files a/static/node_modules/angular-chart.js/test/fixtures/51-pie-update-colours.png and /dev/null differ diff --git a/static/node_modules/angular-chart.js/test/fixtures/54-not-enough-colours.html b/static/node_modules/angular-chart.js/test/fixtures/54-not-enough-colours.html deleted file mode 100644 index 41c2bf37..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/54-not-enough-colours.html +++ /dev/null @@ -1,36 +0,0 @@ - - - - - Not enough colors - - - -
-
- - -
-
- - - - - - - diff --git a/static/node_modules/angular-chart.js/test/fixtures/54-not-enough-colours.js b/static/node_modules/angular-chart.js/test/fixtures/54-not-enough-colours.js deleted file mode 100644 index 2f5d97dc..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/54-not-enough-colours.js +++ /dev/null @@ -1,36 +0,0 @@ -(function () { - 'use strict'; - - var app = angular.module('pie', ['chart.js']); - Chart.defaults.global.legend = { - display: false - }; - - app.controller('PieCtrl', ['$scope', function ($scope) { - var cnt = 0; - $scope.colors = []; - $scope.labels = ['Series A', 'Series B']; - $scope.chartGetColor = function () { - return ++cnt % 2 > 0 ? - { // red - backgroundColor: 'rgba(247,70,74,0.2)', - borderColor: 'rgba(247,70,74,1)', - pointBackgroundColor: 'rgba(247,70,74,1)', - pointBorderColor: '#fff', - pointHoverBackgroundColor: '#fff', - pointHoverBorderColor: 'rgba(247,70,74,0.8)' - } - : - { // green - backgroundColor: 'rgba(70,191,189,0.2)', - borderColor: 'rgba(70,191,189,1)', - pointBackgroundColor: 'rgba(70,191,189,1)', - pointBorderColor: '#fff', - pointHoverBackgroundColor: '#fff', - pointHoverBorderColor: 'rgba(70,191,189,0.8)' - }; - }; - $scope.data = [49, 65]; - }]); - -})(); diff --git a/static/node_modules/angular-chart.js/test/fixtures/54-not-enough-colours.png b/static/node_modules/angular-chart.js/test/fixtures/54-not-enough-colours.png deleted file mode 100644 index f1ebc8bc..00000000 Binary files a/static/node_modules/angular-chart.js/test/fixtures/54-not-enough-colours.png and /dev/null differ diff --git a/static/node_modules/angular-chart.js/test/fixtures/57-hex-colours.html b/static/node_modules/angular-chart.js/test/fixtures/57-hex-colours.html deleted file mode 100644 index 8d4353f1..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/57-hex-colours.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - Hex colors - - - -
-
- - -
-
- - - - - - - diff --git a/static/node_modules/angular-chart.js/test/fixtures/57-hex-colours.js b/static/node_modules/angular-chart.js/test/fixtures/57-hex-colours.js deleted file mode 100644 index f827ee4a..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/57-hex-colours.js +++ /dev/null @@ -1,15 +0,0 @@ -(function () { - 'use strict'; - - var app = angular.module('pie', ['chart.js']); - Chart.defaults.global.legend = { - display: false - }; - - app.controller('PieCtrl', ['$scope', function ($scope) { - $scope.labels = ['Series A', 'Series B']; - $scope.colors = ['#9AFEFF', '#D1D0CE']; - $scope.data = [49, 65]; - }]); - -})(); diff --git a/static/node_modules/angular-chart.js/test/fixtures/57-hex-colours.png b/static/node_modules/angular-chart.js/test/fixtures/57-hex-colours.png deleted file mode 100644 index f91a05c8..00000000 Binary files a/static/node_modules/angular-chart.js/test/fixtures/57-hex-colours.png and /dev/null differ diff --git a/static/node_modules/angular-chart.js/test/fixtures/bubble.html b/static/node_modules/angular-chart.js/test/fixtures/bubble.html deleted file mode 100644 index 635d84bd..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/bubble.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - Bubble chart - - - -
-
-
-
-
-
Bubble chart
-
- -
-
-
-
-
- - - - - - - diff --git a/static/node_modules/angular-chart.js/test/fixtures/bubble.js b/static/node_modules/angular-chart.js/test/fixtures/bubble.js deleted file mode 100644 index 7af4b8af..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/bubble.js +++ /dev/null @@ -1,787 +0,0 @@ -angular.module('app', ['chart.js']) - .config(['ChartJsProvider', function (ChartJsProvider) { - 'use strict'; - ChartJsProvider.setOptions({ - tooltips: { enabled: false } - }); - }]) - .controller('BubbleCtrl', ['$scope',function ($scope) { - 'use strict'; - - $scope.colors = [ - { - backgroundColor: 'rgba(151,187,205,0.2)', - pointBackgroundColor: 'rgba(151,187,205,1)', - pointHoverBackgroundColor: 'rgba(151,187,205,0.8)', - borderColor: 'rgba(151,187,205,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(151,187,205,1)' - }, - { - backgroundColor: 'rgba(220,220,220,0.2)', - pointBackgroundColor: 'rgba(220,220,220,1)', - pointHoverBackgroundColor: 'rgba(220,220,220,0.8)', - borderColor: 'rgba(220,220,220,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(220,220,220,1)' - }, - { - backgroundColor: 'rgba(247,70,74,0.2)', - pointBackgroundColor: 'rgba(247,70,74,1)', - pointHoverBackgroundColor: 'rgba(247,70,74,0.8)', - borderColor: 'rgba(247,70,74,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(247,70,74,1)' - }, - { - backgroundColor: 'rgba(70,191,189,0.2)', - pointBackgroundColor: 'rgba(70,191,189,1)', - pointHoverBackgroundColor: 'rgba(70,191,189,0.8)', - borderColor: 'rgba(70,191,189,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(70,191,189,1)' - }, - { - backgroundColor: 'rgba(253,180,92,0.2)', - pointBackgroundColor: 'rgba(253,180,92,1)', - pointHoverBackgroundColor: 'rgba(253,180,92,0.8)', - borderColor: 'rgba(253,180,92,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(253,180,92,1)' - }, - { - backgroundColor: 'rgba(148,159,177,0.2)', - pointBackgroundColor: 'rgba(148,159,177,1)', - pointHoverBackgroundColor: 'rgba(148,159,177,0.8)', - borderColor: 'rgba(148,159,177,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(148,159,177,1)' - }, - { - backgroundColor: 'rgba(77,83,96,0.2)', - pointBackgroundColor: 'rgba(77,83,96,1)', - pointHoverBackgroundColor: 'rgba(77,83,96,0.8)', - borderColor: 'rgba(77,83,96,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(77,83,96,1)' - }, - { - backgroundColor: 'rgba(151,57,74,0.2)', - pointBackgroundColor: 'rgba(151,57,74,1)', - pointHoverBackgroundColor: 'rgba(151,57,74,0.8)', - borderColor: 'rgba(151,57,74,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(151,57,74,1)' - }, - { - backgroundColor: 'rgba(198,232,17,0.2)', - pointBackgroundColor: 'rgba(198,232,17,1)', - pointHoverBackgroundColor: 'rgba(198,232,17,0.8)', - borderColor: 'rgba(198,232,17,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(198,232,17,1)' - }, - { - backgroundColor: 'rgba(39,249,229,0.2)', - pointBackgroundColor: 'rgba(39,249,229,1)', - pointHoverBackgroundColor: 'rgba(39,249,229,0.8)', - borderColor: 'rgba(39,249,229,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(39,249,229,1)' - }, - { - backgroundColor: 'rgba(98,128,233,0.2)', - pointBackgroundColor: 'rgba(98,128,233,1)', - pointHoverBackgroundColor: 'rgba(98,128,233,0.8)', - borderColor: 'rgba(98,128,233,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(98,128,233,1)' - }, - { - backgroundColor: 'rgba(195,99,4,0.2)', - pointBackgroundColor: 'rgba(195,99,4,1)', - pointHoverBackgroundColor: 'rgba(195,99,4,0.8)', - borderColor: 'rgba(195,99,4,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(195,99,4,1)' - }, - { - backgroundColor: 'rgba(81,204,249,0.2)', - pointBackgroundColor: 'rgba(81,204,249,1)', - pointHoverBackgroundColor: 'rgba(81,204,249,0.8)', - borderColor: 'rgba(81,204,249,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(81,204,249,1)' - }, - { - backgroundColor: 'rgba(159,197,163,0.2)', - pointBackgroundColor: 'rgba(159,197,163,1)', - pointHoverBackgroundColor: 'rgba(159,197,163,0.8)', - borderColor: 'rgba(159,197,163,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(159,197,163,1)' - }, - { - backgroundColor: 'rgba(122,68,60,0.2)', - pointBackgroundColor: 'rgba(122,68,60,1)', - pointHoverBackgroundColor: 'rgba(122,68,60,0.8)', - borderColor: 'rgba(122,68,60,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(122,68,60,1)' - }, - { - backgroundColor: 'rgba(183,199,142,0.2)', - pointBackgroundColor: 'rgba(183,199,142,1)', - pointHoverBackgroundColor: 'rgba(183,199,142,0.8)', - borderColor: 'rgba(183,199,142,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(183,199,142,1)' - }, - { - backgroundColor: 'rgba(33,125,4,0.2)', - pointBackgroundColor: 'rgba(33,125,4,1)', - pointHoverBackgroundColor: 'rgba(33,125,4,0.8)', - borderColor: 'rgba(33,125,4,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(33,125,4,1)' - }, - { - backgroundColor: 'rgba(100,33,169,0.2)', - pointBackgroundColor: 'rgba(100,33,169,1)', - pointHoverBackgroundColor: 'rgba(100,33,169,0.8)', - borderColor: 'rgba(100,33,169,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(100,33,169,1)' - }, - { - backgroundColor: 'rgba(10,128,69,0.2)', - pointBackgroundColor: 'rgba(10,128,69,1)', - pointHoverBackgroundColor: 'rgba(10,128,69,0.8)', - borderColor: 'rgba(10,128,69,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(10,128,69,1)' - }, - { - backgroundColor: 'rgba(55,144,44,0.2)', - pointBackgroundColor: 'rgba(55,144,44,1)', - pointHoverBackgroundColor: 'rgba(55,144,44,0.8)', - borderColor: 'rgba(55,144,44,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(55,144,44,1)' - }, - { - backgroundColor: 'rgba(111,248,27,0.2)', - pointBackgroundColor: 'rgba(111,248,27,1)', - pointHoverBackgroundColor: 'rgba(111,248,27,0.8)', - borderColor: 'rgba(111,248,27,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(111,248,27,1)' - }, - { - backgroundColor: 'rgba(241,104,154,0.2)', - pointBackgroundColor: 'rgba(241,104,154,1)', - pointHoverBackgroundColor: 'rgba(241,104,154,0.8)', - borderColor: 'rgba(241,104,154,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(241,104,154,1)' - }, - { - backgroundColor: 'rgba(158,253,143,0.2)', - pointBackgroundColor: 'rgba(158,253,143,1)', - pointHoverBackgroundColor: 'rgba(158,253,143,0.8)', - borderColor: 'rgba(158,253,143,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(158,253,143,1)' - }, - { - backgroundColor: 'rgba(186,25,134,0.2)', - pointBackgroundColor: 'rgba(186,25,134,1)', - pointHoverBackgroundColor: 'rgba(186,25,134,0.8)', - borderColor: 'rgba(186,25,134,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(186,25,134,1)' - }, - { - backgroundColor: 'rgba(81,34,77,0.2)', - pointBackgroundColor: 'rgba(81,34,77,1)', - pointHoverBackgroundColor: 'rgba(81,34,77,0.8)', - borderColor: 'rgba(81,34,77,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(81,34,77,1)' - }, - { - backgroundColor: 'rgba(254,6,184,0.2)', - pointBackgroundColor: 'rgba(254,6,184,1)', - pointHoverBackgroundColor: 'rgba(254,6,184,0.8)', - borderColor: 'rgba(254,6,184,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(254,6,184,1)' - }, - { - backgroundColor: 'rgba(4,230,203,0.2)', - pointBackgroundColor: 'rgba(4,230,203,1)', - pointHoverBackgroundColor: 'rgba(4,230,203,0.8)', - borderColor: 'rgba(4,230,203,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(4,230,203,1)' - }, - { - backgroundColor: 'rgba(204,31,79,0.2)', - pointBackgroundColor: 'rgba(204,31,79,1)', - pointHoverBackgroundColor: 'rgba(204,31,79,0.8)', - borderColor: 'rgba(204,31,79,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(204,31,79,1)' - }, - { - backgroundColor: 'rgba(95,152,82,0.2)', - pointBackgroundColor: 'rgba(95,152,82,1)', - pointHoverBackgroundColor: 'rgba(95,152,82,0.8)', - borderColor: 'rgba(95,152,82,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(95,152,82,1)' - }, - { - backgroundColor: 'rgba(120,249,206,0.2)', - pointBackgroundColor: 'rgba(120,249,206,1)', - pointHoverBackgroundColor: 'rgba(120,249,206,0.8)', - borderColor: 'rgba(120,249,206,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(120,249,206,1)' - }, - { - backgroundColor: 'rgba(229,137,70,0.2)', - pointBackgroundColor: 'rgba(229,137,70,1)', - pointHoverBackgroundColor: 'rgba(229,137,70,0.8)', - borderColor: 'rgba(229,137,70,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(229,137,70,1)' - }, - { - backgroundColor: 'rgba(54,98,166,0.2)', - pointBackgroundColor: 'rgba(54,98,166,1)', - pointHoverBackgroundColor: 'rgba(54,98,166,0.8)', - borderColor: 'rgba(54,98,166,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(54,98,166,1)' - }, - { - backgroundColor: 'rgba(22,81,208,0.2)', - pointBackgroundColor: 'rgba(22,81,208,1)', - pointHoverBackgroundColor: 'rgba(22,81,208,0.8)', - borderColor: 'rgba(22,81,208,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(22,81,208,1)' - }, - { - backgroundColor: 'rgba(139,248,40,0.2)', - pointBackgroundColor: 'rgba(139,248,40,1)', - pointHoverBackgroundColor: 'rgba(139,248,40,0.8)', - borderColor: 'rgba(139,248,40,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(139,248,40,1)' - }, - { - backgroundColor: 'rgba(139,221,190,0.2)', - pointBackgroundColor: 'rgba(139,221,190,1)', - pointHoverBackgroundColor: 'rgba(139,221,190,0.8)', - borderColor: 'rgba(139,221,190,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(139,221,190,1)' - }, - { - backgroundColor: 'rgba(230,218,251,0.2)', - pointBackgroundColor: 'rgba(230,218,251,1)', - pointHoverBackgroundColor: 'rgba(230,218,251,0.8)', - borderColor: 'rgba(230,218,251,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(230,218,251,1)' - }, - { - backgroundColor: 'rgba(245,21,15,0.2)', - pointBackgroundColor: 'rgba(245,21,15,1)', - pointHoverBackgroundColor: 'rgba(245,21,15,0.8)', - borderColor: 'rgba(245,21,15,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(245,21,15,1)' - }, - { - backgroundColor: 'rgba(36,166,81,0.2)', - pointBackgroundColor: 'rgba(36,166,81,1)', - pointHoverBackgroundColor: 'rgba(36,166,81,0.8)', - borderColor: 'rgba(36,166,81,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(36,166,81,1)' - }, - { - backgroundColor: 'rgba(177,41,153,0.2)', - pointBackgroundColor: 'rgba(177,41,153,1)', - pointHoverBackgroundColor: 'rgba(177,41,153,0.8)', - borderColor: 'rgba(177,41,153,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(177,41,153,1)' - }, - { - backgroundColor: 'rgba(44,173,178,0.2)', - pointBackgroundColor: 'rgba(44,173,178,1)', - pointHoverBackgroundColor: 'rgba(44,173,178,0.8)', - borderColor: 'rgba(44,173,178,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(44,173,178,1)' - }, - { - backgroundColor: 'rgba(134,50,197,0.2)', - pointBackgroundColor: 'rgba(134,50,197,1)', - pointHoverBackgroundColor: 'rgba(134,50,197,0.8)', - borderColor: 'rgba(134,50,197,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(134,50,197,1)' - }, - { - backgroundColor: 'rgba(176,188,149,0.2)', - pointBackgroundColor: 'rgba(176,188,149,1)', - pointHoverBackgroundColor: 'rgba(176,188,149,0.8)', - borderColor: 'rgba(176,188,149,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(176,188,149,1)' - }, - { - backgroundColor: 'rgba(92,9,164,0.2)', - pointBackgroundColor: 'rgba(92,9,164,1)', - pointHoverBackgroundColor: 'rgba(92,9,164,0.8)', - borderColor: 'rgba(92,9,164,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(92,9,164,1)' - }, - { - backgroundColor: 'rgba(184,93,102,0.2)', - pointBackgroundColor: 'rgba(184,93,102,1)', - pointHoverBackgroundColor: 'rgba(184,93,102,0.8)', - borderColor: 'rgba(184,93,102,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(184,93,102,1)' - }, - { - backgroundColor: 'rgba(1,235,91,0.2)', - pointBackgroundColor: 'rgba(1,235,91,1)', - pointHoverBackgroundColor: 'rgba(1,235,91,0.8)', - borderColor: 'rgba(1,235,91,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(1,235,91,1)' - }, - { - backgroundColor: 'rgba(148,100,155,0.2)', - pointBackgroundColor: 'rgba(148,100,155,1)', - pointHoverBackgroundColor: 'rgba(148,100,155,0.8)', - borderColor: 'rgba(148,100,155,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(148,100,155,1)' - }, - { - backgroundColor: 'rgba(17,253,128,0.2)', - pointBackgroundColor: 'rgba(17,253,128,1)', - pointHoverBackgroundColor: 'rgba(17,253,128,0.8)', - borderColor: 'rgba(17,253,128,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(17,253,128,1)' - }, - { - backgroundColor: 'rgba(107,59,91,0.2)', - pointBackgroundColor: 'rgba(107,59,91,1)', - pointHoverBackgroundColor: 'rgba(107,59,91,0.8)', - borderColor: 'rgba(107,59,91,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(107,59,91,1)' - }, - { - backgroundColor: 'rgba(105,111,203,0.2)', - pointBackgroundColor: 'rgba(105,111,203,1)', - pointHoverBackgroundColor: 'rgba(105,111,203,0.8)', - borderColor: 'rgba(105,111,203,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(105,111,203,1)' - }, - { - backgroundColor: 'rgba(86,123,134,0.2)', - pointBackgroundColor: 'rgba(86,123,134,1)', - pointHoverBackgroundColor: 'rgba(86,123,134,0.8)', - borderColor: 'rgba(86,123,134,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(86,123,134,1)' - } - ]; - - $scope.options = { - scales: { - xAxes: [{ - display: false, - ticks: { - max: 125, - min: -125, - stepSize: 10 - } - }], - yAxes: [{ - display: false, - ticks: { - max: 125, - min: -125, - stepSize: 10 - } - }] - } - }; - - $scope.data = [ - [ - { - x: -8, - y: -72, - r: 20.5 - } - ], - [ - { - x: -14, - y: -32, - r: 14.25 - } - ], - [ - { - x: 0, - y: 86, - r: 15 - } - ], - [ - { - x: -13, - y: 58, - r: 7.75 - } - ], - [ - { - x: 22, - y: -60, - r: 9.25 - } - ], - [ - { - x: 84, - y: -25, - r: 15.25 - } - ], - [ - { - x: 14, - y: 85, - r: 23.25 - } - ], - [ - { - x: -2, - y: 37, - r: 10.75 - } - ], - [ - { - x: -40, - y: 69, - r: 0.75 - } - ], - [ - { - x: -62, - y: -46, - r: 19.5 - } - ], - [ - { - x: 4, - y: -1, - r: 0.25 - } - ], - [ - { - x: -34, - y: 67, - r: 17.5 - } - ], - [ - { - x: -21, - y: -88, - r: 16.25 - } - ], - [ - { - x: 90, - y: 80, - r: 24.75 - } - ], - [ - { - x: 7, - y: 93, - r: 20.75 - } - ], - [ - { - x: 48, - y: 39, - r: 7.75 - } - ], - [ - { - x: 99, - y: -20, - r: 2.75 - } - ], - [ - { - x: -48, - y: 52, - r: 4.5 - } - ], - [ - { - x: -57, - y: -39, - r: 21 - } - ], - [ - { - x: 31, - y: -58, - r: 3.25 - } - ], - [ - { - x: 96, - y: 62, - r: 10.25 - } - ], - [ - { - x: 58, - y: -54, - r: 19.5 - } - ], - [ - { - x: 8, - y: 73, - r: 12 - } - ], - [ - { - x: 67, - y: 97, - r: 8.5 - } - ], - [ - { - x: -47, - y: -57, - r: 25 - } - ], - [ - { - x: 0, - y: -97, - r: 23.5 - } - ], - [ - { - x: -55, - y: -27, - r: 2 - } - ], - [ - { - x: 68, - y: 9, - r: 12.25 - } - ], - [ - { - x: -5, - y: 63, - r: 20.75 - } - ], - [ - { - x: 80, - y: 31, - r: 18.75 - } - ], - [ - { - x: 47, - y: -21, - r: 2.5 - } - ], - [ - { - x: -72, - y: 94, - r: 1.25 - } - ], - [ - { - x: 11, - y: -90, - r: 5.25 - } - ], - [ - { - x: 45, - y: -20, - r: 3.5 - } - ], - [ - { - x: 99, - y: 42, - r: 8.5 - } - ], - [ - { - x: -8, - y: -65, - r: 11 - } - ], - [ - { - x: -30, - y: -68, - r: 19 - } - ], - [ - { - x: -56, - y: 19, - r: 1 - } - ], - [ - { - x: -22, - y: 46, - r: 9 - } - ], - [ - { - x: 8, - y: 25, - r: 1 - } - ], - [ - { - x: -36, - y: -64, - r: 0.5 - } - ], - [ - { - x: 13, - y: -6, - r: 23.5 - } - ], - [ - { - x: 41, - y: 45, - r: 3.75 - } - ], - [ - { - x: -84, - y: 39, - r: 10.25 - } - ], - [ - { - x: 27, - y: -96, - r: 23.5 - } - ], - [ - { - x: -14, - y: -83, - r: 25 - } - ], - [ - { - x: -89, - y: -78, - r: 1 - } - ], - [ - { - x: -43, - y: -6, - r: 2.5 - } - ], - [ - { - x: 3, - y: 71, - r: 0 - } - ], - [ - { - x: 11, - y: 53, - r: 4.25 - } - ] - ]; - }]); diff --git a/static/node_modules/angular-chart.js/test/fixtures/bubble.png b/static/node_modules/angular-chart.js/test/fixtures/bubble.png deleted file mode 100644 index f9c070b4..00000000 Binary files a/static/node_modules/angular-chart.js/test/fixtures/bubble.png and /dev/null differ diff --git a/static/node_modules/angular-chart.js/test/fixtures/charts.html b/static/node_modules/angular-chart.js/test/fixtures/charts.html deleted file mode 100644 index 04732170..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/charts.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - Charts - - - -
-
- -
-
-
-
Line Chart
-
- -
-
-
-
-
-
Bar Chart
-
- -
-
-
-
-
-
Doughnut Chart
-
- -
-
-
-
-
-
-
-
Radar Chart
-
- -
-
-
-
-
-
Pie Chart
-
- -
-
-
-
-
-
Polar Area Chart
-
- -
-
-
-
-
-
-
-
- - - - - - - diff --git a/static/node_modules/angular-chart.js/test/fixtures/charts.js b/static/node_modules/angular-chart.js/test/fixtures/charts.js deleted file mode 100644 index 82dbe8d7..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/charts.js +++ /dev/null @@ -1,68 +0,0 @@ -(function () { - 'use strict'; - - var app = angular.module('charts', ['chart.js']); - Chart.defaults.global.legend = { - display: false - }; - - app.controller('LineCtrl', ['$scope', '$timeout', function ($scope, $timeout) { - $scope.labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July']; - $scope.series = ['Series A', 'Series B']; - $scope.data = [ - [65, 59, 80, 81, 56, 55, 40], - [28, 48, 40, 19, 86, 27, 90] - ]; - $timeout(function () { - $scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; - $scope.data = [ - [28, 48, 40, 19, 86, 27, 90], - [65, 59, 80, 81, 56, 55, 40] - ]; - $scope.series = ['Series C', 'Series D']; - }, 0); - }]); - - app.controller('BarCtrl', ['$scope', '$timeout', function ($scope, $timeout) { - $scope.options = { scaleShowVerticalLines: false }; - $scope.labels = ['2006', '2007', '2008', '2009', '2010', '2011', '2012']; - $scope.series = ['Series A', 'Series B']; - $scope.data = [ - [65, 59, 80, 81, 56, 55, 40], - [28, 48, 40, 19, 86, 27, 90] - ]; - $timeout(function () { - $scope.options = { scaleShowVerticalLines: true }; - }, 0); - }]); - - app.controller('DoughnutCtrl', ['$scope', '$timeout', function ($scope, $timeout) { - $scope.labels = ['Download Sales', 'In-Store Sales', 'Mail-Order Sales']; - $scope.data = [0, 0, 0]; - // TODO: investigate why chart was not showing up without this hack - $timeout(function () { - $scope.data = [350, 450, 100]; - }, 0); - }]); - - app.controller('PieCtrl', ['$scope', '$timeout', function ($scope, $timeout) { - $scope.labels = ['Download Sales', 'In-Store Sales', 'Mail Sales']; - $scope.data = [0, 0, 0]; - $timeout(function () { - $scope.data = [350, 450, 100]; - }, 0); - }]); - - app.controller('PolarAreaCtrl', function ($scope) { - $scope.labels = ['Download Sales', 'In-Store Sales', 'Mail Sales', 'Telesales', 'Corporate Sales']; - $scope.data = [300, 500, 100, 40, 120]; - }); - - app.controller('RadarCtrl', function ($scope) { - $scope.labels = ['Eating', 'Drinking', 'Sleeping', 'Designing', 'Coding', 'Cycling', 'Running']; - $scope.data = [ - [65, 59, 90, 81, 56, 55, 40], - [28, 48, 40, 19, 96, 27, 100] - ]; - }); -})(); diff --git a/static/node_modules/angular-chart.js/test/fixtures/charts.png b/static/node_modules/angular-chart.js/test/fixtures/charts.png deleted file mode 100644 index 7b796aec..00000000 Binary files a/static/node_modules/angular-chart.js/test/fixtures/charts.png and /dev/null differ diff --git a/static/node_modules/angular-chart.js/test/fixtures/configure-line-chart.html b/static/node_modules/angular-chart.js/test/fixtures/configure-line-chart.html deleted file mode 100644 index 9ef8d381..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/configure-line-chart.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - Pie update colors - - - -
-
- -
-
-
-
Line Chart
-
- -
-
-
-
-
-
- - - - - - - diff --git a/static/node_modules/angular-chart.js/test/fixtures/configure-line-chart.js b/static/node_modules/angular-chart.js/test/fixtures/configure-line-chart.js deleted file mode 100644 index e26439c3..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/configure-line-chart.js +++ /dev/null @@ -1,33 +0,0 @@ -(function () { - 'use strict'; - - var app = angular.module('line', ['chart.js']); - - app.config(function (ChartJsProvider) { - // Configure all charts - ChartJsProvider.setOptions({ - chartColors: ['#FF5252', '#FF8A80'] - }); - // Configure all line charts - ChartJsProvider.setOptions('line', { - showLines: false - }); - }); - - app.controller('LineCtrl', ['$scope', '$timeout', function ($scope, $timeout) { - $scope.labels = ['Series A', 'Series B']; - $scope.data = [[15, 23], [59, 80]]; - - // Configure only this instance - $scope.options = { - legend: { - display: false - } - }; - - $timeout(function () { - $scope.data = [[15, 23], [59, 80]]; - }, 0); - }]); - -})(); diff --git a/static/node_modules/angular-chart.js/test/fixtures/configure-line-chart.png b/static/node_modules/angular-chart.js/test/fixtures/configure-line-chart.png deleted file mode 100644 index 371a54a2..00000000 Binary files a/static/node_modules/angular-chart.js/test/fixtures/configure-line-chart.png and /dev/null differ diff --git a/static/node_modules/angular-chart.js/test/fixtures/coverage.js b/static/node_modules/angular-chart.js/test/fixtures/coverage.js deleted file mode 100644 index 0df26608..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/coverage.js +++ /dev/null @@ -1,9 +0,0 @@ - -var __cov_sIM21KhAGhzWP0B7wdkh_A = (Function('return this'))(); -if (!__cov_sIM21KhAGhzWP0B7wdkh_A.__coverage__) { __cov_sIM21KhAGhzWP0B7wdkh_A.__coverage__ = {}; } -__cov_sIM21KhAGhzWP0B7wdkh_A = __cov_sIM21KhAGhzWP0B7wdkh_A.__coverage__; -if (!(__cov_sIM21KhAGhzWP0B7wdkh_A['/src/angular-chart.js'])) { - __cov_sIM21KhAGhzWP0B7wdkh_A['/src/angular-chart.js'] = {"path":"/src/angular-chart.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":1,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":1,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":1,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":1,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":1,"80":0,"81":0,"82":0,"83":0,"84":0,"85":1,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":1,"98":0,"99":0,"100":0,"101":0,"102":1,"103":0,"104":1,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":0,"113":0,"114":0,"115":0,"116":1,"117":0,"118":0,"119":0,"120":0,"121":0,"122":0,"123":0,"124":1,"125":0,"126":0,"127":0,"128":0,"129":0,"130":0,"131":0,"132":1,"133":0,"134":0,"135":1,"136":0,"137":0,"138":0,"139":1,"140":0,"141":1,"142":0,"143":1,"144":0,"145":0,"146":1,"147":0,"148":0,"149":0,"150":0,"151":0,"152":1,"153":0,"154":1,"155":0,"156":1,"157":0,"158":0,"159":1,"160":0,"161":0,"162":0,"163":0,"164":0,"165":1,"166":0,"167":0,"168":0,"169":0,"170":0,"171":0,"172":1,"173":0,"174":1,"175":0,"176":0,"177":1,"178":0,"179":0,"180":0,"181":0,"182":0,"183":0,"184":1,"185":0,"186":1,"187":0,"188":0,"189":0,"190":0,"191":0,"192":1,"193":0,"194":0,"195":0,"196":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0,0],"9":[0,0],"10":[0,0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0,0,0],"17":[0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0],"25":[0,0],"26":[0,0],"27":[0,0],"28":[0,0],"29":[0,0],"30":[0,0,0,0],"31":[0,0],"32":[0,0],"33":[0,0],"34":[0,0],"35":[0,0],"36":[0,0],"37":[0,0],"38":[0,0],"39":[0,0,0],"40":[0,0,0],"41":[0,0],"42":[0,0],"43":[0,0],"44":[0,0],"45":[0,0],"46":[0,0],"47":[0,0],"48":[0,0],"49":[0,0],"50":[0,0],"51":[0,0],"52":[0,0],"53":[0,0],"54":[0,0],"55":[0,0],"56":[0,0],"57":[0,0],"58":[0,0],"59":[0,0],"60":[0,0],"61":[0,0,0,0,0],"62":[0,0],"63":[0,0],"64":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":20}}},"2":{"name":"(anonymous_2)","line":20,"loc":{"start":{"line":20,"column":2},"end":{"line":20,"column":28}}},"3":{"name":"(anonymous_3)","line":47,"loc":{"start":{"line":47,"column":47},"end":{"line":47,"column":73}}},"4":{"name":"(anonymous_4)","line":48,"loc":{"start":{"line":48,"column":47},"end":{"line":48,"column":73}}},"5":{"name":"(anonymous_5)","line":49,"loc":{"start":{"line":49,"column":46},"end":{"line":49,"column":72}}},"6":{"name":"(anonymous_6)","line":50,"loc":{"start":{"line":50,"column":56},"end":{"line":50,"column":82}}},"7":{"name":"(anonymous_7)","line":51,"loc":{"start":{"line":51,"column":48},"end":{"line":51,"column":74}}},"8":{"name":"(anonymous_8)","line":52,"loc":{"start":{"line":52,"column":51},"end":{"line":52,"column":77}}},"9":{"name":"(anonymous_9)","line":53,"loc":{"start":{"line":53,"column":46},"end":{"line":53,"column":72}}},"10":{"name":"(anonymous_10)","line":54,"loc":{"start":{"line":54,"column":52},"end":{"line":54,"column":78}}},"11":{"name":"(anonymous_11)","line":55,"loc":{"start":{"line":55,"column":49},"end":{"line":55,"column":75}}},"12":{"name":"ChartJsProvider","line":67,"loc":{"start":{"line":67,"column":2},"end":{"line":67,"column":30}}},"13":{"name":"(anonymous_13)","line":71,"loc":{"start":{"line":71,"column":18},"end":{"line":71,"column":34}}},"14":{"name":"(anonymous_14)","line":80,"loc":{"start":{"line":80,"column":22},"end":{"line":80,"column":53}}},"15":{"name":"(anonymous_15)","line":93,"loc":{"start":{"line":93,"column":16},"end":{"line":93,"column":28}}},"16":{"name":"ChartJsFactory","line":98,"loc":{"start":{"line":98,"column":2},"end":{"line":98,"column":46}}},"17":{"name":"chart","line":99,"loc":{"start":{"line":99,"column":11},"end":{"line":99,"column":33}}},"18":{"name":"(anonymous_18)","line":114,"loc":{"start":{"line":114,"column":14},"end":{"line":114,"column":49}}},"19":{"name":"(anonymous_19)","line":126,"loc":{"start":{"line":126,"column":32},"end":{"line":126,"column":44}}},"20":{"name":"(anonymous_20)","line":130,"loc":{"start":{"line":130,"column":31},"end":{"line":130,"column":43}}},"21":{"name":"watchData","line":134,"loc":{"start":{"line":134,"column":10},"end":{"line":134,"column":46}}},"22":{"name":"watchOther","line":148,"loc":{"start":{"line":148,"column":10},"end":{"line":148,"column":47}}},"23":{"name":"watchType","line":159,"loc":{"start":{"line":159,"column":10},"end":{"line":159,"column":46}}},"24":{"name":"createChart","line":168,"loc":{"start":{"line":168,"column":4},"end":{"line":168,"column":45}}},"25":{"name":"canUpdateChart","line":190,"loc":{"start":{"line":190,"column":4},"end":{"line":190,"column":45}}},"26":{"name":"(anonymous_26)","line":193,"loc":{"start":{"line":193,"column":56},"end":{"line":193,"column":82}}},"27":{"name":"sum","line":200,"loc":{"start":{"line":200,"column":4},"end":{"line":200,"column":30}}},"28":{"name":"getEventHandler","line":204,"loc":{"start":{"line":204,"column":4},"end":{"line":204,"column":66}}},"29":{"name":"(anonymous_29)","line":209,"loc":{"start":{"line":209,"column":13},"end":{"line":209,"column":28}}},"30":{"name":"getColors","line":227,"loc":{"start":{"line":227,"column":4},"end":{"line":227,"column":37}}},"31":{"name":"convertColor","line":242,"loc":{"start":{"line":242,"column":4},"end":{"line":242,"column":34}}},"32":{"name":"getRandomColor","line":252,"loc":{"start":{"line":252,"column":4},"end":{"line":252,"column":31}}},"33":{"name":"getColor","line":257,"loc":{"start":{"line":257,"column":4},"end":{"line":257,"column":30}}},"34":{"name":"getRandomInt","line":270,"loc":{"start":{"line":270,"column":4},"end":{"line":270,"column":37}}},"35":{"name":"rgba","line":274,"loc":{"start":{"line":274,"column":4},"end":{"line":274,"column":33}}},"36":{"name":"hexToRgb","line":280,"loc":{"start":{"line":280,"column":4},"end":{"line":280,"column":28}}},"37":{"name":"rgbStringToRgb","line":289,"loc":{"start":{"line":289,"column":4},"end":{"line":289,"column":36}}},"38":{"name":"hasData","line":296,"loc":{"start":{"line":296,"column":4},"end":{"line":296,"column":29}}},"39":{"name":"getChartColorFn","line":300,"loc":{"start":{"line":300,"column":4},"end":{"line":300,"column":37}}},"40":{"name":"getChartData","line":304,"loc":{"start":{"line":304,"column":4},"end":{"line":304,"column":40}}},"41":{"name":"getDataSets","line":311,"loc":{"start":{"line":311,"column":4},"end":{"line":311,"column":73}}},"42":{"name":"(anonymous_42)","line":314,"loc":{"start":{"line":314,"column":27},"end":{"line":314,"column":46}}},"43":{"name":"getData","line":327,"loc":{"start":{"line":327,"column":4},"end":{"line":327,"column":61}}},"44":{"name":"(anonymous_44)","line":332,"loc":{"start":{"line":332,"column":38},"end":{"line":332,"column":55}}},"45":{"name":"(anonymous_45)","line":335,"loc":{"start":{"line":335,"column":43},"end":{"line":335,"column":60}}},"46":{"name":"getChartOptions","line":346,"loc":{"start":{"line":346,"column":4},"end":{"line":346,"column":43}}},"47":{"name":"bindEvents","line":350,"loc":{"start":{"line":350,"column":4},"end":{"line":350,"column":37}}},"48":{"name":"updateChart","line":355,"loc":{"start":{"line":355,"column":4},"end":{"line":355,"column":41}}},"49":{"name":"(anonymous_49)","line":357,"loc":{"start":{"line":357,"column":42},"end":{"line":357,"column":64}}},"50":{"name":"isEmpty","line":368,"loc":{"start":{"line":368,"column":4},"end":{"line":368,"column":29}}},"51":{"name":"canDisplay","line":374,"loc":{"start":{"line":374,"column":4},"end":{"line":374,"column":53}}},"52":{"name":"(anonymous_52)","line":377,"loc":{"start":{"line":377,"column":17},"end":{"line":377,"column":29}}},"53":{"name":"destroyChart","line":385,"loc":{"start":{"line":385,"column":4},"end":{"line":385,"column":33}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":391,"column":4}},"2":{"start":{"line":3,"column":2},"end":{"line":19,"column":3}},"3":{"start":{"line":5,"column":4},"end":{"line":7,"column":66}},"4":{"start":{"line":8,"column":10},"end":{"line":19,"column":3}},"5":{"start":{"line":10,"column":4},"end":{"line":10,"column":42}},"6":{"start":{"line":13,"column":4},"end":{"line":17,"column":5}},"7":{"start":{"line":14,"column":8},"end":{"line":14,"column":96}},"8":{"start":{"line":15,"column":11},"end":{"line":17,"column":5}},"9":{"start":{"line":16,"column":6},"end":{"line":16,"column":110}},"10":{"start":{"line":18,"column":4},"end":{"line":18,"column":28}},"11":{"start":{"line":23,"column":2},"end":{"line":23,"column":108}},"12":{"start":{"line":24,"column":2},"end":{"line":24,"column":48}},"13":{"start":{"line":25,"column":2},"end":{"line":25,"column":54}},"14":{"start":{"line":26,"column":2},"end":{"line":26,"column":59}},"15":{"start":{"line":27,"column":2},"end":{"line":27,"column":47}},"16":{"start":{"line":28,"column":2},"end":{"line":36,"column":4}},"17":{"start":{"line":38,"column":2},"end":{"line":40,"column":64}},"18":{"start":{"line":42,"column":2},"end":{"line":42,"column":59}},"19":{"start":{"line":42,"column":19},"end":{"line":42,"column":59}},"20":{"start":{"line":44,"column":2},"end":{"line":56,"column":10}},"21":{"start":{"line":47,"column":75},"end":{"line":47,"column":103}},"22":{"start":{"line":48,"column":75},"end":{"line":48,"column":109}},"23":{"start":{"line":49,"column":74},"end":{"line":49,"column":107}},"24":{"start":{"line":50,"column":84},"end":{"line":50,"column":127}},"25":{"start":{"line":51,"column":76},"end":{"line":51,"column":111}},"26":{"start":{"line":52,"column":79},"end":{"line":52,"column":117}},"27":{"start":{"line":53,"column":74},"end":{"line":53,"column":107}},"28":{"start":{"line":54,"column":80},"end":{"line":54,"column":119}},"29":{"start":{"line":55,"column":77},"end":{"line":55,"column":113}},"30":{"start":{"line":67,"column":2},"end":{"line":96,"column":3}},"31":{"start":{"line":68,"column":4},"end":{"line":68,"column":39}},"32":{"start":{"line":69,"column":4},"end":{"line":75,"column":6}},"33":{"start":{"line":72,"column":8},"end":{"line":72,"column":54}},"34":{"start":{"line":73,"column":8},"end":{"line":73,"column":56}},"35":{"start":{"line":80,"column":4},"end":{"line":91,"column":6}},"36":{"start":{"line":82,"column":6},"end":{"line":88,"column":7}},"37":{"start":{"line":83,"column":8},"end":{"line":83,"column":29}},"38":{"start":{"line":84,"column":8},"end":{"line":84,"column":56}},"39":{"start":{"line":87,"column":8},"end":{"line":87,"column":74}},"40":{"start":{"line":90,"column":6},"end":{"line":90,"column":53}},"41":{"start":{"line":93,"column":4},"end":{"line":95,"column":6}},"42":{"start":{"line":94,"column":6},"end":{"line":94,"column":21}},"43":{"start":{"line":98,"column":2},"end":{"line":390,"column":3}},"44":{"start":{"line":99,"column":4},"end":{"line":166,"column":6}},"45":{"start":{"line":100,"column":6},"end":{"line":165,"column":8}},"46":{"start":{"line":115,"column":10},"end":{"line":115,"column":74}},"47":{"start":{"line":115,"column":27},"end":{"line":115,"column":74}},"48":{"start":{"line":118,"column":10},"end":{"line":118,"column":53}},"49":{"start":{"line":119,"column":10},"end":{"line":119,"column":56}},"50":{"start":{"line":120,"column":10},"end":{"line":120,"column":56}},"51":{"start":{"line":121,"column":10},"end":{"line":121,"column":57}},"52":{"start":{"line":122,"column":10},"end":{"line":122,"column":56}},"53":{"start":{"line":123,"column":10},"end":{"line":123,"column":65}},"54":{"start":{"line":124,"column":10},"end":{"line":124,"column":54}},"55":{"start":{"line":126,"column":10},"end":{"line":128,"column":13}},"56":{"start":{"line":127,"column":12},"end":{"line":127,"column":32}},"57":{"start":{"line":130,"column":10},"end":{"line":132,"column":13}},"58":{"start":{"line":131,"column":12},"end":{"line":131,"column":50}},"59":{"start":{"line":131,"column":29},"end":{"line":131,"column":50}},"60":{"start":{"line":134,"column":10},"end":{"line":146,"column":11}},"61":{"start":{"line":135,"column":12},"end":{"line":138,"column":13}},"62":{"start":{"line":136,"column":14},"end":{"line":136,"column":34}},"63":{"start":{"line":137,"column":14},"end":{"line":137,"column":21}},"64":{"start":{"line":139,"column":12},"end":{"line":139,"column":52}},"65":{"start":{"line":140,"column":12},"end":{"line":140,"column":36}},"66":{"start":{"line":140,"column":29},"end":{"line":140,"column":36}},"67":{"start":{"line":142,"column":12},"end":{"line":143,"column":48}},"68":{"start":{"line":143,"column":14},"end":{"line":143,"column":48}},"69":{"start":{"line":145,"column":12},"end":{"line":145,"column":48}},"70":{"start":{"line":148,"column":10},"end":{"line":157,"column":11}},"71":{"start":{"line":149,"column":12},"end":{"line":149,"column":40}},"72":{"start":{"line":149,"column":33},"end":{"line":149,"column":40}},"73":{"start":{"line":150,"column":12},"end":{"line":150,"column":55}},"74":{"start":{"line":150,"column":48},"end":{"line":150,"column":55}},"75":{"start":{"line":151,"column":12},"end":{"line":151,"column":52}},"76":{"start":{"line":152,"column":12},"end":{"line":152,"column":36}},"77":{"start":{"line":152,"column":29},"end":{"line":152,"column":36}},"78":{"start":{"line":156,"column":12},"end":{"line":156,"column":48}},"79":{"start":{"line":159,"column":10},"end":{"line":163,"column":11}},"80":{"start":{"line":160,"column":12},"end":{"line":160,"column":40}},"81":{"start":{"line":160,"column":33},"end":{"line":160,"column":40}},"82":{"start":{"line":161,"column":12},"end":{"line":161,"column":55}},"83":{"start":{"line":161,"column":48},"end":{"line":161,"column":55}},"84":{"start":{"line":162,"column":12},"end":{"line":162,"column":45}},"85":{"start":{"line":168,"column":4},"end":{"line":188,"column":5}},"86":{"start":{"line":169,"column":6},"end":{"line":169,"column":49}},"87":{"start":{"line":170,"column":6},"end":{"line":170,"column":79}},"88":{"start":{"line":170,"column":72},"end":{"line":170,"column":79}},"89":{"start":{"line":172,"column":6},"end":{"line":172,"column":24}},"90":{"start":{"line":173,"column":6},"end":{"line":173,"column":37}},"91":{"start":{"line":175,"column":6},"end":{"line":175,"column":51}},"92":{"start":{"line":176,"column":6},"end":{"line":176,"column":43}},"93":{"start":{"line":179,"column":6},"end":{"line":179,"column":26}},"94":{"start":{"line":181,"column":6},"end":{"line":185,"column":9}},"95":{"start":{"line":186,"column":6},"end":{"line":186,"column":47}},"96":{"start":{"line":187,"column":6},"end":{"line":187,"column":29}},"97":{"start":{"line":190,"column":4},"end":{"line":198,"column":5}},"98":{"start":{"line":191,"column":6},"end":{"line":196,"column":7}},"99":{"start":{"line":192,"column":8},"end":{"line":195,"column":78}},"100":{"start":{"line":194,"column":10},"end":{"line":194,"column":57}},"101":{"start":{"line":197,"column":6},"end":{"line":197,"column":19}},"102":{"start":{"line":200,"column":4},"end":{"line":202,"column":5}},"103":{"start":{"line":201,"column":6},"end":{"line":201,"column":25}},"104":{"start":{"line":204,"column":4},"end":{"line":225,"column":5}},"105":{"start":{"line":205,"column":6},"end":{"line":208,"column":8}},"106":{"start":{"line":209,"column":6},"end":{"line":224,"column":8}},"107":{"start":{"line":210,"column":8},"end":{"line":210,"column":83}},"108":{"start":{"line":211,"column":8},"end":{"line":211,"column":86}},"109":{"start":{"line":212,"column":8},"end":{"line":223,"column":9}},"110":{"start":{"line":213,"column":10},"end":{"line":213,"column":55}},"111":{"start":{"line":214,"column":10},"end":{"line":214,"column":75}},"112":{"start":{"line":216,"column":10},"end":{"line":222,"column":11}},"113":{"start":{"line":219,"column":12},"end":{"line":219,"column":36}},"114":{"start":{"line":220,"column":12},"end":{"line":220,"column":38}},"115":{"start":{"line":221,"column":12},"end":{"line":221,"column":46}},"116":{"start":{"line":227,"column":4},"end":{"line":240,"column":5}},"117":{"start":{"line":228,"column":6},"end":{"line":231,"column":8}},"118":{"start":{"line":232,"column":6},"end":{"line":232,"column":67}},"119":{"start":{"line":233,"column":6},"end":{"line":235,"column":7}},"120":{"start":{"line":234,"column":8},"end":{"line":234,"column":43}},"121":{"start":{"line":238,"column":6},"end":{"line":238,"column":54}},"122":{"start":{"line":238,"column":27},"end":{"line":238,"column":54}},"123":{"start":{"line":239,"column":6},"end":{"line":239,"column":38}},"124":{"start":{"line":242,"column":4},"end":{"line":250,"column":5}},"125":{"start":{"line":244,"column":6},"end":{"line":244,"column":96}},"126":{"start":{"line":244,"column":57},"end":{"line":244,"column":96}},"127":{"start":{"line":246,"column":6},"end":{"line":246,"column":100}},"128":{"start":{"line":246,"column":57},"end":{"line":246,"column":100}},"129":{"start":{"line":248,"column":6},"end":{"line":248,"column":68}},"130":{"start":{"line":248,"column":55},"end":{"line":248,"column":68}},"131":{"start":{"line":249,"column":6},"end":{"line":249,"column":30}},"132":{"start":{"line":252,"column":4},"end":{"line":255,"column":5}},"133":{"start":{"line":253,"column":6},"end":{"line":253,"column":85}},"134":{"start":{"line":254,"column":6},"end":{"line":254,"column":29}},"135":{"start":{"line":257,"column":4},"end":{"line":268,"column":5}},"136":{"start":{"line":258,"column":6},"end":{"line":258,"column":32}},"137":{"start":{"line":259,"column":6},"end":{"line":259,"column":32}},"138":{"start":{"line":260,"column":6},"end":{"line":267,"column":8}},"139":{"start":{"line":270,"column":4},"end":{"line":272,"column":5}},"140":{"start":{"line":271,"column":6},"end":{"line":271,"column":63}},"141":{"start":{"line":274,"column":4},"end":{"line":277,"column":5}},"142":{"start":{"line":276,"column":6},"end":{"line":276,"column":106}},"143":{"start":{"line":280,"column":4},"end":{"line":287,"column":5}},"144":{"start":{"line":281,"column":6},"end":{"line":284,"column":25}},"145":{"start":{"line":286,"column":6},"end":{"line":286,"column":23}},"146":{"start":{"line":289,"column":4},"end":{"line":294,"column":5}},"147":{"start":{"line":290,"column":6},"end":{"line":290,"column":54}},"148":{"start":{"line":291,"column":6},"end":{"line":291,"column":61}},"149":{"start":{"line":291,"column":19},"end":{"line":291,"column":61}},"150":{"start":{"line":292,"column":6},"end":{"line":292,"column":34}},"151":{"start":{"line":293,"column":6},"end":{"line":293,"column":31}},"152":{"start":{"line":296,"column":4},"end":{"line":298,"column":5}},"153":{"start":{"line":297,"column":6},"end":{"line":297,"column":55}},"154":{"start":{"line":300,"column":4},"end":{"line":302,"column":5}},"155":{"start":{"line":301,"column":6},"end":{"line":301,"column":94}},"156":{"start":{"line":304,"column":4},"end":{"line":309,"column":5}},"157":{"start":{"line":305,"column":6},"end":{"line":305,"column":42}},"158":{"start":{"line":306,"column":6},"end":{"line":308,"column":88}},"159":{"start":{"line":311,"column":4},"end":{"line":325,"column":5}},"160":{"start":{"line":312,"column":6},"end":{"line":324,"column":8}},"161":{"start":{"line":315,"column":10},"end":{"line":318,"column":13}},"162":{"start":{"line":319,"column":10},"end":{"line":321,"column":11}},"163":{"start":{"line":320,"column":12},"end":{"line":320,"column":55}},"164":{"start":{"line":322,"column":10},"end":{"line":322,"column":25}},"165":{"start":{"line":327,"column":4},"end":{"line":344,"column":5}},"166":{"start":{"line":328,"column":6},"end":{"line":339,"column":8}},"167":{"start":{"line":333,"column":12},"end":{"line":333,"column":46}},"168":{"start":{"line":336,"column":12},"end":{"line":336,"column":41}},"169":{"start":{"line":340,"column":6},"end":{"line":342,"column":7}},"170":{"start":{"line":341,"column":8},"end":{"line":341,"column":60}},"171":{"start":{"line":343,"column":6},"end":{"line":343,"column":21}},"172":{"start":{"line":346,"column":4},"end":{"line":348,"column":5}},"173":{"start":{"line":347,"column":6},"end":{"line":347,"column":78}},"174":{"start":{"line":350,"column":4},"end":{"line":353,"column":5}},"175":{"start":{"line":351,"column":6},"end":{"line":351,"column":98}},"176":{"start":{"line":352,"column":6},"end":{"line":352,"column":101}},"177":{"start":{"line":355,"column":4},"end":{"line":366,"column":5}},"178":{"start":{"line":356,"column":6},"end":{"line":362,"column":7}},"179":{"start":{"line":357,"column":8},"end":{"line":359,"column":11}},"180":{"start":{"line":358,"column":10},"end":{"line":358,"column":35}},"181":{"start":{"line":361,"column":8},"end":{"line":361,"column":51}},"182":{"start":{"line":364,"column":6},"end":{"line":364,"column":27}},"183":{"start":{"line":365,"column":6},"end":{"line":365,"column":47}},"184":{"start":{"line":368,"column":4},"end":{"line":372,"column":5}},"185":{"start":{"line":369,"column":6},"end":{"line":371,"column":67}},"186":{"start":{"line":374,"column":4},"end":{"line":383,"column":5}},"187":{"start":{"line":376,"column":6},"end":{"line":381,"column":7}},"188":{"start":{"line":377,"column":8},"end":{"line":379,"column":22}},"189":{"start":{"line":378,"column":10},"end":{"line":378,"column":41}},"190":{"start":{"line":380,"column":8},"end":{"line":380,"column":21}},"191":{"start":{"line":382,"column":6},"end":{"line":382,"column":18}},"192":{"start":{"line":385,"column":4},"end":{"line":389,"column":5}},"193":{"start":{"line":386,"column":6},"end":{"line":386,"column":31}},"194":{"start":{"line":386,"column":24},"end":{"line":386,"column":31}},"195":{"start":{"line":387,"column":6},"end":{"line":387,"column":28}},"196":{"start":{"line":388,"column":6},"end":{"line":388,"column":48}}},"branchMap":{"1":{"line":3,"type":"if","locations":[{"start":{"line":3,"column":2},"end":{"line":3,"column":2}},{"start":{"line":3,"column":2},"end":{"line":3,"column":2}}]},"2":{"line":6,"type":"cond-expr","locations":[{"start":{"line":6,"column":39},"end":{"line":6,"column":46}},{"start":{"line":6,"column":49},"end":{"line":6,"column":67}}]},"3":{"line":7,"type":"cond-expr","locations":[{"start":{"line":7,"column":37},"end":{"line":7,"column":42}},{"start":{"line":7,"column":45},"end":{"line":7,"column":64}}]},"4":{"line":8,"type":"if","locations":[{"start":{"line":8,"column":10},"end":{"line":8,"column":10}},{"start":{"line":8,"column":10},"end":{"line":8,"column":10}}]},"5":{"line":8,"type":"binary-expr","locations":[{"start":{"line":8,"column":14},"end":{"line":8,"column":42}},{"start":{"line":8,"column":46},"end":{"line":8,"column":56}}]},"6":{"line":13,"type":"if","locations":[{"start":{"line":13,"column":4},"end":{"line":13,"column":4}},{"start":{"line":13,"column":4},"end":{"line":13,"column":4}}]},"7":{"line":15,"type":"if","locations":[{"start":{"line":15,"column":11},"end":{"line":15,"column":11}},{"start":{"line":15,"column":11},"end":{"line":15,"column":11}}]},"8":{"line":38,"type":"binary-expr","locations":[{"start":{"line":38,"column":20},"end":{"line":38,"column":65}},{"start":{"line":39,"column":4},"end":{"line":39,"column":38}},{"start":{"line":40,"column":4},"end":{"line":40,"column":63}}]},"9":{"line":42,"type":"if","locations":[{"start":{"line":42,"column":2},"end":{"line":42,"column":2}},{"start":{"line":42,"column":2},"end":{"line":42,"column":2}}]},"10":{"line":72,"type":"binary-expr","locations":[{"start":{"line":72,"column":26},"end":{"line":72,"column":30}},{"start":{"line":72,"column":34},"end":{"line":72,"column":47}},{"start":{"line":72,"column":51},"end":{"line":72,"column":53}}]},"11":{"line":82,"type":"if","locations":[{"start":{"line":82,"column":6},"end":{"line":82,"column":6}},{"start":{"line":82,"column":6},"end":{"line":82,"column":6}}]},"12":{"line":87,"type":"binary-expr","locations":[{"start":{"line":87,"column":38},"end":{"line":87,"column":51}},{"start":{"line":87,"column":55},"end":{"line":87,"column":57}}]},"13":{"line":115,"type":"if","locations":[{"start":{"line":115,"column":10},"end":{"line":115,"column":10}},{"start":{"line":115,"column":10},"end":{"line":115,"column":10}}]},"14":{"line":131,"type":"if","locations":[{"start":{"line":131,"column":12},"end":{"line":131,"column":12}},{"start":{"line":131,"column":12},"end":{"line":131,"column":12}}]},"15":{"line":135,"type":"if","locations":[{"start":{"line":135,"column":12},"end":{"line":135,"column":12}},{"start":{"line":135,"column":12},"end":{"line":135,"column":12}}]},"16":{"line":135,"type":"binary-expr","locations":[{"start":{"line":135,"column":16},"end":{"line":135,"column":24}},{"start":{"line":135,"column":28},"end":{"line":135,"column":43}},{"start":{"line":135,"column":48},"end":{"line":135,"column":72}},{"start":{"line":135,"column":76},"end":{"line":135,"column":94}}]},"17":{"line":139,"type":"binary-expr","locations":[{"start":{"line":139,"column":28},"end":{"line":139,"column":32}},{"start":{"line":139,"column":36},"end":{"line":139,"column":51}}]},"18":{"line":140,"type":"if","locations":[{"start":{"line":140,"column":12},"end":{"line":140,"column":12}},{"start":{"line":140,"column":12},"end":{"line":140,"column":12}}]},"19":{"line":142,"type":"if","locations":[{"start":{"line":142,"column":12},"end":{"line":142,"column":12}},{"start":{"line":142,"column":12},"end":{"line":142,"column":12}}]},"20":{"line":142,"type":"binary-expr","locations":[{"start":{"line":142,"column":16},"end":{"line":142,"column":27}},{"start":{"line":142,"column":31},"end":{"line":142,"column":61}}]},"21":{"line":149,"type":"if","locations":[{"start":{"line":149,"column":12},"end":{"line":149,"column":12}},{"start":{"line":149,"column":12},"end":{"line":149,"column":12}}]},"22":{"line":150,"type":"if","locations":[{"start":{"line":150,"column":12},"end":{"line":150,"column":12}},{"start":{"line":150,"column":12},"end":{"line":150,"column":12}}]},"23":{"line":151,"type":"binary-expr","locations":[{"start":{"line":151,"column":28},"end":{"line":151,"column":32}},{"start":{"line":151,"column":36},"end":{"line":151,"column":51}}]},"24":{"line":152,"type":"if","locations":[{"start":{"line":152,"column":12},"end":{"line":152,"column":12}},{"start":{"line":152,"column":12},"end":{"line":152,"column":12}}]},"25":{"line":160,"type":"if","locations":[{"start":{"line":160,"column":12},"end":{"line":160,"column":12}},{"start":{"line":160,"column":12},"end":{"line":160,"column":12}}]},"26":{"line":161,"type":"if","locations":[{"start":{"line":161,"column":12},"end":{"line":161,"column":12}},{"start":{"line":161,"column":12},"end":{"line":161,"column":12}}]},"27":{"line":170,"type":"if","locations":[{"start":{"line":170,"column":6},"end":{"line":170,"column":6}},{"start":{"line":170,"column":6},"end":{"line":170,"column":6}}]},"28":{"line":170,"type":"binary-expr","locations":[{"start":{"line":170,"column":10},"end":{"line":170,"column":26}},{"start":{"line":170,"column":30},"end":{"line":170,"column":70}}]},"29":{"line":191,"type":"if","locations":[{"start":{"line":191,"column":6},"end":{"line":191,"column":6}},{"start":{"line":191,"column":6},"end":{"line":191,"column":6}}]},"30":{"line":191,"type":"binary-expr","locations":[{"start":{"line":191,"column":10},"end":{"line":191,"column":16}},{"start":{"line":191,"column":20},"end":{"line":191,"column":26}},{"start":{"line":191,"column":30},"end":{"line":191,"column":43}},{"start":{"line":191,"column":47},"end":{"line":191,"column":60}}]},"31":{"line":192,"type":"cond-expr","locations":[{"start":{"line":193,"column":8},"end":{"line":194,"column":60}},{"start":{"line":195,"column":10},"end":{"line":195,"column":77}}]},"32":{"line":193,"type":"binary-expr","locations":[{"start":{"line":193,"column":8},"end":{"line":193,"column":39}},{"start":{"line":193,"column":43},"end":{"line":194,"column":60}}]},"33":{"line":195,"type":"cond-expr","locations":[{"start":{"line":195,"column":38},"end":{"line":195,"column":69}},{"start":{"line":195,"column":72},"end":{"line":195,"column":77}}]},"34":{"line":210,"type":"binary-expr","locations":[{"start":{"line":210,"column":22},"end":{"line":210,"column":51}},{"start":{"line":210,"column":55},"end":{"line":210,"column":82}}]},"35":{"line":211,"type":"binary-expr","locations":[{"start":{"line":211,"column":23},"end":{"line":211,"column":53}},{"start":{"line":211,"column":57},"end":{"line":211,"column":85}}]},"36":{"line":212,"type":"if","locations":[{"start":{"line":212,"column":8},"end":{"line":212,"column":8}},{"start":{"line":212,"column":8},"end":{"line":212,"column":8}}]},"37":{"line":214,"type":"cond-expr","locations":[{"start":{"line":214,"column":32},"end":{"line":214,"column":65}},{"start":{"line":214,"column":68},"end":{"line":214,"column":74}}]},"38":{"line":216,"type":"if","locations":[{"start":{"line":216,"column":10},"end":{"line":216,"column":10}},{"start":{"line":216,"column":10},"end":{"line":216,"column":10}}]},"39":{"line":216,"type":"binary-expr","locations":[{"start":{"line":216,"column":14},"end":{"line":216,"column":43}},{"start":{"line":217,"column":13},"end":{"line":217,"column":55}},{"start":{"line":217,"column":59},"end":{"line":217,"column":99}}]},"40":{"line":228,"type":"binary-expr","locations":[{"start":{"line":228,"column":32},"end":{"line":228,"column":49}},{"start":{"line":229,"column":8},"end":{"line":229,"column":44}},{"start":{"line":230,"column":8},"end":{"line":230,"column":36}}]},"41":{"line":238,"type":"if","locations":[{"start":{"line":238,"column":6},"end":{"line":238,"column":6}},{"start":{"line":238,"column":6},"end":{"line":238,"column":6}}]},"42":{"line":244,"type":"if","locations":[{"start":{"line":244,"column":6},"end":{"line":244,"column":6}},{"start":{"line":244,"column":6},"end":{"line":244,"column":6}}]},"43":{"line":244,"type":"binary-expr","locations":[{"start":{"line":244,"column":10},"end":{"line":244,"column":35}},{"start":{"line":244,"column":39},"end":{"line":244,"column":55}}]},"44":{"line":246,"type":"if","locations":[{"start":{"line":246,"column":6},"end":{"line":246,"column":6}},{"start":{"line":246,"column":6},"end":{"line":246,"column":6}}]},"45":{"line":246,"type":"binary-expr","locations":[{"start":{"line":246,"column":10},"end":{"line":246,"column":35}},{"start":{"line":246,"column":39},"end":{"line":246,"column":55}}]},"46":{"line":248,"type":"if","locations":[{"start":{"line":248,"column":6},"end":{"line":248,"column":6}},{"start":{"line":248,"column":6},"end":{"line":248,"column":6}}]},"47":{"line":248,"type":"binary-expr","locations":[{"start":{"line":248,"column":10},"end":{"line":248,"column":35}},{"start":{"line":248,"column":39},"end":{"line":248,"column":53}}]},"48":{"line":258,"type":"binary-expr","locations":[{"start":{"line":258,"column":18},"end":{"line":258,"column":26}},{"start":{"line":258,"column":30},"end":{"line":258,"column":31}}]},"49":{"line":276,"type":"cond-expr","locations":[{"start":{"line":276,"column":27},"end":{"line":276,"column":57}},{"start":{"line":276,"column":60},"end":{"line":276,"column":105}}]},"50":{"line":291,"type":"if","locations":[{"start":{"line":291,"column":6},"end":{"line":291,"column":6}},{"start":{"line":291,"column":6},"end":{"line":291,"column":6}}]},"51":{"line":297,"type":"binary-expr","locations":[{"start":{"line":297,"column":13},"end":{"line":297,"column":28}},{"start":{"line":297,"column":32},"end":{"line":297,"column":54}}]},"52":{"line":301,"type":"cond-expr","locations":[{"start":{"line":301,"column":57},"end":{"line":301,"column":76}},{"start":{"line":301,"column":79},"end":{"line":301,"column":93}}]},"53":{"line":306,"type":"cond-expr","locations":[{"start":{"line":307,"column":8},"end":{"line":307,"column":116}},{"start":{"line":308,"column":8},"end":{"line":308,"column":87}}]},"54":{"line":307,"type":"binary-expr","locations":[{"start":{"line":307,"column":56},"end":{"line":307,"column":73}},{"start":{"line":307,"column":77},"end":{"line":307,"column":79}}]},"55":{"line":319,"type":"if","locations":[{"start":{"line":319,"column":10},"end":{"line":319,"column":10}},{"start":{"line":319,"column":10},"end":{"line":319,"column":10}}]},"56":{"line":319,"type":"binary-expr","locations":[{"start":{"line":319,"column":14},"end":{"line":319,"column":29}},{"start":{"line":319,"column":33},"end":{"line":319,"column":60}}]},"57":{"line":340,"type":"if","locations":[{"start":{"line":340,"column":6},"end":{"line":340,"column":6}},{"start":{"line":340,"column":6},"end":{"line":340,"column":6}}]},"58":{"line":351,"type":"cond-expr","locations":[{"start":{"line":351,"column":39},"end":{"line":351,"column":82}},{"start":{"line":351,"column":85},"end":{"line":351,"column":97}}]},"59":{"line":352,"type":"cond-expr","locations":[{"start":{"line":352,"column":43},"end":{"line":352,"column":85}},{"start":{"line":352,"column":88},"end":{"line":352,"column":100}}]},"60":{"line":356,"type":"if","locations":[{"start":{"line":356,"column":6},"end":{"line":356,"column":6}},{"start":{"line":356,"column":6},"end":{"line":356,"column":6}}]},"61":{"line":369,"type":"binary-expr","locations":[{"start":{"line":369,"column":13},"end":{"line":369,"column":20}},{"start":{"line":370,"column":9},"end":{"line":370,"column":29}},{"start":{"line":370,"column":33},"end":{"line":370,"column":47}},{"start":{"line":371,"column":9},"end":{"line":371,"column":34}},{"start":{"line":371,"column":38},"end":{"line":371,"column":65}}]},"62":{"line":376,"type":"if","locations":[{"start":{"line":376,"column":6},"end":{"line":376,"column":6}},{"start":{"line":376,"column":6},"end":{"line":376,"column":6}}]},"63":{"line":376,"type":"binary-expr","locations":[{"start":{"line":376,"column":10},"end":{"line":376,"column":28}},{"start":{"line":376,"column":32},"end":{"line":376,"column":58}}]},"64":{"line":386,"type":"if","locations":[{"start":{"line":386,"column":6},"end":{"line":386,"column":6}},{"start":{"line":386,"column":6},"end":{"line":386,"column":6}}]}}}; -} -__cov_sIM21KhAGhzWP0B7wdkh_A = __cov_sIM21KhAGhzWP0B7wdkh_A['/src/angular-chart.js']; -__cov_sIM21KhAGhzWP0B7wdkh_A.s['1']++;(function(factory){'use strict';__cov_sIM21KhAGhzWP0B7wdkh_A.f['1']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['2']++;if(typeof exports==='object'){__cov_sIM21KhAGhzWP0B7wdkh_A.b['1'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['3']++;module.exports=factory(typeof angular!=='undefined'?(__cov_sIM21KhAGhzWP0B7wdkh_A.b['2'][0]++,angular):(__cov_sIM21KhAGhzWP0B7wdkh_A.b['2'][1]++,require('angular')),typeof Chart!=='undefined'?(__cov_sIM21KhAGhzWP0B7wdkh_A.b['3'][0]++,Chart):(__cov_sIM21KhAGhzWP0B7wdkh_A.b['3'][1]++,require('chart.js')));}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['1'][1]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['4']++;if((__cov_sIM21KhAGhzWP0B7wdkh_A.b['5'][0]++,typeof define==='function')&&(__cov_sIM21KhAGhzWP0B7wdkh_A.b['5'][1]++,define.amd)){__cov_sIM21KhAGhzWP0B7wdkh_A.b['4'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['5']++;define(['angular','chart'],factory);}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['4'][1]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['6']++;if(typeof angular==='undefined'){__cov_sIM21KhAGhzWP0B7wdkh_A.b['6'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['7']++;throw new Error('AngularJS framework needs to be included, see https://angularjs.org/');}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['6'][1]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['8']++;if(typeof Chart==='undefined'){__cov_sIM21KhAGhzWP0B7wdkh_A.b['7'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['9']++;throw new Error('Chart.js library needs to be included, see http://jtblin.github.io/angular-chart.js/');}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['7'][1]++;}}__cov_sIM21KhAGhzWP0B7wdkh_A.s['10']++;factory(angular,Chart);}}}(function(angular,Chart){'use strict';__cov_sIM21KhAGhzWP0B7wdkh_A.f['2']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['11']++;Chart.defaults.global.multiTooltipTemplate='<%if (datasetLabel){%><%=datasetLabel%>: <%}%><%= value %>';__cov_sIM21KhAGhzWP0B7wdkh_A.s['12']++;Chart.defaults.global.tooltips.mode='label';__cov_sIM21KhAGhzWP0B7wdkh_A.s['13']++;Chart.defaults.global.elements.line.borderWidth=2;__cov_sIM21KhAGhzWP0B7wdkh_A.s['14']++;Chart.defaults.global.elements.rectangle.borderWidth=2;__cov_sIM21KhAGhzWP0B7wdkh_A.s['15']++;Chart.defaults.global.legend.display=false;__cov_sIM21KhAGhzWP0B7wdkh_A.s['16']++;Chart.defaults.global.colors=['#97BBCD','#DCDCDC','#F7464A','#46BFBD','#FDB45C','#949FB1','#4D5360'];__cov_sIM21KhAGhzWP0B7wdkh_A.s['17']++;var useExcanvas=(__cov_sIM21KhAGhzWP0B7wdkh_A.b['8'][0]++,typeof window.G_vmlCanvasManager==='object')&&(__cov_sIM21KhAGhzWP0B7wdkh_A.b['8'][1]++,window.G_vmlCanvasManager!==null)&&(__cov_sIM21KhAGhzWP0B7wdkh_A.b['8'][2]++,typeof window.G_vmlCanvasManager.initElement==='function');__cov_sIM21KhAGhzWP0B7wdkh_A.s['18']++;if(useExcanvas){__cov_sIM21KhAGhzWP0B7wdkh_A.b['9'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['19']++;Chart.defaults.global.animation=false;}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['9'][1]++;}__cov_sIM21KhAGhzWP0B7wdkh_A.s['20']++;return angular.module('chart.js',[]).provider('ChartJs',ChartJsProvider).factory('ChartJsFactory',['ChartJs','$timeout',ChartJsFactory]).directive('chartBase',['ChartJsFactory',function(ChartJsFactory){__cov_sIM21KhAGhzWP0B7wdkh_A.f['3']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['21']++;return new ChartJsFactory();}]).directive('chartLine',['ChartJsFactory',function(ChartJsFactory){__cov_sIM21KhAGhzWP0B7wdkh_A.f['4']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['22']++;return new ChartJsFactory('line');}]).directive('chartBar',['ChartJsFactory',function(ChartJsFactory){__cov_sIM21KhAGhzWP0B7wdkh_A.f['5']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['23']++;return new ChartJsFactory('bar');}]).directive('chartHorizontalBar',['ChartJsFactory',function(ChartJsFactory){__cov_sIM21KhAGhzWP0B7wdkh_A.f['6']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['24']++;return new ChartJsFactory('horizontalBar');}]).directive('chartRadar',['ChartJsFactory',function(ChartJsFactory){__cov_sIM21KhAGhzWP0B7wdkh_A.f['7']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['25']++;return new ChartJsFactory('radar');}]).directive('chartDoughnut',['ChartJsFactory',function(ChartJsFactory){__cov_sIM21KhAGhzWP0B7wdkh_A.f['8']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['26']++;return new ChartJsFactory('doughnut');}]).directive('chartPie',['ChartJsFactory',function(ChartJsFactory){__cov_sIM21KhAGhzWP0B7wdkh_A.f['9']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['27']++;return new ChartJsFactory('pie');}]).directive('chartPolarArea',['ChartJsFactory',function(ChartJsFactory){__cov_sIM21KhAGhzWP0B7wdkh_A.f['10']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['28']++;return new ChartJsFactory('polarArea');}]).directive('chartBubble',['ChartJsFactory',function(ChartJsFactory){__cov_sIM21KhAGhzWP0B7wdkh_A.f['11']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['29']++;return new ChartJsFactory('bubble');}]).name;function ChartJsProvider(){__cov_sIM21KhAGhzWP0B7wdkh_A.f['12']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['31']++;var options={responsive:true};__cov_sIM21KhAGhzWP0B7wdkh_A.s['32']++;var ChartJs={Chart:Chart,getOptions:function(type){__cov_sIM21KhAGhzWP0B7wdkh_A.f['13']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['33']++;var typeOptions=(__cov_sIM21KhAGhzWP0B7wdkh_A.b['10'][0]++,type)&&(__cov_sIM21KhAGhzWP0B7wdkh_A.b['10'][1]++,options[type])||(__cov_sIM21KhAGhzWP0B7wdkh_A.b['10'][2]++,{});__cov_sIM21KhAGhzWP0B7wdkh_A.s['34']++;return angular.extend({},options,typeOptions);}};__cov_sIM21KhAGhzWP0B7wdkh_A.s['35']++;this.setOptions=function(type,customOptions){__cov_sIM21KhAGhzWP0B7wdkh_A.f['14']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['36']++;if(!customOptions){__cov_sIM21KhAGhzWP0B7wdkh_A.b['11'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['37']++;customOptions=type;__cov_sIM21KhAGhzWP0B7wdkh_A.s['38']++;options=angular.merge(options,customOptions);}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['11'][1]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['39']++;options[type]=angular.merge((__cov_sIM21KhAGhzWP0B7wdkh_A.b['12'][0]++,options[type])||(__cov_sIM21KhAGhzWP0B7wdkh_A.b['12'][1]++,{}),customOptions);}__cov_sIM21KhAGhzWP0B7wdkh_A.s['40']++;angular.merge(ChartJs.Chart.defaults,options);};__cov_sIM21KhAGhzWP0B7wdkh_A.s['41']++;this.$get=function(){__cov_sIM21KhAGhzWP0B7wdkh_A.f['15']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['42']++;return ChartJs;};}function ChartJsFactory(ChartJs,$timeout){__cov_sIM21KhAGhzWP0B7wdkh_A.f['16']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['44']++;return function chart(type){__cov_sIM21KhAGhzWP0B7wdkh_A.f['17']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['45']++;return{restrict:'CA',scope:{chartGetColor:'=?',chartType:'=',chartData:'=?',chartLabels:'=?',chartOptions:'=?',chartSeries:'=?',chartColors:'=?',chartClick:'=?',chartHover:'=?',chartDatasetOverride:'=?'},link:function(scope,elem){__cov_sIM21KhAGhzWP0B7wdkh_A.f['18']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['46']++;if(useExcanvas){__cov_sIM21KhAGhzWP0B7wdkh_A.b['13'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['47']++;window.G_vmlCanvasManager.initElement(elem[0]);}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['13'][1]++;}__cov_sIM21KhAGhzWP0B7wdkh_A.s['48']++;scope.$watch('chartData',watchData,true);__cov_sIM21KhAGhzWP0B7wdkh_A.s['49']++;scope.$watch('chartSeries',watchOther,true);__cov_sIM21KhAGhzWP0B7wdkh_A.s['50']++;scope.$watch('chartLabels',watchOther,true);__cov_sIM21KhAGhzWP0B7wdkh_A.s['51']++;scope.$watch('chartOptions',watchOther,true);__cov_sIM21KhAGhzWP0B7wdkh_A.s['52']++;scope.$watch('chartColors',watchOther,true);__cov_sIM21KhAGhzWP0B7wdkh_A.s['53']++;scope.$watch('chartDatasetOverride',watchOther,true);__cov_sIM21KhAGhzWP0B7wdkh_A.s['54']++;scope.$watch('chartType',watchType,false);__cov_sIM21KhAGhzWP0B7wdkh_A.s['55']++;scope.$on('$destroy',function(){__cov_sIM21KhAGhzWP0B7wdkh_A.f['19']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['56']++;destroyChart(scope);});__cov_sIM21KhAGhzWP0B7wdkh_A.s['57']++;scope.$on('$resize',function(){__cov_sIM21KhAGhzWP0B7wdkh_A.f['20']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['58']++;if(scope.chart){__cov_sIM21KhAGhzWP0B7wdkh_A.b['14'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['59']++;scope.chart.resize();}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['14'][1]++;}});function watchData(newVal,oldVal){__cov_sIM21KhAGhzWP0B7wdkh_A.f['21']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['61']++;if((__cov_sIM21KhAGhzWP0B7wdkh_A.b['16'][0]++,!newVal)||(__cov_sIM21KhAGhzWP0B7wdkh_A.b['16'][1]++,!newVal.length)||(__cov_sIM21KhAGhzWP0B7wdkh_A.b['16'][2]++,Array.isArray(newVal[0]))&&(__cov_sIM21KhAGhzWP0B7wdkh_A.b['16'][3]++,!newVal[0].length)){__cov_sIM21KhAGhzWP0B7wdkh_A.b['15'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['62']++;destroyChart(scope);__cov_sIM21KhAGhzWP0B7wdkh_A.s['63']++;return;}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['15'][1]++;}__cov_sIM21KhAGhzWP0B7wdkh_A.s['64']++;var chartType=(__cov_sIM21KhAGhzWP0B7wdkh_A.b['17'][0]++,type)||(__cov_sIM21KhAGhzWP0B7wdkh_A.b['17'][1]++,scope.chartType);__cov_sIM21KhAGhzWP0B7wdkh_A.s['65']++;if(!chartType){__cov_sIM21KhAGhzWP0B7wdkh_A.b['18'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['66']++;return;}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['18'][1]++;}__cov_sIM21KhAGhzWP0B7wdkh_A.s['67']++;if((__cov_sIM21KhAGhzWP0B7wdkh_A.b['20'][0]++,scope.chart)&&(__cov_sIM21KhAGhzWP0B7wdkh_A.b['20'][1]++,canUpdateChart(newVal,oldVal))){__cov_sIM21KhAGhzWP0B7wdkh_A.b['19'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['68']++;return updateChart(newVal,scope);}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['19'][1]++;}__cov_sIM21KhAGhzWP0B7wdkh_A.s['69']++;createChart(chartType,scope,elem);}function watchOther(newVal,oldVal){__cov_sIM21KhAGhzWP0B7wdkh_A.f['22']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['71']++;if(isEmpty(newVal)){__cov_sIM21KhAGhzWP0B7wdkh_A.b['21'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['72']++;return;}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['21'][1]++;}__cov_sIM21KhAGhzWP0B7wdkh_A.s['73']++;if(angular.equals(newVal,oldVal)){__cov_sIM21KhAGhzWP0B7wdkh_A.b['22'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['74']++;return;}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['22'][1]++;}__cov_sIM21KhAGhzWP0B7wdkh_A.s['75']++;var chartType=(__cov_sIM21KhAGhzWP0B7wdkh_A.b['23'][0]++,type)||(__cov_sIM21KhAGhzWP0B7wdkh_A.b['23'][1]++,scope.chartType);__cov_sIM21KhAGhzWP0B7wdkh_A.s['76']++;if(!chartType){__cov_sIM21KhAGhzWP0B7wdkh_A.b['24'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['77']++;return;}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['24'][1]++;}__cov_sIM21KhAGhzWP0B7wdkh_A.s['78']++;createChart(chartType,scope,elem);}function watchType(newVal,oldVal){__cov_sIM21KhAGhzWP0B7wdkh_A.f['23']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['80']++;if(isEmpty(newVal)){__cov_sIM21KhAGhzWP0B7wdkh_A.b['25'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['81']++;return;}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['25'][1]++;}__cov_sIM21KhAGhzWP0B7wdkh_A.s['82']++;if(angular.equals(newVal,oldVal)){__cov_sIM21KhAGhzWP0B7wdkh_A.b['26'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['83']++;return;}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['26'][1]++;}__cov_sIM21KhAGhzWP0B7wdkh_A.s['84']++;createChart(newVal,scope,elem);}}};};function createChart(type,scope,elem){__cov_sIM21KhAGhzWP0B7wdkh_A.f['24']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['86']++;var options=getChartOptions(type,scope);__cov_sIM21KhAGhzWP0B7wdkh_A.s['87']++;if((__cov_sIM21KhAGhzWP0B7wdkh_A.b['28'][0]++,!hasData(scope))||(__cov_sIM21KhAGhzWP0B7wdkh_A.b['28'][1]++,!canDisplay(type,scope,elem,options))){__cov_sIM21KhAGhzWP0B7wdkh_A.b['27'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['88']++;return;}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['27'][1]++;}__cov_sIM21KhAGhzWP0B7wdkh_A.s['89']++;var cvs=elem[0];__cov_sIM21KhAGhzWP0B7wdkh_A.s['90']++;var ctx=cvs.getContext('2d');__cov_sIM21KhAGhzWP0B7wdkh_A.s['91']++;scope.chartGetColor=getChartColorFn(scope);__cov_sIM21KhAGhzWP0B7wdkh_A.s['92']++;var data=getChartData(type,scope);__cov_sIM21KhAGhzWP0B7wdkh_A.s['93']++;destroyChart(scope);__cov_sIM21KhAGhzWP0B7wdkh_A.s['94']++;scope.chart=new ChartJs.Chart(ctx,{type:type,data:data,options:options});__cov_sIM21KhAGhzWP0B7wdkh_A.s['95']++;scope.$emit('chart-create',scope.chart);__cov_sIM21KhAGhzWP0B7wdkh_A.s['96']++;bindEvents(cvs,scope);}function canUpdateChart(newVal,oldVal){__cov_sIM21KhAGhzWP0B7wdkh_A.f['25']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['98']++;if((__cov_sIM21KhAGhzWP0B7wdkh_A.b['30'][0]++,newVal)&&(__cov_sIM21KhAGhzWP0B7wdkh_A.b['30'][1]++,oldVal)&&(__cov_sIM21KhAGhzWP0B7wdkh_A.b['30'][2]++,newVal.length)&&(__cov_sIM21KhAGhzWP0B7wdkh_A.b['30'][3]++,oldVal.length)){__cov_sIM21KhAGhzWP0B7wdkh_A.b['29'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['99']++;return Array.isArray(newVal[0])?(__cov_sIM21KhAGhzWP0B7wdkh_A.b['31'][0]++,(__cov_sIM21KhAGhzWP0B7wdkh_A.b['32'][0]++,newVal.length===oldVal.length)&&(__cov_sIM21KhAGhzWP0B7wdkh_A.b['32'][1]++,newVal.every(function(element,index){__cov_sIM21KhAGhzWP0B7wdkh_A.f['26']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['100']++;return element.length===oldVal[index].length;}))):(__cov_sIM21KhAGhzWP0B7wdkh_A.b['31'][1]++,oldVal.reduce(sum,0)>0?(__cov_sIM21KhAGhzWP0B7wdkh_A.b['33'][0]++,newVal.length===oldVal.length):(__cov_sIM21KhAGhzWP0B7wdkh_A.b['33'][1]++,false));}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['29'][1]++;}__cov_sIM21KhAGhzWP0B7wdkh_A.s['101']++;return false;}function sum(carry,val){__cov_sIM21KhAGhzWP0B7wdkh_A.f['27']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['103']++;return carry+val;}function getEventHandler(scope,action,triggerOnlyOnChange){__cov_sIM21KhAGhzWP0B7wdkh_A.f['28']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['105']++;var lastState={point:void 0,points:void 0};__cov_sIM21KhAGhzWP0B7wdkh_A.s['106']++;return function(evt){__cov_sIM21KhAGhzWP0B7wdkh_A.f['29']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['107']++;var atEvent=(__cov_sIM21KhAGhzWP0B7wdkh_A.b['34'][0]++,scope.chart.getElementAtEvent)||(__cov_sIM21KhAGhzWP0B7wdkh_A.b['34'][1]++,scope.chart.getPointAtEvent);__cov_sIM21KhAGhzWP0B7wdkh_A.s['108']++;var atEvents=(__cov_sIM21KhAGhzWP0B7wdkh_A.b['35'][0]++,scope.chart.getElementsAtEvent)||(__cov_sIM21KhAGhzWP0B7wdkh_A.b['35'][1]++,scope.chart.getPointsAtEvent);__cov_sIM21KhAGhzWP0B7wdkh_A.s['109']++;if(atEvents){__cov_sIM21KhAGhzWP0B7wdkh_A.b['36'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['110']++;var points=atEvents.call(scope.chart,evt);__cov_sIM21KhAGhzWP0B7wdkh_A.s['111']++;var point=atEvent?(__cov_sIM21KhAGhzWP0B7wdkh_A.b['37'][0]++,atEvent.call(scope.chart,evt)[0]):(__cov_sIM21KhAGhzWP0B7wdkh_A.b['37'][1]++,void 0);__cov_sIM21KhAGhzWP0B7wdkh_A.s['112']++;if((__cov_sIM21KhAGhzWP0B7wdkh_A.b['39'][0]++,triggerOnlyOnChange===false)||(__cov_sIM21KhAGhzWP0B7wdkh_A.b['39'][1]++,!angular.equals(lastState.points,points))&&(__cov_sIM21KhAGhzWP0B7wdkh_A.b['39'][2]++,!angular.equals(lastState.point,point))){__cov_sIM21KhAGhzWP0B7wdkh_A.b['38'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['113']++;lastState.point=point;__cov_sIM21KhAGhzWP0B7wdkh_A.s['114']++;lastState.points=points;__cov_sIM21KhAGhzWP0B7wdkh_A.s['115']++;scope[action](points,evt,point);}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['38'][1]++;}}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['36'][1]++;}};}function getColors(type,scope){__cov_sIM21KhAGhzWP0B7wdkh_A.f['30']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['117']++;var colors=angular.copy((__cov_sIM21KhAGhzWP0B7wdkh_A.b['40'][0]++,scope.chartColors)||(__cov_sIM21KhAGhzWP0B7wdkh_A.b['40'][1]++,ChartJs.getOptions(type).chartColors)||(__cov_sIM21KhAGhzWP0B7wdkh_A.b['40'][2]++,Chart.defaults.global.colors));__cov_sIM21KhAGhzWP0B7wdkh_A.s['118']++;var notEnoughColors=colors.length>16&255,g=bigint>>8&255,b=bigint&255;__cov_sIM21KhAGhzWP0B7wdkh_A.s['145']++;return[r,g,b];}function rgbStringToRgb(color){__cov_sIM21KhAGhzWP0B7wdkh_A.f['37']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['147']++;var match=color.match(/^rgba?\(([\d,.]+)\)$/);__cov_sIM21KhAGhzWP0B7wdkh_A.s['148']++;if(!match){__cov_sIM21KhAGhzWP0B7wdkh_A.b['50'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['149']++;throw new Error('Cannot parse rgb value');}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['50'][1]++;}__cov_sIM21KhAGhzWP0B7wdkh_A.s['150']++;color=match[1].split(',');__cov_sIM21KhAGhzWP0B7wdkh_A.s['151']++;return color.map(Number);}function hasData(scope){__cov_sIM21KhAGhzWP0B7wdkh_A.f['38']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['153']++;return(__cov_sIM21KhAGhzWP0B7wdkh_A.b['51'][0]++,scope.chartData)&&(__cov_sIM21KhAGhzWP0B7wdkh_A.b['51'][1]++,scope.chartData.length);}function getChartColorFn(scope){__cov_sIM21KhAGhzWP0B7wdkh_A.f['39']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['155']++;return typeof scope.chartGetColor==='function'?(__cov_sIM21KhAGhzWP0B7wdkh_A.b['52'][0]++,scope.chartGetColor):(__cov_sIM21KhAGhzWP0B7wdkh_A.b['52'][1]++,getRandomColor);}function getChartData(type,scope){__cov_sIM21KhAGhzWP0B7wdkh_A.f['40']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['157']++;var colors=getColors(type,scope);__cov_sIM21KhAGhzWP0B7wdkh_A.s['158']++;return Array.isArray(scope.chartData[0])?(__cov_sIM21KhAGhzWP0B7wdkh_A.b['53'][0]++,getDataSets(scope.chartLabels,scope.chartData,(__cov_sIM21KhAGhzWP0B7wdkh_A.b['54'][0]++,scope.chartSeries)||(__cov_sIM21KhAGhzWP0B7wdkh_A.b['54'][1]++,[]),colors,scope.chartDatasetOverride)):(__cov_sIM21KhAGhzWP0B7wdkh_A.b['53'][1]++,getData(scope.chartLabels,scope.chartData,colors,scope.chartDatasetOverride));}function getDataSets(labels,data,series,colors,datasetOverride){__cov_sIM21KhAGhzWP0B7wdkh_A.f['41']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['160']++;return{labels:labels,datasets:data.map(function(item,i){__cov_sIM21KhAGhzWP0B7wdkh_A.f['42']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['161']++;var dataset=angular.extend({},colors[i],{label:series[i],data:item});__cov_sIM21KhAGhzWP0B7wdkh_A.s['162']++;if((__cov_sIM21KhAGhzWP0B7wdkh_A.b['56'][0]++,datasetOverride)&&(__cov_sIM21KhAGhzWP0B7wdkh_A.b['56'][1]++,datasetOverride.length>=i)){__cov_sIM21KhAGhzWP0B7wdkh_A.b['55'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['163']++;angular.merge(dataset,datasetOverride[i]);}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['55'][1]++;}__cov_sIM21KhAGhzWP0B7wdkh_A.s['164']++;return dataset;})};}function getData(labels,data,colors,datasetOverride){__cov_sIM21KhAGhzWP0B7wdkh_A.f['43']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['166']++;var dataset={labels:labels,datasets:[{data:data,backgroundColor:colors.map(function(color){__cov_sIM21KhAGhzWP0B7wdkh_A.f['44']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['167']++;return color.pointBackgroundColor;}),hoverBackgroundColor:colors.map(function(color){__cov_sIM21KhAGhzWP0B7wdkh_A.f['45']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['168']++;return color.backgroundColor;})}]};__cov_sIM21KhAGhzWP0B7wdkh_A.s['169']++;if(datasetOverride){__cov_sIM21KhAGhzWP0B7wdkh_A.b['57'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['170']++;angular.merge(dataset.datasets[0],datasetOverride);}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['57'][1]++;}__cov_sIM21KhAGhzWP0B7wdkh_A.s['171']++;return dataset;}function getChartOptions(type,scope){__cov_sIM21KhAGhzWP0B7wdkh_A.f['46']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['173']++;return angular.extend({},ChartJs.getOptions(type),scope.chartOptions);}function bindEvents(cvs,scope){__cov_sIM21KhAGhzWP0B7wdkh_A.f['47']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['175']++;cvs.onclick=scope.chartClick?(__cov_sIM21KhAGhzWP0B7wdkh_A.b['58'][0]++,getEventHandler(scope,'chartClick',false)):(__cov_sIM21KhAGhzWP0B7wdkh_A.b['58'][1]++,angular.noop);__cov_sIM21KhAGhzWP0B7wdkh_A.s['176']++;cvs.onmousemove=scope.chartHover?(__cov_sIM21KhAGhzWP0B7wdkh_A.b['59'][0]++,getEventHandler(scope,'chartHover',true)):(__cov_sIM21KhAGhzWP0B7wdkh_A.b['59'][1]++,angular.noop);}function updateChart(values,scope){__cov_sIM21KhAGhzWP0B7wdkh_A.f['48']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['178']++;if(Array.isArray(scope.chartData[0])){__cov_sIM21KhAGhzWP0B7wdkh_A.b['60'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['179']++;scope.chart.data.datasets.forEach(function(dataset,i){__cov_sIM21KhAGhzWP0B7wdkh_A.f['49']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['180']++;dataset.data=values[i];});}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['60'][1]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['181']++;scope.chart.data.datasets[0].data=values;}__cov_sIM21KhAGhzWP0B7wdkh_A.s['182']++;scope.chart.update();__cov_sIM21KhAGhzWP0B7wdkh_A.s['183']++;scope.$emit('chart-update',scope.chart);}function isEmpty(value){__cov_sIM21KhAGhzWP0B7wdkh_A.f['50']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['185']++;return(__cov_sIM21KhAGhzWP0B7wdkh_A.b['61'][0]++,!value)||(__cov_sIM21KhAGhzWP0B7wdkh_A.b['61'][1]++,Array.isArray(value))&&(__cov_sIM21KhAGhzWP0B7wdkh_A.b['61'][2]++,!value.length)||(__cov_sIM21KhAGhzWP0B7wdkh_A.b['61'][3]++,typeof value==='object')&&(__cov_sIM21KhAGhzWP0B7wdkh_A.b['61'][4]++,!Object.keys(value).length);}function canDisplay(type,scope,elem,options){__cov_sIM21KhAGhzWP0B7wdkh_A.f['51']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['187']++;if((__cov_sIM21KhAGhzWP0B7wdkh_A.b['63'][0]++,options.responsive)&&(__cov_sIM21KhAGhzWP0B7wdkh_A.b['63'][1]++,elem[0].clientHeight===0)){__cov_sIM21KhAGhzWP0B7wdkh_A.b['62'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['188']++;$timeout(function(){__cov_sIM21KhAGhzWP0B7wdkh_A.f['52']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['189']++;createChart(type,scope,elem);},50,false);__cov_sIM21KhAGhzWP0B7wdkh_A.s['190']++;return false;}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['62'][1]++;}__cov_sIM21KhAGhzWP0B7wdkh_A.s['191']++;return true;}function destroyChart(scope){__cov_sIM21KhAGhzWP0B7wdkh_A.f['53']++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['193']++;if(!scope.chart){__cov_sIM21KhAGhzWP0B7wdkh_A.b['64'][0]++;__cov_sIM21KhAGhzWP0B7wdkh_A.s['194']++;return;}else{__cov_sIM21KhAGhzWP0B7wdkh_A.b['64'][1]++;}__cov_sIM21KhAGhzWP0B7wdkh_A.s['195']++;scope.chart.destroy();__cov_sIM21KhAGhzWP0B7wdkh_A.s['196']++;scope.$emit('chart-destroy',scope.chart);}}})); diff --git a/static/node_modules/angular-chart.js/test/fixtures/custom-directive.html b/static/node_modules/angular-chart.js/test/fixtures/custom-directive.html deleted file mode 100644 index 93cf90b1..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/custom-directive.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - Pie update colors - - - -
-
- -
-
-
-
Pie Chart
-
- -
-
-
-
-
-
- - - - - - - diff --git a/static/node_modules/angular-chart.js/test/fixtures/custom-directive.js b/static/node_modules/angular-chart.js/test/fixtures/custom-directive.js deleted file mode 100644 index 53bcc499..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/custom-directive.js +++ /dev/null @@ -1,20 +0,0 @@ -(function () { - 'use strict'; - - var app = angular.module('pie', ['chart.js']); - Chart.defaults.global.legend = { - display: false - }; - - app.directive('mySpecialPie', function (ChartJsFactory) { return new ChartJsFactory('pie'); }); - - app.controller('PieCtrl', ['$scope', '$timeout', function ($scope, $timeout) { - $scope.labels = ['Series A', 'Series B']; - $scope.data = [5, 59]; - - $timeout(function () { - $scope.data = [5, 65]; - }, 0); - }]); - -})(); diff --git a/static/node_modules/angular-chart.js/test/fixtures/custom-directive.png b/static/node_modules/angular-chart.js/test/fixtures/custom-directive.png deleted file mode 100644 index bd7a3ae6..00000000 Binary files a/static/node_modules/angular-chart.js/test/fixtures/custom-directive.png and /dev/null differ diff --git a/static/node_modules/angular-chart.js/test/fixtures/dataset-override.html b/static/node_modules/angular-chart.js/test/fixtures/dataset-override.html deleted file mode 100644 index 78140159..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/dataset-override.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - Charts with datasets overrides - - - -
-
- -
-
-
-
Mixed chart
-
- -
-
-
-
-
-
Doughnut dataset override
-
- -
-
-
-
-
- - - - - - - diff --git a/static/node_modules/angular-chart.js/test/fixtures/dataset-override.js b/static/node_modules/angular-chart.js/test/fixtures/dataset-override.js deleted file mode 100644 index e7cf76da..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/dataset-override.js +++ /dev/null @@ -1,32 +0,0 @@ -angular.module('app', ['chart.js']).controller('OverrideCtrl', ['$scope', function ($scope) { - 'use strict'; - - $scope.colors = ['#45b7cd', '#ff6384', '#ff8e72']; - - $scope.labels1 = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; - $scope.data1 = [ - [65, -59, 80, 81, -56, 55, -40], - [28, 48, -40, 19, 86, 27, 90] - ]; - $scope.datasetOverride1 = [ - { - label: 'Override Series A', - borderWidth: 1, - type: 'bar' - }, - { - label: 'Override Series B', - borderWidth: 3, - hoverBackgroundColor: 'rgba(255,99,132,0.4)', - hoverBorderColor: 'rgba(255,99,132,1)', - type: 'line' - } - ]; - - $scope.labels2 = ['Download Sales', 'In-Store Sales', 'Mail-Order Sales']; - $scope.data2 = [350, 450, 100]; - $scope.datasetOverride2 = { - hoverBackgroundColor: ['#45b7cd', '#ff6384', '#ff8e72'], - hoverBorderColor: ['#45b7cd', '#ff6384', '#ff8e72'] - }; -}]); diff --git a/static/node_modules/angular-chart.js/test/fixtures/dataset-override.png b/static/node_modules/angular-chart.js/test/fixtures/dataset-override.png deleted file mode 100644 index 394f81fd..00000000 Binary files a/static/node_modules/angular-chart.js/test/fixtures/dataset-override.png and /dev/null differ diff --git a/static/node_modules/angular-chart.js/test/fixtures/horizontal-bar-chart.html b/static/node_modules/angular-chart.js/test/fixtures/horizontal-bar-chart.html deleted file mode 100644 index a4b1efbb..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/horizontal-bar-chart.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - Horizontal Bar Chart - - - -
-
- -
-
-
-
Horizontal Bar Chart
-
- -
-
-
-
-
-
- - - - - - - diff --git a/static/node_modules/angular-chart.js/test/fixtures/horizontal-bar-chart.js b/static/node_modules/angular-chart.js/test/fixtures/horizontal-bar-chart.js deleted file mode 100644 index 6c6f968c..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/horizontal-bar-chart.js +++ /dev/null @@ -1,18 +0,0 @@ -(function () { - 'use strict'; - - var app = angular.module('horizontal', ['chart.js']); - Chart.defaults.global.legend = { - display: false - }; - - app.controller('HorizontalBarCtrl', function ($scope) { - $scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; - $scope.active = true; - $scope.data = [ - [65, 59, 90, 81, 56, 55, 40], - [28, 48, 40, 19, 96, 27, 100] - ]; - }); - -})(); diff --git a/static/node_modules/angular-chart.js/test/fixtures/horizontal-bar-chart.png b/static/node_modules/angular-chart.js/test/fixtures/horizontal-bar-chart.png deleted file mode 100644 index b926632c..00000000 Binary files a/static/node_modules/angular-chart.js/test/fixtures/horizontal-bar-chart.png and /dev/null differ diff --git a/static/node_modules/angular-chart.js/test/fixtures/options-override.html b/static/node_modules/angular-chart.js/test/fixtures/options-override.html deleted file mode 100644 index 7235937c..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/options-override.html +++ /dev/null @@ -1,77 +0,0 @@ - - - - - Charts - - - -
-
- -
-
-
-
Line Chart
-
- -
-
-
-
-
-
Bar Chart
-
- -
-
-
-
-
-
Doughnut Chart
-
- -
-
-
-
-
-
-
-
Radar Chart
-
- -
-
-
-
-
-
Pie Chart
-
- -
-
-
-
-
-
Polar Area Chart
-
- -
-
-
-
-
-
-
-
- - - - - - - diff --git a/static/node_modules/angular-chart.js/test/fixtures/options-override.js b/static/node_modules/angular-chart.js/test/fixtures/options-override.js deleted file mode 100644 index b8dec7d7..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/options-override.js +++ /dev/null @@ -1,73 +0,0 @@ -(function () { - 'use strict'; - - var app = angular.module('charts', ['chart.js']); - - app.config(function (ChartJsProvider) { - ChartJsProvider.setOptions('global', { - legend: { - display: true - } - }); - }); - - app.controller('LineCtrl', ['$scope', '$timeout', function ($scope, $timeout) { - $scope.labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July']; - $scope.series = ['Series A', 'Series B']; - $scope.data = [ - [65, 59, 80, 81, 56, 55, 40], - [28, 48, 40, 19, 86, 27, 90] - ]; - $timeout(function () { - $scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; - $scope.data = [ - [28, 48, 40, 19, 86, 27, 90], - [65, 59, 80, 81, 56, 55, 40] - ]; - $scope.series = ['Series C', 'Series D']; - }, 0); - }]); - - app.controller('BarCtrl', ['$scope', '$timeout', function ($scope, $timeout) { - $scope.options = { scaleShowVerticalLines: false }; - $scope.labels = ['2006', '2007', '2008', '2009', '2010', '2011', '2012']; - $scope.series = ['Series A', 'Series B']; - $scope.data = [ - [65, 59, 80, 81, 56, 55, 40], - [28, 48, 40, 19, 86, 27, 90] - ]; - $timeout(function () { - $scope.options = { scaleShowVerticalLines: true }; - }, 0); - }]); - - app.controller('DoughnutCtrl', ['$scope', '$timeout', function ($scope, $timeout) { - $scope.labels = ['Download Sales', 'In-Store Sales', 'Mail-Order Sales']; - $scope.data = [0, 0, 0]; - // TODO: investigate why chart was not showing up without this hack - $timeout(function () { - $scope.data = [350, 450, 100]; - }, 0); - }]); - - app.controller('PieCtrl', ['$scope', '$timeout', function ($scope, $timeout) { - $scope.labels = ['Download Sales', 'In-Store Sales', 'Mail Sales']; - $scope.data = [0, 0, 0]; - $timeout(function () { - $scope.data = [350, 450, 100]; - }, 0); - }]); - - app.controller('PolarAreaCtrl', function ($scope) { - $scope.labels = ['Download Sales', 'In-Store Sales', 'Mail Sales', 'Telesales', 'Corporate Sales']; - $scope.data = [300, 500, 100, 40, 120]; - }); - - app.controller('RadarCtrl', function ($scope) { - $scope.labels = ['Eating', 'Drinking', 'Sleeping', 'Designing', 'Coding', 'Cycling', 'Running']; - $scope.data = [ - [65, 59, 90, 81, 56, 55, 40], - [28, 48, 40, 19, 96, 27, 100] - ]; - }); -})(); diff --git a/static/node_modules/angular-chart.js/test/fixtures/options-override.png b/static/node_modules/angular-chart.js/test/fixtures/options-override.png deleted file mode 100644 index cc7f8679..00000000 Binary files a/static/node_modules/angular-chart.js/test/fixtures/options-override.png and /dev/null differ diff --git a/static/node_modules/angular-chart.js/test/fixtures/scatter.html b/static/node_modules/angular-chart.js/test/fixtures/scatter.html deleted file mode 100644 index e7f46a7c..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/scatter.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - - Bubble chart - - - -
-
-
-
-
-
Scatter chart
-
- -
-
-
-
-
- - - - - - - diff --git a/static/node_modules/angular-chart.js/test/fixtures/scatter.js b/static/node_modules/angular-chart.js/test/fixtures/scatter.js deleted file mode 100644 index 5d60f6b2..00000000 --- a/static/node_modules/angular-chart.js/test/fixtures/scatter.js +++ /dev/null @@ -1,30 +0,0 @@ -(function () { - 'use strict'; - - var app = angular.module('app', ['chart.js']); - - app.controller('ScatterCtrl', ['$scope', function ($scope) { - $scope.data = [[{ - x: -10, - y: -5 - }, { - x: 0, - y: 10 - }, { - x: 10, - y: 5 - }]]; - - $scope.options = { - scales: { - xAxes: [{ - type: 'linear', - position: 'bottom' - }] - } - }; - - }]); - - -})(); diff --git a/static/node_modules/angular-chart.js/test/fixtures/scatter.png b/static/node_modules/angular-chart.js/test/fixtures/scatter.png deleted file mode 100644 index c8069be9..00000000 Binary files a/static/node_modules/angular-chart.js/test/fixtures/scatter.png and /dev/null differ diff --git a/static/node_modules/angular-chart.js/test/index.html b/static/node_modules/angular-chart.js/test/index.html deleted file mode 100644 index fa155409..00000000 --- a/static/node_modules/angular-chart.js/test/index.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - Mocha Tests - - - -
- - - - - - - - - - - - - - - diff --git a/static/node_modules/angular-chart.js/test/mocha.opts b/static/node_modules/angular-chart.js/test/mocha.opts deleted file mode 100644 index 0cfde2d1..00000000 --- a/static/node_modules/angular-chart.js/test/mocha.opts +++ /dev/null @@ -1,4 +0,0 @@ ---slow 20 ---growl ---reporter spec ---require test/support/setup diff --git a/static/node_modules/angular-chart.js/test/support/setup.js b/static/node_modules/angular-chart.js/test/support/setup.js deleted file mode 100644 index de984149..00000000 --- a/static/node_modules/angular-chart.js/test/support/setup.js +++ /dev/null @@ -1,11 +0,0 @@ -/*jshint node:true*/ -(function () { - 'use strict'; - - var chai = require('chai'); - global.chai = chai; - global.should = chai.should(); - global.expect = chai.expect; - global.assert = chai.assert; - -})(); diff --git a/static/node_modules/angular-chart.js/test/test.integration.js b/static/node_modules/angular-chart.js/test/test.integration.js deleted file mode 100644 index 734eb5d4..00000000 --- a/static/node_modules/angular-chart.js/test/test.integration.js +++ /dev/null @@ -1,76 +0,0 @@ -/*jshint node:true*/ -/*jshint mocha:true*/ -/*global assert:true*/ -describe('integration', function () { - 'use strict'; - - var port = 8045; /* teststatic default port 8080 may be occupied on many systems */ - var webshot = require('webshot'), - path = require('path'), - gm = require('gm'), - tmp = require('tmp-sync'), - mkdirp = require('mkdirp').sync, - cp = require('cp').sync, - imgur = require('imgur-node-api'), - server = require('testatic')('./', port), - WEBSHOT_OPTIONS = { renderDelay: process.env.DELAY || 2500, windowSize: { width: 1366, height: 768 }}, - WEBSHOT_FAILED_DIR = path.join('test', 'fixtures', 'shots') + path.sep, - dir; - - beforeEach(function () { - dir = tmp.in() + path.sep; - }); - - afterEach(function () { - tmp.clean(); - }); - - after(function () { - server.close(); - }); - - mkdirp(WEBSHOT_FAILED_DIR); - - [ - 'bubble', - 'scatter', - 'dataset-override', - 'horizontal-bar-chart', - '29-tabs', - '57-hex-colours', - '54-not-enough-colours', - '51-pie-update-colours', - 'configure-line-chart', - 'custom-directive', - 'charts' - ].forEach(function (name) { - it('compares screenshots for: ' + name, function (done) { - var image = dir + name + '.png', - url = 'http://localhost:' + port + '/test/fixtures/' + name + '.html', - expected = path.join('test', 'fixtures', name + '.png'); - - webshot(url, image, WEBSHOT_OPTIONS, function (err) { - if (err) return done(err); - gm.compare(expected, image, process.env.TOLERANCE || 0.00001, function (err, isEqual) { - if (err) return done(err); - if (! isEqual) { - var failed = WEBSHOT_FAILED_DIR + name + '-failed.png', - msg = 'Expected screenshots to be similar. Screenshot saved to ' + failed; - cp(image, failed); - if (process.env.CI && process.env.IMGUR_ID) { - imgur.setClientID(process.env.IMGUR_ID); - imgur.upload(image, function (err, res) { - if (err) return done(err); - assert.fail(isEqual, true, msg + ', uploaded to ' + res.data.link); - }); - } else { - assert.fail(isEqual, true, msg); - } - return; - } - done(); - }); - }); - }); - }); -}); diff --git a/static/node_modules/angular-chart.js/test/test.unit.js b/static/node_modules/angular-chart.js/test/test.unit.js deleted file mode 100644 index 9a621e59..00000000 --- a/static/node_modules/angular-chart.js/test/test.unit.js +++ /dev/null @@ -1,440 +0,0 @@ -/*jshint mocha:true*/ -/*global module:true*/ -/*global inject:true*/ -/*global expect:true*/ -/*global sinon:true*/ - -describe('Unit testing', function () { - 'use strict'; - - var $compile, scope, sandbox, ChartJs, ChartJsProvider; - - beforeEach(module('chart.js', function (_ChartJsProvider_) { - ChartJsProvider = _ChartJsProvider_; - ChartJsProvider.setOptions({ env: 'test', responsive: false }); - })); - - beforeEach(inject(function (_$compile_, _$rootScope_, _ChartJs_) { - // The injector unwraps the underscores (_) from around the parameter names when matching - $compile = _$compile_; - scope = _$rootScope_; - ChartJs = _ChartJs_; - sandbox = sinon.sandbox.create(); - })); - - afterEach(function () { - sandbox.restore(); - }); - - describe('base', function () { - describe('chart types', function () { - ['line', 'bar', 'horizontalBar', 'radar', 'pie', 'doughnut', 'polarArea', 'bubble'].forEach(function (type) { - it('creates a ' + type + ' chart using the directive', function () { - var markup = ''; - - if (['line', 'bar', 'horizontalBar', 'radar'].indexOf(type) > - 1) { - scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; - scope.data = [ - [65, 59, 80, 81, 56, 55, 40], - [28, 48, 40, 19, 86, 27, 90] - ]; - } else { - scope.labels = ['Downloads', 'In store', 'Mail orders']; - scope.data = [300, 500, 100]; - } - - var spyChart = sandbox.spy(ChartJs, 'Chart'); - - scope.$on('chart-create', function (evt, chart) { - expect(chart).to.be.an.instanceOf(Chart.Controller); - }); - - $compile(markup)(scope); - scope.$digest(); - - expect(spyChart).to.have.been.calledWithNew; - expect(spyChart).to.have.been.calledWithExactly( - sinon.match.any, - sinon.match({ type: type, data: sinon.match.object, options: sinon.match.object }) - ); - }); - - it('creates a ' + type + ' chart using the "chart-type" attribute', function () { - var markup = '
' + - '
'; - - scope.type = type; - - if (['line', 'bar', 'horizontalBar', 'radar'].indexOf(type) > - 1) { - scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; - scope.data = [ - [65, 59, 80, 81, 56, 55, 40], - [28, 48, 40, 19, 86, 27, 90] - ]; - } else { - scope.labels = ['Downloads', 'In store', 'Mail orders']; - scope.data = [300, 500, 100]; - } - - var spyChart = sandbox.spy(ChartJs, 'Chart'); - - scope.$on('chart-create', function (evt, chart) { - expect(chart).to.be.an.instanceOf(Chart.Controller); - }); - - $compile(markup)(scope); - scope.$digest(); - - expect(spyChart).to.have.been.calledWithNew; - expect(spyChart).to.have.been.calledWithExactly( - sinon.match.any, - sinon.match({ type: type, data: sinon.match.object, options: sinon.match.object }) - ); - }); - }); - }); - - describe('colors', function(){ - it('sets the chart colors when Hex colors, RGB colors, RGBA colors, or objects are used', function (){ - var datasets; - var markup = ''; - scope.colors = [ - { - backgroundColor: 'rgba(159,204,0,0.2)', - pointBackgroundColor: 'rgba(159,204,0,1)', - pointHoverBackgroundColor: 'rgba(159,204,0,0.8)', - borderColor: 'rgba(159,204,0,1)', - pointBorderColor: '#fff', - pointHoverBorderColor: 'rgba(159,204,0,1)' - },'rgba(250,109,33,0.5)','#9a9a9a','rgb(233,177,69)' - ]; - scope.labels = ['Green', 'Peach', 'Grey', 'Orange']; - scope.data = [300, 500, 100, 150]; - scope.$on('chart-create', function (evt, chart) { - datasets = chart.chart.config.data.datasets; - }); - $compile(markup)(scope); - scope.$digest(); - expect(datasets[0].backgroundColor[0]).to.equal('rgba(159,204,0,1)'); - expect(datasets[0].backgroundColor[1]).to.equal('rgba(250,109,33,0.5)'); - expect(datasets[0].backgroundColor[2]).to.equal('rgba(154,154,154,1)'); - expect(datasets[0].backgroundColor[3]).to.equal('rgba(233,177,69,1)'); - }); - }); - - describe('dataset override', function () { - it('overrides the datasets for complex charts', function () { - var datasets; - var markup = ''; - - scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; - scope.data = [ - [65, -59, 80, 81, -56, 55, -40], - [28, 48, -40, 19, 86, 27, 90] - ]; - scope.datasetOverride = [ - { - label: 'Bar chart', - borderWidth: 1, - type: 'bar' - }, - { - label: 'Line chart', - borderWidth: 3, - type: 'line' - } - ]; - - scope.$on('chart-create', function (evt, chart) { - datasets = chart.chart.config.data.datasets; - }); - - $compile(markup)(scope); - scope.$digest(); - - expect(datasets[0].label).to.equal('Bar chart'); - expect(datasets[1].label).to.equal('Line chart'); - expect(datasets[0].borderWidth).to.equal(1); - expect(datasets[1].borderWidth).to.equal(3); - expect(datasets[0].type).to.equal('bar'); - expect(datasets[1].type).to.equal('line'); - }); - - it('overrides the dataset for simple charts', function () { - var datasets; - var markup = ''; - - scope.colors = ['#45b7cd', '#ff6384', '#ff8e72']; - scope.labels = ['Download Sales', 'In-Store Sales', 'Mail-Order Sales']; - scope.data = [350, 450, 100]; - scope.datasetOverride = { - hoverBackgroundColor: ['#45b7cd', '#ff6384', '#ff8e72'], - hoverBorderColor: ['#45b7cd', '#ff6384', '#ff8e72'] - }; - - scope.$on('chart-create', function (evt, chart) { - datasets = chart.chart.config.data.datasets; - }); - - $compile(markup)(scope); - scope.$digest(); - - expect(datasets[0].hoverBackgroundColor).to.deep.equal(['#45b7cd', '#ff6384', '#ff8e72']); - expect(datasets[0].hoverBorderColor).to.deep.equal(['#45b7cd', '#ff6384', '#ff8e72']); - }); - }); - }); - - describe('lifecycle', function () { - it('watches the attributes of the chart', function () { - var markup = '
' + - '
'; - - scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; - scope.data = [ - [65, 59, 80, 81, 56, 55, 40], - [28, 48, 40, 19, 86, 27, 90] - ]; - - var spy = sandbox.spy(scope, '$watch'); - $compile(markup)(scope); - - // cannot get a hold of the child scope as it isn't created yet - // so cannot be more precise on expectations - expect(spy.calledThrice).to.be.true; - }); - - it('creates the chart only once', function () { - var markup = '
' + - '
'; - var count = 0; - - scope.labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July']; - scope.series = ['Series A', 'Series B']; - scope.data = [ - [65, 59, 80, 81, 56, 55, 40], - [28, 48, 40, 19, 86, 27, 90] - ]; - scope.$on('chart-create', function () { - count++; - }); - - $compile(markup)(scope); - scope.$digest(); - - expect(count).to.equal(1); - }); - - it('updates the chart', function () { - var markup = '
' + - '
'; - var count = 0; - - scope.labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July']; - scope.series = ['Series A', 'Series B']; - scope.data = [ - [65, 59, 80, 81, 56, 55, 40], - [28, 48, 40, 19, 86, 27, 90] - ]; - - scope.$on('chart-update', function () { - count++; - }); - - $compile(markup)(scope); - scope.$digest(); - - scope.data = [ - [28, 48, 40, 19, 86, 27, 90], - [65, 59, 80, 81, 56, 55, 40] - ]; - scope.$digest(); - - expect(count).to.equal(1); - }); - - it('destroy the chart if all data is removed', function () { - var markup = '
' + - '
'; - var countCreate = 0, countUpdate = 0, countDestroy = 0; - - scope.labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July']; - scope.data = [ - [65, 59, 80, 81, 56, 55, 40], - [28, 48, 40, 19, 86, 27, 90] - ]; - - scope.$on('chart-create', function () { - countCreate++; - }); - - scope.$on('chart-update', function () { - countUpdate++; - }); - - scope.$on('chart-destroy', function() { - countDestroy++; - }); - - $compile(markup)(scope); - scope.$digest(); - - scope.data = []; - scope.$digest(); - - expect(countCreate).to.equal(1); - expect(countUpdate).to.equal(0); - expect(countDestroy).to.equal(1); - }); - - it('re-create the chart if data added or removed', function () { - var markup = '
' + - '
'; - var countCreate = 0, countUpdate = 0, countDestroy = 0; - - scope.labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July']; - scope.data = [ - [65, 59, 80, 81, 56, 55, 40], - [28, 48, 40, 19, 86, 27, 90] - ]; - - scope.$on('chart-create', function () { - countCreate++; - }); - - scope.$on('chart-update', function () { - countUpdate++; - }); - - scope.$on('chart-destroy', function() { - countDestroy++; - }); - - $compile(markup)(scope); - scope.$digest(); - - scope.data = [ - [28, 48, 40, 19, 86, 27, 90], - [65, 59, 80, 81, 56, 55, 40], - [65, 59, 80, 81, 56, 55, 40] - ]; - scope.$digest(); - - expect(countCreate).to.equal(2); - expect(countUpdate).to.equal(0); - expect(countDestroy).to.equal(1); - }); - - it('should allow to set a configuration', function () { - ChartJsProvider.setOptions({responsive: false}); - expect(ChartJs.getOptions().responsive).to.equal(false); - expect(ChartJs.getOptions('Line').responsive).to.equal(false); - expect(ChartJsProvider.$get().Chart.defaults.responsive).to.equal(false); - ChartJsProvider.setOptions({responsive: true}); - expect(ChartJs.getOptions().responsive).to.equal(true); - expect(ChartJs.getOptions('Line').responsive).to.equal(true); - expect(ChartJsProvider.$get().Chart.defaults.responsive).to.equal(true); - }); - - it('should allow to set a configuration for a chart type', function () { - ChartJsProvider.setOptions('Line', {responsive: false}); - expect(ChartJs.getOptions('Line').responsive).to.equal(false); - ChartJsProvider.setOptions('Line', {responsive: true}); - expect(ChartJs.getOptions('Line').responsive).to.equal(true); - ChartJsProvider.setOptions('Line', {responsive: true}); - expect(ChartJsProvider.$get().Chart.defaults.Line.responsive).to.equal(true); - }); - - ['labels', 'colors', 'series', 'options'].forEach(function (attr) { - it('re-creates the chart on ' + attr + ' changes', function () { - var markup = '
' + - '
'; - var count = 0; - - scope.options = { scaleShowVerticalLines: false }; - scope.labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July']; - scope.series = ['Series A', 'Series B']; - scope.colors = ['#45b7cd', '#ff6384']; - scope.data = [ - [65, 59, 80, 81, 56, 55, 40], - [28, 48, 40, 19, 86, 27, 90] - ]; - scope.$on('chart-create', function () { - count++; - }); - - $compile(markup)(scope); - scope.$digest(); - - switch (attr) { - case 'labels': - scope.labels = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']; - break; - case 'colors': - scope.colors = ['#ff6384', '#ff8e72']; - break; - case 'series': - scope.series = ['Series C', 'Series D']; - break; - case 'options': - scope.options = { scaleShowVerticalLines: true }; - break; - } - scope.$digest(); - - expect(count).to.equal(2); - }); - }); - - ['labels', 'colors', 'series', 'options'].forEach(function (attr) { - it('does not re-create the chart on ' + attr + ' not changed', function () { - var markup = '
' + - '
'; - var count = 0; - - scope.options = { scaleShowVerticalLines: false }; - scope.labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July']; - scope.series = ['Series A', 'Series B']; - scope.colors = ['#45b7cd', '#ff6384']; - scope.data = [ - [65, 59, 80, 81, 56, 55, 40], - [28, 48, 40, 19, 86, 27, 90] - ]; - scope.$on('chart-create', function () { - count++; - }); - - $compile(markup)(scope); - scope.$digest(); - - switch (attr) { - case 'labels': - scope.labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July']; - break; - case 'colors': - scope.colors = ['#45b7cd', '#ff6384']; - break; - case 'series': - scope.series = ['Series A', 'Series B']; - break; - case 'options': - scope.options = { scaleShowVerticalLines: false }; - break; - } - scope.$digest(); - - expect(count).to.equal(1); - }); - }); - }); -}); diff --git a/static/node_modules/angular-chart.js/tmp/Dockerfile-alpine b/static/node_modules/angular-chart.js/tmp/Dockerfile-alpine deleted file mode 100644 index d40b7720..00000000 --- a/static/node_modules/angular-chart.js/tmp/Dockerfile-alpine +++ /dev/null @@ -1,15 +0,0 @@ -#FROM rafakato/alpine-graphicsmagick -RUN apk add --update --no-cache \ - build-base \ - python \ - git \ - nodejs \ - curl \ - ca-certificates -WORKDIR /src -ADD . ./ -RUN adduser -S node -RUN chown -R node /src -USER node -RUN npm install && npm install bower && ./node_modules/bower/bin/bower install -CMD ["npm", "test"] diff --git a/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/CONTRIBUTING.md b/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/CONTRIBUTING.md deleted file mode 100644 index b8b96cbe..00000000 --- a/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/CONTRIBUTING.md +++ /dev/null @@ -1,64 +0,0 @@ -Contributing to Chart.js -======================== - -Contributions to Chart.js are welcome and encouraged, but please have a look through the guidelines in this document before raising an issue, or writing code for the project. - - -Using issues ------------- - -The [issue tracker](https://github.com/chartjs/Chart.js/issues) is the preferred channel for reporting bugs, requesting new features and submitting pull requests. - -If you're suggesting a new chart type, please take a look at [writing new chart types](https://github.com/chartjs/Chart.js/blob/master/docs/09-Advanced.md#writing-new-chart-types) in the documentation or consider [creating a plugin](https://github.com/chartjs/Chart.js/blob/master/docs/09-Advanced.md#creating-plugins). - -To keep the library lightweight for everyone, it's unlikely we'll add many more chart types to the core of Chart.js, but issues are a good medium to design and spec out how new chart types could work and look. - -Please do not use issues for support requests. For help using Chart.js, please take a look at the [`chartjs`](http://stackoverflow.com/questions/tagged/chartjs) tag on Stack Overflow. - - -Reporting bugs --------------- - -Well structured, detailed bug reports are hugely valuable for the project. - -Guidlines for reporting bugs: - - - Check the issue search to see if it has already been reported - - Isolate the problem to a simple test case - - Please include a demonstration of the bug on a website such as [JS Bin](http://jsbin.com/), [JS Fiddle](http://jsfiddle.net/), or [Codepen](http://codepen.io/pen/). ([Template](http://codepen.io/pen?template=JXVYzq)) - -Please provide any additional details associated with the bug, if it's browser or screen density specific, or only happens with a certain configuration or data. - - -Local development ------------------ - -Run `npm install` to install all the libraries, then run `gulp dev --test` to build and run tests as you make changes. - - -Pull requests -------------- - -Clear, concise pull requests are excellent at continuing the project's community driven growth. But please review [these guidelines](https://github.com/blog/1943-how-to-write-the-perfect-pull-request) and the guidelines below before starting work on the project. - -Be advised that **Chart.js 1.0.2 is in feature-complete status**. Pull requests adding new features to the 1.x branch will be disregarded. - -Guidelines: - - - Please create an issue first and/or talk with a team member: - - For bugs, we can discuss the fixing approach - - For enhancements, we can discuss if it is within the project scope and avoid duplicate effort - - Please make changes to the files in [`/src`](https://github.com/chartjs/Chart.js/tree/master/src), not `Chart.js` or `Chart.min.js` in the repo root directory, this avoids merge conflicts - - Tabs for indentation, not spaces please - - If adding new functionality, please also update the relevant `.md` file in [`/docs`](https://github.com/chartjs/Chart.js/tree/master/docs) - - Please make your commits in logical sections with clear commit messages - -Joining the project -------------- - - Active committers and contributors are invited to introduce yourself and request commit access to this project. Please send an email to hello@nickdownie.com or file an issue. - - We have a very active Slack community that you can join [here](https://chart-js-automation.herokuapp.com/). If you think you can help, we'd love to have you! - -License -------- - -By contributing your code, you agree to license your contribution under the [MIT license](https://github.com/chartjs/Chart.js/blob/master/LICENSE.md). diff --git a/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/LICENSE.md b/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/LICENSE.md deleted file mode 100644 index dc93bcc3..00000000 --- a/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/LICENSE.md +++ /dev/null @@ -1,8 +0,0 @@ -The MIT License (MIT) -Copyright (c) 2013-2016 Nick Downie - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/MAINTAINING.md b/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/MAINTAINING.md deleted file mode 100644 index 5e34f433..00000000 --- a/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/MAINTAINING.md +++ /dev/null @@ -1,36 +0,0 @@ -# Maintaining -## Release Process -Chart.js relies on [Travis CI](https://travis-ci.org/) to automate the library [releases](https://github.com/chartjs/Chart.js/releases). - -### Releasing a New Version - -1. draft release notes on [GitHub](https://github.com/chartjs/Chart.js/releases/new) for the upcoming tag -1. update `master` `package.json` version using [semver](http://semver.org/) semantic -1. merge `master` into the `release` branch -1. follow the build process on [Travis CI](https://travis-ci.org/chartjs/Chart.js) - -> **Note:** if `master` is merged in `release` with a `package.json` version that already exists, the tag -creation fails and the release process is aborted. - -### Automated Tasks -Merging into the `release` branch kicks off the automated release process: - -* build of the `dist/*.js` files -* `bower.json` is generated from `package.json` -* `dist/*.js` and `bower.json` are added to a detached branch -* a tag is created from the `package.json` version -* tag (with dist files) is pushed to GitHub - -Creation of this tag triggers a new build: - -* `Chart.js.zip` package is generated, containing dist files and examples -* `dist/*.js` and `Chart.js.zip` are attached to the GitHub release (downloads) -* a new npm package is published on [npmjs](https://www.npmjs.com/package/chart.js) - -Finally, [cdnjs](https://cdnjs.com/libraries/Chart.js) is automatically updated from the npm release. - -### Further Reading - -* [Travis GitHub releases](https://github.com/chartjs/Chart.js/pull/2555) -* [Bower support and dist/* files](https://github.com/chartjs/Chart.js/issues/3033) -* [cdnjs npm auto update](https://github.com/cdnjs/cdnjs/pull/8401) diff --git a/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/README.md b/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/README.md deleted file mode 100644 index 49d09c01..00000000 --- a/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/README.md +++ /dev/null @@ -1,45 +0,0 @@ -# Chart.js - -[![Build Status](https://travis-ci.org/chartjs/Chart.js.svg?branch=master)](https://travis-ci.org/chartjs/Chart.js) [![Code Climate](https://codeclimate.com/github/nnnick/Chart.js/badges/gpa.svg)](https://codeclimate.com/github/nnnick/Chart.js) [![Coverage Status](https://coveralls.io/repos/github/chartjs/Chart.js/badge.svg?branch=master)](https://coveralls.io/github/chartjs/Chart.js?branch=master) - -[![Chart.js on Slack](https://img.shields.io/badge/slack-Chart.js-blue.svg)](https://chart-js-automation.herokuapp.com/) - -*Simple HTML5 Charts using the canvas element* [chartjs.org](http://www.chartjs.org) - -## Installation - -You can download the latest version of [Chart.js on GitHub](https://github.com/chartjs/Chart.js/releases/latest) or just use these [Chart.js CDN](https://cdnjs.com/libraries/Chart.js) links. - -To install via npm: - -```bash -npm install chart.js --save -``` - -To Install via bower, please follow [these instructions](http://www.chartjs.org/docs/#getting-started-installation). - -## Documentation - -You can find documentation at [www.chartjs.org/docs](http://www.chartjs.org/docs). The markdown files that build the site are available under `/docs`. Previous version documentation is available at [www.chartjs.org/docs/#notes-previous-versions](http://www.chartjs.org/docs/#notes-previous-versions). - -## Contributing - -Before submitting an issue or a pull request to the project, please take a moment to look over the [contributing guidelines](https://github.com/chartjs/Chart.js/blob/master/CONTRIBUTING.md) first. - -For support using Chart.js, please post questions with the [`chartjs` tag on Stack Overflow](http://stackoverflow.com/questions/tagged/chartjs). - -## Building and Testing - -To build, run `gulp build`. - -To test, run `gulp test`. - -To test against code standards, run `gulp lint`. - -More information on building and testing can be found in [gulpfile.js](gulpfile.js). - -Thanks to [BrowserStack](https://browserstack.com) for allowing our team to test on thousands of browsers. - -## License - -Chart.js is available under the [MIT license](http://opensource.org/licenses/MIT). diff --git a/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/bower.json b/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/bower.json deleted file mode 100644 index 7d9c6414..00000000 --- a/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/bower.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "chart.js", - "description": "Simple HTML5 charts using the canvas element.", - "homepage": "http://www.chartjs.org", - "license": "MIT", - "version": "2.3.0", - "main": "./dist/Chart.js" -} \ No newline at end of file diff --git a/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/composer.json b/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/composer.json deleted file mode 100644 index 48d05b8d..00000000 --- a/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/composer.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "nnnick/chartjs", - "type": "library", - "description": "Simple HTML5 charts using the canvas element.", - "keywords": [ - "chart", - "js" - ], - "homepage": "http://www.chartjs.org/", - "license": "MIT", - "authors": [ - { - "name": "NICK DOWNIE", - "email": "hello@nickdownie.com" - } - ], - "require": { - "php": ">=5.3.3" - }, - "minimum-stability": "stable", - "extra": { - "branch-alias": { - "release/2.0": "v2.0-dev" - } - } -} diff --git a/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/config.jshintrc b/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/config.jshintrc deleted file mode 100644 index 00b42024..00000000 --- a/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/config.jshintrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "node": true, - "unused": true, - "predef": [ "require", "module" ] -} \ No newline at end of file diff --git a/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/dist/Chart.bundle.js b/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/dist/Chart.bundle.js deleted file mode 100644 index 2729d04b..00000000 --- a/static/node_modules/angular-chart.js/tmp/bower_components/chart.js/dist/Chart.bundle.js +++ /dev/null @@ -1,14868 +0,0 @@ -/*! - * Chart.js - * http://chartjs.org/ - * Version: 2.3.0 - * - * Copyright 2016 Nick Downie - * Released under the MIT license - * https://github.com/chartjs/Chart.js/blob/master/LICENSE.md - */ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Chart = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o lum2) { - return (lum1 + 0.05) / (lum2 + 0.05); - } - return (lum2 + 0.05) / (lum1 + 0.05); - }, - - level: function (color2) { - var contrastRatio = this.contrast(color2); - if (contrastRatio >= 7.1) { - return 'AAA'; - } - - return (contrastRatio >= 4.5) ? 'AA' : ''; - }, - - dark: function () { - // YIQ equation from http://24ways.org/2010/calculating-color-contrast - var rgb = this.values.rgb; - var yiq = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000; - return yiq < 128; - }, - - light: function () { - return !this.dark(); - }, - - negate: function () { - var rgb = []; - for (var i = 0; i < 3; i++) { - rgb[i] = 255 - this.values.rgb[i]; - } - this.setValues('rgb', rgb); - return this; - }, - - lighten: function (ratio) { - var hsl = this.values.hsl; - hsl[2] += hsl[2] * ratio; - this.setValues('hsl', hsl); - return this; - }, - - darken: function (ratio) { - var hsl = this.values.hsl; - hsl[2] -= hsl[2] * ratio; - this.setValues('hsl', hsl); - return this; - }, - - saturate: function (ratio) { - var hsl = this.values.hsl; - hsl[1] += hsl[1] * ratio; - this.setValues('hsl', hsl); - return this; - }, - - desaturate: function (ratio) { - var hsl = this.values.hsl; - hsl[1] -= hsl[1] * ratio; - this.setValues('hsl', hsl); - return this; - }, - - whiten: function (ratio) { - var hwb = this.values.hwb; - hwb[1] += hwb[1] * ratio; - this.setValues('hwb', hwb); - return this; - }, - - blacken: function (ratio) { - var hwb = this.values.hwb; - hwb[2] += hwb[2] * ratio; - this.setValues('hwb', hwb); - return this; - }, - - greyscale: function () { - var rgb = this.values.rgb; - // http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale - var val = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11; - this.setValues('rgb', [val, val, val]); - return this; - }, - - clearer: function (ratio) { - var alpha = this.values.alpha; - this.setValues('alpha', alpha - (alpha * ratio)); - return this; - }, - - opaquer: function (ratio) { - var alpha = this.values.alpha; - this.setValues('alpha', alpha + (alpha * ratio)); - return this; - }, - - rotate: function (degrees) { - var hsl = this.values.hsl; - var hue = (hsl[0] + degrees) % 360; - hsl[0] = hue < 0 ? 360 + hue : hue; - this.setValues('hsl', hsl); - return this; - }, - - /** - * Ported from sass implementation in C - * https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209 - */ - mix: function (mixinColor, weight) { - var color1 = this; - var color2 = mixinColor; - var p = weight === undefined ? 0.5 : weight; - - var w = 2 * p - 1; - var a = color1.alpha() - color2.alpha(); - - var w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0; - var w2 = 1 - w1; - - return this - .rgb( - w1 * color1.red() + w2 * color2.red(), - w1 * color1.green() + w2 * color2.green(), - w1 * color1.blue() + w2 * color2.blue() - ) - .alpha(color1.alpha() * p + color2.alpha() * (1 - p)); - }, - - toJSON: function () { - return this.rgb(); - }, - - clone: function () { - // NOTE(SB): using node-clone creates a dependency to Buffer when using browserify, - // making the final build way to big to embed in Chart.js. So let's do it manually, - // assuming that values to clone are 1 dimension arrays containing only numbers, - // except 'alpha' which is a number. - var result = new Color(); - var source = this.values; - var target = result.values; - var value, type; - - for (var prop in source) { - if (source.hasOwnProperty(prop)) { - value = source[prop]; - type = ({}).toString.call(value); - if (type === '[object Array]') { - target[prop] = value.slice(0); - } else if (type === '[object Number]') { - target[prop] = value; - } else { - console.error('unexpected color value:', value); - } - } - } - - return result; - } -}; - -Color.prototype.spaces = { - rgb: ['red', 'green', 'blue'], - hsl: ['hue', 'saturation', 'lightness'], - hsv: ['hue', 'saturation', 'value'], - hwb: ['hue', 'whiteness', 'blackness'], - cmyk: ['cyan', 'magenta', 'yellow', 'black'] -}; - -Color.prototype.maxes = { - rgb: [255, 255, 255], - hsl: [360, 100, 100], - hsv: [360, 100, 100], - hwb: [360, 100, 100], - cmyk: [100, 100, 100, 100] -}; - -Color.prototype.getValues = function (space) { - var values = this.values; - var vals = {}; - - for (var i = 0; i < space.length; i++) { - vals[space.charAt(i)] = values[space][i]; - } - - if (values.alpha !== 1) { - vals.a = values.alpha; - } - - // {r: 255, g: 255, b: 255, a: 0.4} - return vals; -}; - -Color.prototype.setValues = function (space, vals) { - var values = this.values; - var spaces = this.spaces; - var maxes = this.maxes; - var alpha = 1; - var i; - - if (space === 'alpha') { - alpha = vals; - } else if (vals.length) { - // [10, 10, 10] - values[space] = vals.slice(0, space.length); - alpha = vals[space.length]; - } else if (vals[space.charAt(0)] !== undefined) { - // {r: 10, g: 10, b: 10} - for (i = 0; i < space.length; i++) { - values[space][i] = vals[space.charAt(i)]; - } - - alpha = vals.a; - } else if (vals[spaces[space][0]] !== undefined) { - // {red: 10, green: 10, blue: 10} - var chans = spaces[space]; - - for (i = 0; i < space.length; i++) { - values[space][i] = vals[chans[i]]; - } - - alpha = vals.alpha; - } - - values.alpha = Math.max(0, Math.min(1, (alpha === undefined ? values.alpha : alpha))); - - if (space === 'alpha') { - return false; - } - - var capped; - - // cap values of the space prior converting all values - for (i = 0; i < space.length; i++) { - capped = Math.max(0, Math.min(maxes[space][i], values[space][i])); - values[space][i] = Math.round(capped); - } - - // convert to all the other color spaces - for (var sname in spaces) { - if (sname !== space) { - values[sname] = convert[space][sname](values[space]); - } - } - - return true; -}; - -Color.prototype.setSpace = function (space, args) { - var vals = args[0]; - - if (vals === undefined) { - // color.rgb() - return this.getValues(space); - } - - // color.rgb(10, 10, 10) - if (typeof vals === 'number') { - vals = Array.prototype.slice.call(args); - } - - this.setValues(space, vals); - return this; -}; - -Color.prototype.setChannel = function (space, index, val) { - var svalues = this.values[space]; - if (val === undefined) { - // color.red() - return svalues[index]; - } else if (val === svalues[index]) { - // color.red(color.red()) - return this; - } - - // color.red(100) - svalues[index] = val; - this.setValues(space, svalues); - - return this; -}; - -if (typeof window !== 'undefined') { - window.Color = Color; -} - -module.exports = Color; - -},{"1":1,"4":4}],3:[function(require,module,exports){ -/* MIT license */ - -module.exports = { - rgb2hsl: rgb2hsl, - rgb2hsv: rgb2hsv, - rgb2hwb: rgb2hwb, - rgb2cmyk: rgb2cmyk, - rgb2keyword: rgb2keyword, - rgb2xyz: rgb2xyz, - rgb2lab: rgb2lab, - rgb2lch: rgb2lch, - - hsl2rgb: hsl2rgb, - hsl2hsv: hsl2hsv, - hsl2hwb: hsl2hwb, - hsl2cmyk: hsl2cmyk, - hsl2keyword: hsl2keyword, - - hsv2rgb: hsv2rgb, - hsv2hsl: hsv2hsl, - hsv2hwb: hsv2hwb, - hsv2cmyk: hsv2cmyk, - hsv2keyword: hsv2keyword, - - hwb2rgb: hwb2rgb, - hwb2hsl: hwb2hsl, - hwb2hsv: hwb2hsv, - hwb2cmyk: hwb2cmyk, - hwb2keyword: hwb2keyword, - - cmyk2rgb: cmyk2rgb, - cmyk2hsl: cmyk2hsl, - cmyk2hsv: cmyk2hsv, - cmyk2hwb: cmyk2hwb, - cmyk2keyword: cmyk2keyword, - - keyword2rgb: keyword2rgb, - keyword2hsl: keyword2hsl, - keyword2hsv: keyword2hsv, - keyword2hwb: keyword2hwb, - keyword2cmyk: keyword2cmyk, - keyword2lab: keyword2lab, - keyword2xyz: keyword2xyz, - - xyz2rgb: xyz2rgb, - xyz2lab: xyz2lab, - xyz2lch: xyz2lch, - - lab2xyz: lab2xyz, - lab2rgb: lab2rgb, - lab2lch: lab2lch, - - lch2lab: lch2lab, - lch2xyz: lch2xyz, - lch2rgb: lch2rgb -} - - -function rgb2hsl(rgb) { - var r = rgb[0]/255, - g = rgb[1]/255, - b = rgb[2]/255, - min = Math.min(r, g, b), - max = Math.max(r, g, b), - delta = max - min, - h, s, l; - - if (max == min) - h = 0; - else if (r == max) - h = (g - b) / delta; - else if (g == max) - h = 2 + (b - r) / delta; - else if (b == max) - h = 4 + (r - g)/ delta; - - h = Math.min(h * 60, 360); - - if (h < 0) - h += 360; - - l = (min + max) / 2; - - if (max == min) - s = 0; - else if (l <= 0.5) - s = delta / (max + min); - else - s = delta / (2 - max - min); - - return [h, s * 100, l * 100]; -} - -function rgb2hsv(rgb) { - var r = rgb[0], - g = rgb[1], - b = rgb[2], - min = Math.min(r, g, b), - max = Math.max(r, g, b), - delta = max - min, - h, s, v; - - if (max == 0) - s = 0; - else - s = (delta/max * 1000)/10; - - if (max == min) - h = 0; - else if (r == max) - h = (g - b) / delta; - else if (g == max) - h = 2 + (b - r) / delta; - else if (b == max) - h = 4 + (r - g) / delta; - - h = Math.min(h * 60, 360); - - if (h < 0) - h += 360; - - v = ((max / 255) * 1000) / 10; - - return [h, s, v]; -} - -function rgb2hwb(rgb) { - var r = rgb[0], - g = rgb[1], - b = rgb[2], - h = rgb2hsl(rgb)[0], - w = 1/255 * Math.min(r, Math.min(g, b)), - b = 1 - 1/255 * Math.max(r, Math.max(g, b)); - - return [h, w * 100, b * 100]; -} - -function rgb2cmyk(rgb) { - var r = rgb[0] / 255, - g = rgb[1] / 255, - b = rgb[2] / 255, - c, m, y, k; - - k = Math.min(1 - r, 1 - g, 1 - b); - c = (1 - r - k) / (1 - k) || 0; - m = (1 - g - k) / (1 - k) || 0; - y = (1 - b - k) / (1 - k) || 0; - return [c * 100, m * 100, y * 100, k * 100]; -} - -function rgb2keyword(rgb) { - return reverseKeywords[JSON.stringify(rgb)]; -} - -function rgb2xyz(rgb) { - var r = rgb[0] / 255, - g = rgb[1] / 255, - b = rgb[2] / 255; - - // assume sRGB - r = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92); - g = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92); - b = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92); - - var x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); - var y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); - var z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); - - return [x * 100, y *100, z * 100]; -} - -function rgb2lab(rgb) { - var xyz = rgb2xyz(rgb), - x = xyz[0], - y = xyz[1], - z = xyz[2], - l, a, b; - - x /= 95.047; - y /= 100; - z /= 108.883; - - x = x > 0.008856 ? Math.pow(x, 1/3) : (7.787 * x) + (16 / 116); - y = y > 0.008856 ? Math.pow(y, 1/3) : (7.787 * y) + (16 / 116); - z = z > 0.008856 ? Math.pow(z, 1/3) : (7.787 * z) + (16 / 116); - - l = (116 * y) - 16; - a = 500 * (x - y); - b = 200 * (y - z); - - return [l, a, b]; -} - -function rgb2lch(args) { - return lab2lch(rgb2lab(args)); -} - -function hsl2rgb(hsl) { - var h = hsl[0] / 360, - s = hsl[1] / 100, - l = hsl[2] / 100, - t1, t2, t3, rgb, val; - - if (s == 0) { - val = l * 255; - return [val, val, val]; - } - - if (l < 0.5) - t2 = l * (1 + s); - else - t2 = l + s - l * s; - t1 = 2 * l - t2; - - rgb = [0, 0, 0]; - for (var i = 0; i < 3; i++) { - t3 = h + 1 / 3 * - (i - 1); - t3 < 0 && t3++; - t3 > 1 && t3--; - - if (6 * t3 < 1) - val = t1 + (t2 - t1) * 6 * t3; - else if (2 * t3 < 1) - val = t2; - else if (3 * t3 < 2) - val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; - else - val = t1; - - rgb[i] = val * 255; - } - - return rgb; -} - -function hsl2hsv(hsl) { - var h = hsl[0], - s = hsl[1] / 100, - l = hsl[2] / 100, - sv, v; - - if(l === 0) { - // no need to do calc on black - // also avoids divide by 0 error - return [0, 0, 0]; - } - - l *= 2; - s *= (l <= 1) ? l : 2 - l; - v = (l + s) / 2; - sv = (2 * s) / (l + s); - return [h, sv * 100, v * 100]; -} - -function hsl2hwb(args) { - return rgb2hwb(hsl2rgb(args)); -} - -function hsl2cmyk(args) { - return rgb2cmyk(hsl2rgb(args)); -} - -function hsl2keyword(args) { - return rgb2keyword(hsl2rgb(args)); -} - - -function hsv2rgb(hsv) { - var h = hsv[0] / 60, - s = hsv[1] / 100, - v = hsv[2] / 100, - hi = Math.floor(h) % 6; - - var f = h - Math.floor(h), - p = 255 * v * (1 - s), - q = 255 * v * (1 - (s * f)), - t = 255 * v * (1 - (s * (1 - f))), - v = 255 * v; - - switch(hi) { - case 0: - return [v, t, p]; - case 1: - return [q, v, p]; - case 2: - return [p, v, t]; - case 3: - return [p, q, v]; - case 4: - return [t, p, v]; - case 5: - return [v, p, q]; - } -} - -function hsv2hsl(hsv) { - var h = hsv[0], - s = hsv[1] / 100, - v = hsv[2] / 100, - sl, l; - - l = (2 - s) * v; - sl = s * v; - sl /= (l <= 1) ? l : 2 - l; - sl = sl || 0; - l /= 2; - return [h, sl * 100, l * 100]; -} - -function hsv2hwb(args) { - return rgb2hwb(hsv2rgb(args)) -} - -function hsv2cmyk(args) { - return rgb2cmyk(hsv2rgb(args)); -} - -function hsv2keyword(args) { - return rgb2keyword(hsv2rgb(args)); -} - -// http://dev.w3.org/csswg/css-color/#hwb-to-rgb -function hwb2rgb(hwb) { - var h = hwb[0] / 360, - wh = hwb[1] / 100, - bl = hwb[2] / 100, - ratio = wh + bl, - i, v, f, n; - - // wh + bl cant be > 1 - if (ratio > 1) { - wh /= ratio; - bl /= ratio; - } - - i = Math.floor(6 * h); - v = 1 - bl; - f = 6 * h - i; - if ((i & 0x01) != 0) { - f = 1 - f; - } - n = wh + f * (v - wh); // linear interpolation - - switch (i) { - default: - case 6: - case 0: r = v; g = n; b = wh; break; - case 1: r = n; g = v; b = wh; break; - case 2: r = wh; g = v; b = n; break; - case 3: r = wh; g = n; b = v; break; - case 4: r = n; g = wh; b = v; break; - case 5: r = v; g = wh; b = n; break; - } - - return [r * 255, g * 255, b * 255]; -} - -function hwb2hsl(args) { - return rgb2hsl(hwb2rgb(args)); -} - -function hwb2hsv(args) { - return rgb2hsv(hwb2rgb(args)); -} - -function hwb2cmyk(args) { - return rgb2cmyk(hwb2rgb(args)); -} - -function hwb2keyword(args) { - return rgb2keyword(hwb2rgb(args)); -} - -function cmyk2rgb(cmyk) { - var c = cmyk[0] / 100, - m = cmyk[1] / 100, - y = cmyk[2] / 100, - k = cmyk[3] / 100, - r, g, b; - - r = 1 - Math.min(1, c * (1 - k) + k); - g = 1 - Math.min(1, m * (1 - k) + k); - b = 1 - Math.min(1, y * (1 - k) + k); - return [r * 255, g * 255, b * 255]; -} - -function cmyk2hsl(args) { - return rgb2hsl(cmyk2rgb(args)); -} - -function cmyk2hsv(args) { - return rgb2hsv(cmyk2rgb(args)); -} - -function cmyk2hwb(args) { - return rgb2hwb(cmyk2rgb(args)); -} - -function cmyk2keyword(args) { - return rgb2keyword(cmyk2rgb(args)); -} - - -function xyz2rgb(xyz) { - var x = xyz[0] / 100, - y = xyz[1] / 100, - z = xyz[2] / 100, - r, g, b; - - r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); - g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); - b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); - - // assume sRGB - r = r > 0.0031308 ? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055) - : r = (r * 12.92); - - g = g > 0.0031308 ? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055) - : g = (g * 12.92); - - b = b > 0.0031308 ? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055) - : b = (b * 12.92); - - r = Math.min(Math.max(0, r), 1); - g = Math.min(Math.max(0, g), 1); - b = Math.min(Math.max(0, b), 1); - - return [r * 255, g * 255, b * 255]; -} - -function xyz2lab(xyz) { - var x = xyz[0], - y = xyz[1], - z = xyz[2], - l, a, b; - - x /= 95.047; - y /= 100; - z /= 108.883; - - x = x > 0.008856 ? Math.pow(x, 1/3) : (7.787 * x) + (16 / 116); - y = y > 0.008856 ? Math.pow(y, 1/3) : (7.787 * y) + (16 / 116); - z = z > 0.008856 ? Math.pow(z, 1/3) : (7.787 * z) + (16 / 116); - - l = (116 * y) - 16; - a = 500 * (x - y); - b = 200 * (y - z); - - return [l, a, b]; -} - -function xyz2lch(args) { - return lab2lch(xyz2lab(args)); -} - -function lab2xyz(lab) { - var l = lab[0], - a = lab[1], - b = lab[2], - x, y, z, y2; - - if (l <= 8) { - y = (l * 100) / 903.3; - y2 = (7.787 * (y / 100)) + (16 / 116); - } else { - y = 100 * Math.pow((l + 16) / 116, 3); - y2 = Math.pow(y / 100, 1/3); - } - - x = x / 95.047 <= 0.008856 ? x = (95.047 * ((a / 500) + y2 - (16 / 116))) / 7.787 : 95.047 * Math.pow((a / 500) + y2, 3); - - z = z / 108.883 <= 0.008859 ? z = (108.883 * (y2 - (b / 200) - (16 / 116))) / 7.787 : 108.883 * Math.pow(y2 - (b / 200), 3); - - return [x, y, z]; -} - -function lab2lch(lab) { - var l = lab[0], - a = lab[1], - b = lab[2], - hr, h, c; - - hr = Math.atan2(b, a); - h = hr * 360 / 2 / Math.PI; - if (h < 0) { - h += 360; - } - c = Math.sqrt(a * a + b * b); - return [l, c, h]; -} - -function lab2rgb(args) { - return xyz2rgb(lab2xyz(args)); -} - -function lch2lab(lch) { - var l = lch[0], - c = lch[1], - h = lch[2], - a, b, hr; - - hr = h / 360 * 2 * Math.PI; - a = c * Math.cos(hr); - b = c * Math.sin(hr); - return [l, a, b]; -} - -function lch2xyz(args) { - return lab2xyz(lch2lab(args)); -} - -function lch2rgb(args) { - return lab2rgb(lch2lab(args)); -} - -function keyword2rgb(keyword) { - return cssKeywords[keyword]; -} - -function keyword2hsl(args) { - return rgb2hsl(keyword2rgb(args)); -} - -function keyword2hsv(args) { - return rgb2hsv(keyword2rgb(args)); -} - -function keyword2hwb(args) { - return rgb2hwb(keyword2rgb(args)); -} - -function keyword2cmyk(args) { - return rgb2cmyk(keyword2rgb(args)); -} - -function keyword2lab(args) { - return rgb2lab(keyword2rgb(args)); -} - -function keyword2xyz(args) { - return rgb2xyz(keyword2rgb(args)); -} - -var cssKeywords = { - aliceblue: [240,248,255], - antiquewhite: [250,235,215], - aqua: [0,255,255], - aquamarine: [127,255,212], - azure: [240,255,255], - beige: [245,245,220], - bisque: [255,228,196], - black: [0,0,0], - blanchedalmond: [255,235,205], - blue: [0,0,255], - blueviolet: [138,43,226], - brown: [165,42,42], - burlywood: [222,184,135], - cadetblue: [95,158,160], - chartreuse: [127,255,0], - chocolate: [210,105,30], - coral: [255,127,80], - cornflowerblue: [100,149,237], - cornsilk: [255,248,220], - crimson: [220,20,60], - cyan: [0,255,255], - darkblue: [0,0,139], - darkcyan: [0,139,139], - darkgoldenrod: [184,134,11], - darkgray: [169,169,169], - darkgreen: [0,100,0], - darkgrey: [169,169,169], - darkkhaki: [189,183,107], - darkmagenta: [139,0,139], - darkolivegreen: [85,107,47], - darkorange: [255,140,0], - darkorchid: [153,50,204], - darkred: [139,0,0], - darksalmon: [233,150,122], - darkseagreen: [143,188,143], - darkslateblue: [72,61,139], - darkslategray: [47,79,79], - darkslategrey: [47,79,79], - darkturquoise: [0,206,209], - darkviolet: [148,0,211], - deeppink: [255,20,147], - deepskyblue: [0,191,255], - dimgray: [105,105,105], - dimgrey: [105,105,105], - dodgerblue: [30,144,255], - firebrick: [178,34,34], - floralwhite: [255,250,240], - forestgreen: [34,139,34], - fuchsia: [255,0,255], - gainsboro: [220,220,220], - ghostwhite: [248,248,255], - gold: [255,215,0], - goldenrod: [218,165,32], - gray: [128,128,128], - green: [0,128,0], - greenyellow: [173,255,47], - grey: [128,128,128], - honeydew: [240,255,240], - hotpink: [255,105,180], - indianred: [205,92,92], - indigo: [75,0,130], - ivory: [255,255,240], - khaki: [240,230,140], - lavender: [230,230,250], - lavenderblush: [255,240,245], - lawngreen: [124,252,0], - lemonchiffon: [255,250,205], - lightblue: [173,216,230], - lightcoral: [240,128,128], - lightcyan: [224,255,255], - lightgoldenrodyellow: [250,250,210], - lightgray: [211,211,211], - lightgreen: [144,238,144], - lightgrey: [211,211,211], - lightpink: [255,182,193], - lightsalmon: [255,160,122], - lightseagreen: [32,178,170], - lightskyblue: [135,206,250], - lightslategray: [119,136,153], - lightslategrey: [119,136,153], - lightsteelblue: [176,196,222], - lightyellow: [255,255,224], - lime: [0,255,0], - limegreen: [50,205,50], - linen: [250,240,230], - magenta: [255,0,255], - maroon: [128,0,0], - mediumaquamarine: [102,205,170], - mediumblue: [0,0,205], - mediumorchid: [186,85,211], - mediumpurple: [147,112,219], - mediumseagreen: [60,179,113], - mediumslateblue: [123,104,238], - mediumspringgreen: [0,250,154], - mediumturquoise: [72,209,204], - mediumvioletred: [199,21,133], - midnightblue: [25,25,112], - mintcream: [245,255,250], - mistyrose: [255,228,225], - moccasin: [255,228,181], - navajowhite: [255,222,173], - navy: [0,0,128], - oldlace: [253,245,230], - olive: [128,128,0], - olivedrab: [107,142,35], - orange: [255,165,0], - orangered: [255,69,0], - orchid: [218,112,214], - palegoldenrod: [238,232,170], - palegreen: [152,251,152], - paleturquoise: [175,238,238], - palevioletred: [219,112,147], - papayawhip: [255,239,213], - peachpuff: [255,218,185], - peru: [205,133,63], - pink: [255,192,203], - plum: [221,160,221], - powderblue: [176,224,230], - purple: [128,0,128], - rebeccapurple: [102, 51, 153], - red: [255,0,0], - rosybrown: [188,143,143], - royalblue: [65,105,225], - saddlebrown: [139,69,19], - salmon: [250,128,114], - sandybrown: [244,164,96], - seagreen: [46,139,87], - seashell: [255,245,238], - sienna: [160,82,45], - silver: [192,192,192], - skyblue: [135,206,235], - slateblue: [106,90,205], - slategray: [112,128,144], - slategrey: [112,128,144], - snow: [255,250,250], - springgreen: [0,255,127], - steelblue: [70,130,180], - tan: [210,180,140], - teal: [0,128,128], - thistle: [216,191,216], - tomato: [255,99,71], - turquoise: [64,224,208], - violet: [238,130,238], - wheat: [245,222,179], - white: [255,255,255], - whitesmoke: [245,245,245], - yellow: [255,255,0], - yellowgreen: [154,205,50] -}; - -var reverseKeywords = {}; -for (var key in cssKeywords) { - reverseKeywords[JSON.stringify(cssKeywords[key])] = key; -} - -},{}],4:[function(require,module,exports){ -var conversions = require(3); - -var convert = function() { - return new Converter(); -} - -for (var func in conversions) { - // export Raw versions - convert[func + "Raw"] = (function(func) { - // accept array or plain args - return function(arg) { - if (typeof arg == "number") - arg = Array.prototype.slice.call(arguments); - return conversions[func](arg); - } - })(func); - - var pair = /(\w+)2(\w+)/.exec(func), - from = pair[1], - to = pair[2]; - - // export rgb2hsl and ["rgb"]["hsl"] - convert[from] = convert[from] || {}; - - convert[from][to] = convert[func] = (function(func) { - return function(arg) { - if (typeof arg == "number") - arg = Array.prototype.slice.call(arguments); - - var val = conversions[func](arg); - if (typeof val == "string" || val === undefined) - return val; // keyword - - for (var i = 0; i < val.length; i++) - val[i] = Math.round(val[i]); - return val; - } - })(func); -} - - -/* Converter does lazy conversion and caching */ -var Converter = function() { - this.convs = {}; -}; - -/* Either get the values for a space or - set the values for a space, depending on args */ -Converter.prototype.routeSpace = function(space, args) { - var values = args[0]; - if (values === undefined) { - // color.rgb() - return this.getValues(space); - } - // color.rgb(10, 10, 10) - if (typeof values == "number") { - values = Array.prototype.slice.call(args); - } - - return this.setValues(space, values); -}; - -/* Set the values for a space, invalidating cache */ -Converter.prototype.setValues = function(space, values) { - this.space = space; - this.convs = {}; - this.convs[space] = values; - return this; -}; - -/* Get the values for a space. If there's already - a conversion for the space, fetch it, otherwise - compute it */ -Converter.prototype.getValues = function(space) { - var vals = this.convs[space]; - if (!vals) { - var fspace = this.space, - from = this.convs[fspace]; - vals = convert[fspace][space](from); - - this.convs[space] = vals; - } - return vals; -}; - -["rgb", "hsl", "hsv", "cmyk", "keyword"].forEach(function(space) { - Converter.prototype[space] = function(vals) { - return this.routeSpace(space, arguments); - } -}); - -module.exports = convert; -},{"3":3}],5:[function(require,module,exports){ -module.exports = { - "aliceblue": [240, 248, 255], - "antiquewhite": [250, 235, 215], - "aqua": [0, 255, 255], - "aquamarine": [127, 255, 212], - "azure": [240, 255, 255], - "beige": [245, 245, 220], - "bisque": [255, 228, 196], - "black": [0, 0, 0], - "blanchedalmond": [255, 235, 205], - "blue": [0, 0, 255], - "blueviolet": [138, 43, 226], - "brown": [165, 42, 42], - "burlywood": [222, 184, 135], - "cadetblue": [95, 158, 160], - "chartreuse": [127, 255, 0], - "chocolate": [210, 105, 30], - "coral": [255, 127, 80], - "cornflowerblue": [100, 149, 237], - "cornsilk": [255, 248, 220], - "crimson": [220, 20, 60], - "cyan": [0, 255, 255], - "darkblue": [0, 0, 139], - "darkcyan": [0, 139, 139], - "darkgoldenrod": [184, 134, 11], - "darkgray": [169, 169, 169], - "darkgreen": [0, 100, 0], - "darkgrey": [169, 169, 169], - "darkkhaki": [189, 183, 107], - "darkmagenta": [139, 0, 139], - "darkolivegreen": [85, 107, 47], - "darkorange": [255, 140, 0], - "darkorchid": [153, 50, 204], - "darkred": [139, 0, 0], - "darksalmon": [233, 150, 122], - "darkseagreen": [143, 188, 143], - "darkslateblue": [72, 61, 139], - "darkslategray": [47, 79, 79], - "darkslategrey": [47, 79, 79], - "darkturquoise": [0, 206, 209], - "darkviolet": [148, 0, 211], - "deeppink": [255, 20, 147], - "deepskyblue": [0, 191, 255], - "dimgray": [105, 105, 105], - "dimgrey": [105, 105, 105], - "dodgerblue": [30, 144, 255], - "firebrick": [178, 34, 34], - "floralwhite": [255, 250, 240], - "forestgreen": [34, 139, 34], - "fuchsia": [255, 0, 255], - "gainsboro": [220, 220, 220], - "ghostwhite": [248, 248, 255], - "gold": [255, 215, 0], - "goldenrod": [218, 165, 32], - "gray": [128, 128, 128], - "green": [0, 128, 0], - "greenyellow": [173, 255, 47], - "grey": [128, 128, 128], - "honeydew": [240, 255, 240], - "hotpink": [255, 105, 180], - "indianred": [205, 92, 92], - "indigo": [75, 0, 130], - "ivory": [255, 255, 240], - "khaki": [240, 230, 140], - "lavender": [230, 230, 250], - "lavenderblush": [255, 240, 245], - "lawngreen": [124, 252, 0], - "lemonchiffon": [255, 250, 205], - "lightblue": [173, 216, 230], - "lightcoral": [240, 128, 128], - "lightcyan": [224, 255, 255], - "lightgoldenrodyellow": [250, 250, 210], - "lightgray": [211, 211, 211], - "lightgreen": [144, 238, 144], - "lightgrey": [211, 211, 211], - "lightpink": [255, 182, 193], - "lightsalmon": [255, 160, 122], - "lightseagreen": [32, 178, 170], - "lightskyblue": [135, 206, 250], - "lightslategray": [119, 136, 153], - "lightslategrey": [119, 136, 153], - "lightsteelblue": [176, 196, 222], - "lightyellow": [255, 255, 224], - "lime": [0, 255, 0], - "limegreen": [50, 205, 50], - "linen": [250, 240, 230], - "magenta": [255, 0, 255], - "maroon": [128, 0, 0], - "mediumaquamarine": [102, 205, 170], - "mediumblue": [0, 0, 205], - "mediumorchid": [186, 85, 211], - "mediumpurple": [147, 112, 219], - "mediumseagreen": [60, 179, 113], - "mediumslateblue": [123, 104, 238], - "mediumspringgreen": [0, 250, 154], - "mediumturquoise": [72, 209, 204], - "mediumvioletred": [199, 21, 133], - "midnightblue": [25, 25, 112], - "mintcream": [245, 255, 250], - "mistyrose": [255, 228, 225], - "moccasin": [255, 228, 181], - "navajowhite": [255, 222, 173], - "navy": [0, 0, 128], - "oldlace": [253, 245, 230], - "olive": [128, 128, 0], - "olivedrab": [107, 142, 35], - "orange": [255, 165, 0], - "orangered": [255, 69, 0], - "orchid": [218, 112, 214], - "palegoldenrod": [238, 232, 170], - "palegreen": [152, 251, 152], - "paleturquoise": [175, 238, 238], - "palevioletred": [219, 112, 147], - "papayawhip": [255, 239, 213], - "peachpuff": [255, 218, 185], - "peru": [205, 133, 63], - "pink": [255, 192, 203], - "plum": [221, 160, 221], - "powderblue": [176, 224, 230], - "purple": [128, 0, 128], - "rebeccapurple": [102, 51, 153], - "red": [255, 0, 0], - "rosybrown": [188, 143, 143], - "royalblue": [65, 105, 225], - "saddlebrown": [139, 69, 19], - "salmon": [250, 128, 114], - "sandybrown": [244, 164, 96], - "seagreen": [46, 139, 87], - "seashell": [255, 245, 238], - "sienna": [160, 82, 45], - "silver": [192, 192, 192], - "skyblue": [135, 206, 235], - "slateblue": [106, 90, 205], - "slategray": [112, 128, 144], - "slategrey": [112, 128, 144], - "snow": [255, 250, 250], - "springgreen": [0, 255, 127], - "steelblue": [70, 130, 180], - "tan": [210, 180, 140], - "teal": [0, 128, 128], - "thistle": [216, 191, 216], - "tomato": [255, 99, 71], - "turquoise": [64, 224, 208], - "violet": [238, 130, 238], - "wheat": [245, 222, 179], - "white": [255, 255, 255], - "whitesmoke": [245, 245, 245], - "yellow": [255, 255, 0], - "yellowgreen": [154, 205, 50] -}; -},{}],6:[function(require,module,exports){ -//! moment.js -//! version : 2.15.1 -//! authors : Tim Wood, Iskren Chernev, Moment.js contributors -//! license : MIT -//! momentjs.com - -;(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - global.moment = factory() -}(this, function () { 'use strict'; - - var hookCallback; - - function utils_hooks__hooks () { - return hookCallback.apply(null, arguments); - } - - // This is done to register the method called with moment() - // without creating circular dependencies. - function setHookCallback (callback) { - hookCallback = callback; - } - - function isArray(input) { - return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; - } - - function isObject(input) { - // IE8 will treat undefined and null as object if it wasn't for - // input != null - return input != null && Object.prototype.toString.call(input) === '[object Object]'; - } - - function isObjectEmpty(obj) { - var k; - for (k in obj) { - // even if its not own property I'd still call it non-empty - return false; - } - return true; - } - - function isDate(input) { - return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; - } - - function map(arr, fn) { - var res = [], i; - for (i = 0; i < arr.length; ++i) { - res.push(fn(arr[i], i)); - } - return res; - } - - function hasOwnProp(a, b) { - return Object.prototype.hasOwnProperty.call(a, b); - } - - function extend(a, b) { - for (var i in b) { - if (hasOwnProp(b, i)) { - a[i] = b[i]; - } - } - - if (hasOwnProp(b, 'toString')) { - a.toString = b.toString; - } - - if (hasOwnProp(b, 'valueOf')) { - a.valueOf = b.valueOf; - } - - return a; - } - - function create_utc__createUTC (input, format, locale, strict) { - return createLocalOrUTC(input, format, locale, strict, true).utc(); - } - - function defaultParsingFlags() { - // We need to deep clone this object. - return { - empty : false, - unusedTokens : [], - unusedInput : [], - overflow : -2, - charsLeftOver : 0, - nullInput : false, - invalidMonth : null, - invalidFormat : false, - userInvalidated : false, - iso : false, - parsedDateParts : [], - meridiem : null - }; - } - - function getParsingFlags(m) { - if (m._pf == null) { - m._pf = defaultParsingFlags(); - } - return m._pf; - } - - var some; - if (Array.prototype.some) { - some = Array.prototype.some; - } else { - some = function (fun) { - var t = Object(this); - var len = t.length >>> 0; - - for (var i = 0; i < len; i++) { - if (i in t && fun.call(this, t[i], i, t)) { - return true; - } - } - - return false; - }; - } - - function valid__isValid(m) { - if (m._isValid == null) { - var flags = getParsingFlags(m); - var parsedParts = some.call(flags.parsedDateParts, function (i) { - return i != null; - }); - var isNowValid = !isNaN(m._d.getTime()) && - flags.overflow < 0 && - !flags.empty && - !flags.invalidMonth && - !flags.invalidWeekday && - !flags.nullInput && - !flags.invalidFormat && - !flags.userInvalidated && - (!flags.meridiem || (flags.meridiem && parsedParts)); - - if (m._strict) { - isNowValid = isNowValid && - flags.charsLeftOver === 0 && - flags.unusedTokens.length === 0 && - flags.bigHour === undefined; - } - - if (Object.isFrozen == null || !Object.isFrozen(m)) { - m._isValid = isNowValid; - } - else { - return isNowValid; - } - } - return m._isValid; - } - - function valid__createInvalid (flags) { - var m = create_utc__createUTC(NaN); - if (flags != null) { - extend(getParsingFlags(m), flags); - } - else { - getParsingFlags(m).userInvalidated = true; - } - - return m; - } - - function isUndefined(input) { - return input === void 0; - } - - // Plugins that add properties should also add the key here (null value), - // so we can properly clone ourselves. - var momentProperties = utils_hooks__hooks.momentProperties = []; - - function copyConfig(to, from) { - var i, prop, val; - - if (!isUndefined(from._isAMomentObject)) { - to._isAMomentObject = from._isAMomentObject; - } - if (!isUndefined(from._i)) { - to._i = from._i; - } - if (!isUndefined(from._f)) { - to._f = from._f; - } - if (!isUndefined(from._l)) { - to._l = from._l; - } - if (!isUndefined(from._strict)) { - to._strict = from._strict; - } - if (!isUndefined(from._tzm)) { - to._tzm = from._tzm; - } - if (!isUndefined(from._isUTC)) { - to._isUTC = from._isUTC; - } - if (!isUndefined(from._offset)) { - to._offset = from._offset; - } - if (!isUndefined(from._pf)) { - to._pf = getParsingFlags(from); - } - if (!isUndefined(from._locale)) { - to._locale = from._locale; - } - - if (momentProperties.length > 0) { - for (i in momentProperties) { - prop = momentProperties[i]; - val = from[prop]; - if (!isUndefined(val)) { - to[prop] = val; - } - } - } - - return to; - } - - var updateInProgress = false; - - // Moment prototype object - function Moment(config) { - copyConfig(this, config); - this._d = new Date(config._d != null ? config._d.getTime() : NaN); - // Prevent infinite loop in case updateOffset creates new moment - // objects. - if (updateInProgress === false) { - updateInProgress = true; - utils_hooks__hooks.updateOffset(this); - updateInProgress = false; - } - } - - function isMoment (obj) { - return obj instanceof Moment || (obj != null && obj._isAMomentObject != null); - } - - function absFloor (number) { - if (number < 0) { - // -0 -> 0 - return Math.ceil(number) || 0; - } else { - return Math.floor(number); - } - } - - function toInt(argumentForCoercion) { - var coercedNumber = +argumentForCoercion, - value = 0; - - if (coercedNumber !== 0 && isFinite(coercedNumber)) { - value = absFloor(coercedNumber); - } - - return value; - } - - // compare two arrays, return the number of differences - function compareArrays(array1, array2, dontConvert) { - var len = Math.min(array1.length, array2.length), - lengthDiff = Math.abs(array1.length - array2.length), - diffs = 0, - i; - for (i = 0; i < len; i++) { - if ((dontConvert && array1[i] !== array2[i]) || - (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) { - diffs++; - } - } - return diffs + lengthDiff; - } - - function warn(msg) { - if (utils_hooks__hooks.suppressDeprecationWarnings === false && - (typeof console !== 'undefined') && console.warn) { - console.warn('Deprecation warning: ' + msg); - } - } - - function deprecate(msg, fn) { - var firstTime = true; - - return extend(function () { - if (utils_hooks__hooks.deprecationHandler != null) { - utils_hooks__hooks.deprecationHandler(null, msg); - } - if (firstTime) { - var args = []; - var arg; - for (var i = 0; i < arguments.length; i++) { - arg = ''; - if (typeof arguments[i] === 'object') { - arg += '\n[' + i + '] '; - for (var key in arguments[0]) { - arg += key + ': ' + arguments[0][key] + ', '; - } - arg = arg.slice(0, -2); // Remove trailing comma and space - } else { - arg = arguments[i]; - } - args.push(arg); - } - warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); - firstTime = false; - } - return fn.apply(this, arguments); - }, fn); - } - - var deprecations = {}; - - function deprecateSimple(name, msg) { - if (utils_hooks__hooks.deprecationHandler != null) { - utils_hooks__hooks.deprecationHandler(name, msg); - } - if (!deprecations[name]) { - warn(msg); - deprecations[name] = true; - } - } - - utils_hooks__hooks.suppressDeprecationWarnings = false; - utils_hooks__hooks.deprecationHandler = null; - - function isFunction(input) { - return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; - } - - function locale_set__set (config) { - var prop, i; - for (i in config) { - prop = config[i]; - if (isFunction(prop)) { - this[i] = prop; - } else { - this['_' + i] = prop; - } - } - this._config = config; - // Lenient ordinal parsing accepts just a number in addition to - // number + (possibly) stuff coming from _ordinalParseLenient. - this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + (/\d{1,2}/).source); - } - - function mergeConfigs(parentConfig, childConfig) { - var res = extend({}, parentConfig), prop; - for (prop in childConfig) { - if (hasOwnProp(childConfig, prop)) { - if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { - res[prop] = {}; - extend(res[prop], parentConfig[prop]); - extend(res[prop], childConfig[prop]); - } else if (childConfig[prop] != null) { - res[prop] = childConfig[prop]; - } else { - delete res[prop]; - } - } - } - for (prop in parentConfig) { - if (hasOwnProp(parentConfig, prop) && - !hasOwnProp(childConfig, prop) && - isObject(parentConfig[prop])) { - // make sure changes to properties don't modify parent config - res[prop] = extend({}, res[prop]); - } - } - return res; - } - - function Locale(config) { - if (config != null) { - this.set(config); - } - } - - var keys; - - if (Object.keys) { - keys = Object.keys; - } else { - keys = function (obj) { - var i, res = []; - for (i in obj) { - if (hasOwnProp(obj, i)) { - res.push(i); - } - } - return res; - }; - } - - var defaultCalendar = { - sameDay : '[Today at] LT', - nextDay : '[Tomorrow at] LT', - nextWeek : 'dddd [at] LT', - lastDay : '[Yesterday at] LT', - lastWeek : '[Last] dddd [at] LT', - sameElse : 'L' - }; - - function locale_calendar__calendar (key, mom, now) { - var output = this._calendar[key] || this._calendar['sameElse']; - return isFunction(output) ? output.call(mom, now) : output; - } - - var defaultLongDateFormat = { - LTS : 'h:mm:ss A', - LT : 'h:mm A', - L : 'MM/DD/YYYY', - LL : 'MMMM D, YYYY', - LLL : 'MMMM D, YYYY h:mm A', - LLLL : 'dddd, MMMM D, YYYY h:mm A' - }; - - function longDateFormat (key) { - var format = this._longDateFormat[key], - formatUpper = this._longDateFormat[key.toUpperCase()]; - - if (format || !formatUpper) { - return format; - } - - this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) { - return val.slice(1); - }); - - return this._longDateFormat[key]; - } - - var defaultInvalidDate = 'Invalid date'; - - function invalidDate () { - return this._invalidDate; - } - - var defaultOrdinal = '%d'; - var defaultOrdinalParse = /\d{1,2}/; - - function ordinal (number) { - return this._ordinal.replace('%d', number); - } - - var defaultRelativeTime = { - future : 'in %s', - past : '%s ago', - s : 'a few seconds', - m : 'a minute', - mm : '%d minutes', - h : 'an hour', - hh : '%d hours', - d : 'a day', - dd : '%d days', - M : 'a month', - MM : '%d months', - y : 'a year', - yy : '%d years' - }; - - function relative__relativeTime (number, withoutSuffix, string, isFuture) { - var output = this._relativeTime[string]; - return (isFunction(output)) ? - output(number, withoutSuffix, string, isFuture) : - output.replace(/%d/i, number); - } - - function pastFuture (diff, output) { - var format = this._relativeTime[diff > 0 ? 'future' : 'past']; - return isFunction(format) ? format(output) : format.replace(/%s/i, output); - } - - var aliases = {}; - - function addUnitAlias (unit, shorthand) { - var lowerCase = unit.toLowerCase(); - aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; - } - - function normalizeUnits(units) { - return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; - } - - function normalizeObjectUnits(inputObject) { - var normalizedInput = {}, - normalizedProp, - prop; - - for (prop in inputObject) { - if (hasOwnProp(inputObject, prop)) { - normalizedProp = normalizeUnits(prop); - if (normalizedProp) { - normalizedInput[normalizedProp] = inputObject[prop]; - } - } - } - - return normalizedInput; - } - - var priorities = {}; - - function addUnitPriority(unit, priority) { - priorities[unit] = priority; - } - - function getPrioritizedUnits(unitsObj) { - var units = []; - for (var u in unitsObj) { - units.push({unit: u, priority: priorities[u]}); - } - units.sort(function (a, b) { - return a.priority - b.priority; - }); - return units; - } - - function makeGetSet (unit, keepTime) { - return function (value) { - if (value != null) { - get_set__set(this, unit, value); - utils_hooks__hooks.updateOffset(this, keepTime); - return this; - } else { - return get_set__get(this, unit); - } - }; - } - - function get_set__get (mom, unit) { - return mom.isValid() ? - mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; - } - - function get_set__set (mom, unit, value) { - if (mom.isValid()) { - mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); - } - } - - // MOMENTS - - function stringGet (units) { - units = normalizeUnits(units); - if (isFunction(this[units])) { - return this[units](); - } - return this; - } - - - function stringSet (units, value) { - if (typeof units === 'object') { - units = normalizeObjectUnits(units); - var prioritized = getPrioritizedUnits(units); - for (var i = 0; i < prioritized.length; i++) { - this[prioritized[i].unit](units[prioritized[i].unit]); - } - } else { - units = normalizeUnits(units); - if (isFunction(this[units])) { - return this[units](value); - } - } - return this; - } - - function zeroFill(number, targetLength, forceSign) { - var absNumber = '' + Math.abs(number), - zerosToFill = targetLength - absNumber.length, - sign = number >= 0; - return (sign ? (forceSign ? '+' : '') : '-') + - Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; - } - - var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g; - - var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g; - - var formatFunctions = {}; - - var formatTokenFunctions = {}; - - // token: 'M' - // padded: ['MM', 2] - // ordinal: 'Mo' - // callback: function () { this.month() + 1 } - function addFormatToken (token, padded, ordinal, callback) { - var func = callback; - if (typeof callback === 'string') { - func = function () { - return this[callback](); - }; - } - if (token) { - formatTokenFunctions[token] = func; - } - if (padded) { - formatTokenFunctions[padded[0]] = function () { - return zeroFill(func.apply(this, arguments), padded[1], padded[2]); - }; - } - if (ordinal) { - formatTokenFunctions[ordinal] = function () { - return this.localeData().ordinal(func.apply(this, arguments), token); - }; - } - } - - function removeFormattingTokens(input) { - if (input.match(/\[[\s\S]/)) { - return input.replace(/^\[|\]$/g, ''); - } - return input.replace(/\\/g, ''); - } - - function makeFormatFunction(format) { - var array = format.match(formattingTokens), i, length; - - for (i = 0, length = array.length; i < length; i++) { - if (formatTokenFunctions[array[i]]) { - array[i] = formatTokenFunctions[array[i]]; - } else { - array[i] = removeFormattingTokens(array[i]); - } - } - - return function (mom) { - var output = '', i; - for (i = 0; i < length; i++) { - output += array[i] instanceof Function ? array[i].call(mom, format) : array[i]; - } - return output; - }; - } - - // format date using native date object - function formatMoment(m, format) { - if (!m.isValid()) { - return m.localeData().invalidDate(); - } - - format = expandFormat(format, m.localeData()); - formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); - - return formatFunctions[format](m); - } - - function expandFormat(format, locale) { - var i = 5; - - function replaceLongDateFormatTokens(input) { - return locale.longDateFormat(input) || input; - } - - localFormattingTokens.lastIndex = 0; - while (i >= 0 && localFormattingTokens.test(format)) { - format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); - localFormattingTokens.lastIndex = 0; - i -= 1; - } - - return format; - } - - var match1 = /\d/; // 0 - 9 - var match2 = /\d\d/; // 00 - 99 - var match3 = /\d{3}/; // 000 - 999 - var match4 = /\d{4}/; // 0000 - 9999 - var match6 = /[+-]?\d{6}/; // -999999 - 999999 - var match1to2 = /\d\d?/; // 0 - 99 - var match3to4 = /\d\d\d\d?/; // 999 - 9999 - var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999 - var match1to3 = /\d{1,3}/; // 0 - 999 - var match1to4 = /\d{1,4}/; // 0 - 9999 - var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999 - - var matchUnsigned = /\d+/; // 0 - inf - var matchSigned = /[+-]?\d+/; // -inf - inf - - var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z - var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z - - var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123 - - // any word (or two) characters or numbers including two/three word month in arabic. - // includes scottish gaelic two word and hyphenated months - var matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i; - - - var regexes = {}; - - function addRegexToken (token, regex, strictRegex) { - regexes[token] = isFunction(regex) ? regex : function (isStrict, localeData) { - return (isStrict && strictRegex) ? strictRegex : regex; - }; - } - - function getParseRegexForToken (token, config) { - if (!hasOwnProp(regexes, token)) { - return new RegExp(unescapeFormat(token)); - } - - return regexes[token](config._strict, config._locale); - } - - // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript - function unescapeFormat(s) { - return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) { - return p1 || p2 || p3 || p4; - })); - } - - function regexEscape(s) { - return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); - } - - var tokens = {}; - - function addParseToken (token, callback) { - var i, func = callback; - if (typeof token === 'string') { - token = [token]; - } - if (typeof callback === 'number') { - func = function (input, array) { - array[callback] = toInt(input); - }; - } - for (i = 0; i < token.length; i++) { - tokens[token[i]] = func; - } - } - - function addWeekParseToken (token, callback) { - addParseToken(token, function (input, array, config, token) { - config._w = config._w || {}; - callback(input, config._w, config, token); - }); - } - - function addTimeToArrayFromToken(token, input, config) { - if (input != null && hasOwnProp(tokens, token)) { - tokens[token](input, config._a, config, token); - } - } - - var YEAR = 0; - var MONTH = 1; - var DATE = 2; - var HOUR = 3; - var MINUTE = 4; - var SECOND = 5; - var MILLISECOND = 6; - var WEEK = 7; - var WEEKDAY = 8; - - var indexOf; - - if (Array.prototype.indexOf) { - indexOf = Array.prototype.indexOf; - } else { - indexOf = function (o) { - // I know - var i; - for (i = 0; i < this.length; ++i) { - if (this[i] === o) { - return i; - } - } - return -1; - }; - } - - function daysInMonth(year, month) { - return new Date(Date.UTC(year, month + 1, 0)).getUTCDate(); - } - - // FORMATTING - - addFormatToken('M', ['MM', 2], 'Mo', function () { - return this.month() + 1; - }); - - addFormatToken('MMM', 0, 0, function (format) { - return this.localeData().monthsShort(this, format); - }); - - addFormatToken('MMMM', 0, 0, function (format) { - return this.localeData().months(this, format); - }); - - // ALIASES - - addUnitAlias('month', 'M'); - - // PRIORITY - - addUnitPriority('month', 8); - - // PARSING - - addRegexToken('M', match1to2); - addRegexToken('MM', match1to2, match2); - addRegexToken('MMM', function (isStrict, locale) { - return locale.monthsShortRegex(isStrict); - }); - addRegexToken('MMMM', function (isStrict, locale) { - return locale.monthsRegex(isStrict); - }); - - addParseToken(['M', 'MM'], function (input, array) { - array[MONTH] = toInt(input) - 1; - }); - - addParseToken(['MMM', 'MMMM'], function (input, array, config, token) { - var month = config._locale.monthsParse(input, token, config._strict); - // if we didn't find a month name, mark the date as invalid. - if (month != null) { - array[MONTH] = month; - } else { - getParsingFlags(config).invalidMonth = input; - } - }); - - // LOCALES - - var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s+)+MMMM?/; - var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'); - function localeMonths (m, format) { - if (!m) { - return this._months; - } - return isArray(this._months) ? this._months[m.month()] : - this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()]; - } - - var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'); - function localeMonthsShort (m, format) { - if (!m) { - return this._monthsShort; - } - return isArray(this._monthsShort) ? this._monthsShort[m.month()] : - this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; - } - - function units_month__handleStrictParse(monthName, format, strict) { - var i, ii, mom, llc = monthName.toLocaleLowerCase(); - if (!this._monthsParse) { - // this is not used - this._monthsParse = []; - this._longMonthsParse = []; - this._shortMonthsParse = []; - for (i = 0; i < 12; ++i) { - mom = create_utc__createUTC([2000, i]); - this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase(); - this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); - } - } - - if (strict) { - if (format === 'MMM') { - ii = indexOf.call(this._shortMonthsParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._longMonthsParse, llc); - return ii !== -1 ? ii : null; - } - } else { - if (format === 'MMM') { - ii = indexOf.call(this._shortMonthsParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._longMonthsParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._longMonthsParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._shortMonthsParse, llc); - return ii !== -1 ? ii : null; - } - } - } - - function localeMonthsParse (monthName, format, strict) { - var i, mom, regex; - - if (this._monthsParseExact) { - return units_month__handleStrictParse.call(this, monthName, format, strict); - } - - if (!this._monthsParse) { - this._monthsParse = []; - this._longMonthsParse = []; - this._shortMonthsParse = []; - } - - // TODO: add sorting - // Sorting makes sure if one month (or abbr) is a prefix of another - // see sorting in computeMonthsParse - for (i = 0; i < 12; i++) { - // make the regex if we don't have it already - mom = create_utc__createUTC([2000, i]); - if (strict && !this._longMonthsParse[i]) { - this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i'); - this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i'); - } - if (!strict && !this._monthsParse[i]) { - regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); - this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); - } - // test the regex - if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) { - return i; - } else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) { - return i; - } else if (!strict && this._monthsParse[i].test(monthName)) { - return i; - } - } - } - - // MOMENTS - - function setMonth (mom, value) { - var dayOfMonth; - - if (!mom.isValid()) { - // No op - return mom; - } - - if (typeof value === 'string') { - if (/^\d+$/.test(value)) { - value = toInt(value); - } else { - value = mom.localeData().monthsParse(value); - // TODO: Another silent failure? - if (typeof value !== 'number') { - return mom; - } - } - } - - dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); - mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); - return mom; - } - - function getSetMonth (value) { - if (value != null) { - setMonth(this, value); - utils_hooks__hooks.updateOffset(this, true); - return this; - } else { - return get_set__get(this, 'Month'); - } - } - - function getDaysInMonth () { - return daysInMonth(this.year(), this.month()); - } - - var defaultMonthsShortRegex = matchWord; - function monthsShortRegex (isStrict) { - if (this._monthsParseExact) { - if (!hasOwnProp(this, '_monthsRegex')) { - computeMonthsParse.call(this); - } - if (isStrict) { - return this._monthsShortStrictRegex; - } else { - return this._monthsShortRegex; - } - } else { - if (!hasOwnProp(this, '_monthsShortRegex')) { - this._monthsShortRegex = defaultMonthsShortRegex; - } - return this._monthsShortStrictRegex && isStrict ? - this._monthsShortStrictRegex : this._monthsShortRegex; - } - } - - var defaultMonthsRegex = matchWord; - function monthsRegex (isStrict) { - if (this._monthsParseExact) { - if (!hasOwnProp(this, '_monthsRegex')) { - computeMonthsParse.call(this); - } - if (isStrict) { - return this._monthsStrictRegex; - } else { - return this._monthsRegex; - } - } else { - if (!hasOwnProp(this, '_monthsRegex')) { - this._monthsRegex = defaultMonthsRegex; - } - return this._monthsStrictRegex && isStrict ? - this._monthsStrictRegex : this._monthsRegex; - } - } - - function computeMonthsParse () { - function cmpLenRev(a, b) { - return b.length - a.length; - } - - var shortPieces = [], longPieces = [], mixedPieces = [], - i, mom; - for (i = 0; i < 12; i++) { - // make the regex if we don't have it already - mom = create_utc__createUTC([2000, i]); - shortPieces.push(this.monthsShort(mom, '')); - longPieces.push(this.months(mom, '')); - mixedPieces.push(this.months(mom, '')); - mixedPieces.push(this.monthsShort(mom, '')); - } - // Sorting makes sure if one month (or abbr) is a prefix of another it - // will match the longer piece. - shortPieces.sort(cmpLenRev); - longPieces.sort(cmpLenRev); - mixedPieces.sort(cmpLenRev); - for (i = 0; i < 12; i++) { - shortPieces[i] = regexEscape(shortPieces[i]); - longPieces[i] = regexEscape(longPieces[i]); - } - for (i = 0; i < 24; i++) { - mixedPieces[i] = regexEscape(mixedPieces[i]); - } - - this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); - this._monthsShortRegex = this._monthsRegex; - this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); - this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); - } - - // FORMATTING - - addFormatToken('Y', 0, 0, function () { - var y = this.year(); - return y <= 9999 ? '' + y : '+' + y; - }); - - addFormatToken(0, ['YY', 2], 0, function () { - return this.year() % 100; - }); - - addFormatToken(0, ['YYYY', 4], 0, 'year'); - addFormatToken(0, ['YYYYY', 5], 0, 'year'); - addFormatToken(0, ['YYYYYY', 6, true], 0, 'year'); - - // ALIASES - - addUnitAlias('year', 'y'); - - // PRIORITIES - - addUnitPriority('year', 1); - - // PARSING - - addRegexToken('Y', matchSigned); - addRegexToken('YY', match1to2, match2); - addRegexToken('YYYY', match1to4, match4); - addRegexToken('YYYYY', match1to6, match6); - addRegexToken('YYYYYY', match1to6, match6); - - addParseToken(['YYYYY', 'YYYYYY'], YEAR); - addParseToken('YYYY', function (input, array) { - array[YEAR] = input.length === 2 ? utils_hooks__hooks.parseTwoDigitYear(input) : toInt(input); - }); - addParseToken('YY', function (input, array) { - array[YEAR] = utils_hooks__hooks.parseTwoDigitYear(input); - }); - addParseToken('Y', function (input, array) { - array[YEAR] = parseInt(input, 10); - }); - - // HELPERS - - function daysInYear(year) { - return isLeapYear(year) ? 366 : 365; - } - - function isLeapYear(year) { - return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; - } - - // HOOKS - - utils_hooks__hooks.parseTwoDigitYear = function (input) { - return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); - }; - - // MOMENTS - - var getSetYear = makeGetSet('FullYear', true); - - function getIsLeapYear () { - return isLeapYear(this.year()); - } - - function createDate (y, m, d, h, M, s, ms) { - //can't just apply() to create a date: - //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply - var date = new Date(y, m, d, h, M, s, ms); - - //the date constructor remaps years 0-99 to 1900-1999 - if (y < 100 && y >= 0 && isFinite(date.getFullYear())) { - date.setFullYear(y); - } - return date; - } - - function createUTCDate (y) { - var date = new Date(Date.UTC.apply(null, arguments)); - - //the Date.UTC function remaps years 0-99 to 1900-1999 - if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) { - date.setUTCFullYear(y); - } - return date; - } - - // start-of-first-week - start-of-year - function firstWeekOffset(year, dow, doy) { - var // first-week day -- which january is always in the first week (4 for iso, 1 for other) - fwd = 7 + dow - doy, - // first-week day local weekday -- which local weekday is fwd - fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; - - return -fwdlw + fwd - 1; - } - - //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday - function dayOfYearFromWeeks(year, week, weekday, dow, doy) { - var localWeekday = (7 + weekday - dow) % 7, - weekOffset = firstWeekOffset(year, dow, doy), - dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, - resYear, resDayOfYear; - - if (dayOfYear <= 0) { - resYear = year - 1; - resDayOfYear = daysInYear(resYear) + dayOfYear; - } else if (dayOfYear > daysInYear(year)) { - resYear = year + 1; - resDayOfYear = dayOfYear - daysInYear(year); - } else { - resYear = year; - resDayOfYear = dayOfYear; - } - - return { - year: resYear, - dayOfYear: resDayOfYear - }; - } - - function weekOfYear(mom, dow, doy) { - var weekOffset = firstWeekOffset(mom.year(), dow, doy), - week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, - resWeek, resYear; - - if (week < 1) { - resYear = mom.year() - 1; - resWeek = week + weeksInYear(resYear, dow, doy); - } else if (week > weeksInYear(mom.year(), dow, doy)) { - resWeek = week - weeksInYear(mom.year(), dow, doy); - resYear = mom.year() + 1; - } else { - resYear = mom.year(); - resWeek = week; - } - - return { - week: resWeek, - year: resYear - }; - } - - function weeksInYear(year, dow, doy) { - var weekOffset = firstWeekOffset(year, dow, doy), - weekOffsetNext = firstWeekOffset(year + 1, dow, doy); - return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; - } - - // FORMATTING - - addFormatToken('w', ['ww', 2], 'wo', 'week'); - addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek'); - - // ALIASES - - addUnitAlias('week', 'w'); - addUnitAlias('isoWeek', 'W'); - - // PRIORITIES - - addUnitPriority('week', 5); - addUnitPriority('isoWeek', 5); - - // PARSING - - addRegexToken('w', match1to2); - addRegexToken('ww', match1to2, match2); - addRegexToken('W', match1to2); - addRegexToken('WW', match1to2, match2); - - addWeekParseToken(['w', 'ww', 'W', 'WW'], function (input, week, config, token) { - week[token.substr(0, 1)] = toInt(input); - }); - - // HELPERS - - // LOCALES - - function localeWeek (mom) { - return weekOfYear(mom, this._week.dow, this._week.doy).week; - } - - var defaultLocaleWeek = { - dow : 0, // Sunday is the first day of the week. - doy : 6 // The week that contains Jan 1st is the first week of the year. - }; - - function localeFirstDayOfWeek () { - return this._week.dow; - } - - function localeFirstDayOfYear () { - return this._week.doy; - } - - // MOMENTS - - function getSetWeek (input) { - var week = this.localeData().week(this); - return input == null ? week : this.add((input - week) * 7, 'd'); - } - - function getSetISOWeek (input) { - var week = weekOfYear(this, 1, 4).week; - return input == null ? week : this.add((input - week) * 7, 'd'); - } - - // FORMATTING - - addFormatToken('d', 0, 'do', 'day'); - - addFormatToken('dd', 0, 0, function (format) { - return this.localeData().weekdaysMin(this, format); - }); - - addFormatToken('ddd', 0, 0, function (format) { - return this.localeData().weekdaysShort(this, format); - }); - - addFormatToken('dddd', 0, 0, function (format) { - return this.localeData().weekdays(this, format); - }); - - addFormatToken('e', 0, 0, 'weekday'); - addFormatToken('E', 0, 0, 'isoWeekday'); - - // ALIASES - - addUnitAlias('day', 'd'); - addUnitAlias('weekday', 'e'); - addUnitAlias('isoWeekday', 'E'); - - // PRIORITY - addUnitPriority('day', 11); - addUnitPriority('weekday', 11); - addUnitPriority('isoWeekday', 11); - - // PARSING - - addRegexToken('d', match1to2); - addRegexToken('e', match1to2); - addRegexToken('E', match1to2); - addRegexToken('dd', function (isStrict, locale) { - return locale.weekdaysMinRegex(isStrict); - }); - addRegexToken('ddd', function (isStrict, locale) { - return locale.weekdaysShortRegex(isStrict); - }); - addRegexToken('dddd', function (isStrict, locale) { - return locale.weekdaysRegex(isStrict); - }); - - addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) { - var weekday = config._locale.weekdaysParse(input, token, config._strict); - // if we didn't get a weekday name, mark the date as invalid - if (weekday != null) { - week.d = weekday; - } else { - getParsingFlags(config).invalidWeekday = input; - } - }); - - addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) { - week[token] = toInt(input); - }); - - // HELPERS - - function parseWeekday(input, locale) { - if (typeof input !== 'string') { - return input; - } - - if (!isNaN(input)) { - return parseInt(input, 10); - } - - input = locale.weekdaysParse(input); - if (typeof input === 'number') { - return input; - } - - return null; - } - - function parseIsoWeekday(input, locale) { - if (typeof input === 'string') { - return locale.weekdaysParse(input) % 7 || 7; - } - return isNaN(input) ? null : input; - } - - // LOCALES - - var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'); - function localeWeekdays (m, format) { - if (!m) { - return this._weekdays; - } - return isArray(this._weekdays) ? this._weekdays[m.day()] : - this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()]; - } - - var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'); - function localeWeekdaysShort (m) { - return (m) ? this._weekdaysShort[m.day()] : this._weekdaysShort; - } - - var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'); - function localeWeekdaysMin (m) { - return (m) ? this._weekdaysMin[m.day()] : this._weekdaysMin; - } - - function day_of_week__handleStrictParse(weekdayName, format, strict) { - var i, ii, mom, llc = weekdayName.toLocaleLowerCase(); - if (!this._weekdaysParse) { - this._weekdaysParse = []; - this._shortWeekdaysParse = []; - this._minWeekdaysParse = []; - - for (i = 0; i < 7; ++i) { - mom = create_utc__createUTC([2000, 1]).day(i); - this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase(); - this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase(); - this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); - } - } - - if (strict) { - if (format === 'dddd') { - ii = indexOf.call(this._weekdaysParse, llc); - return ii !== -1 ? ii : null; - } else if (format === 'ddd') { - ii = indexOf.call(this._shortWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } - } else { - if (format === 'dddd') { - ii = indexOf.call(this._weekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._shortWeekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else if (format === 'ddd') { - ii = indexOf.call(this._shortWeekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._weekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._minWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } else { - ii = indexOf.call(this._minWeekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._weekdaysParse, llc); - if (ii !== -1) { - return ii; - } - ii = indexOf.call(this._shortWeekdaysParse, llc); - return ii !== -1 ? ii : null; - } - } - } - - function localeWeekdaysParse (weekdayName, format, strict) { - var i, mom, regex; - - if (this._weekdaysParseExact) { - return day_of_week__handleStrictParse.call(this, weekdayName, format, strict); - } - - if (!this._weekdaysParse) { - this._weekdaysParse = []; - this._minWeekdaysParse = []; - this._shortWeekdaysParse = []; - this._fullWeekdaysParse = []; - } - - for (i = 0; i < 7; i++) { - // make the regex if we don't have it already - - mom = create_utc__createUTC([2000, 1]).day(i); - if (strict && !this._fullWeekdaysParse[i]) { - this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i'); - this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i'); - this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i'); - } - if (!this._weekdaysParse[i]) { - regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); - this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); - } - // test the regex - if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) { - return i; - } else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) { - return i; - } else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) { - return i; - } else if (!strict && this._weekdaysParse[i].test(weekdayName)) { - return i; - } - } - } - - // MOMENTS - - function getSetDayOfWeek (input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } - var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); - if (input != null) { - input = parseWeekday(input, this.localeData()); - return this.add(input - day, 'd'); - } else { - return day; - } - } - - function getSetLocaleDayOfWeek (input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } - var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; - return input == null ? weekday : this.add(input - weekday, 'd'); - } - - function getSetISODayOfWeek (input) { - if (!this.isValid()) { - return input != null ? this : NaN; - } - - // behaves the same as moment#day except - // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) - // as a setter, sunday should belong to the previous week. - - if (input != null) { - var weekday = parseIsoWeekday(input, this.localeData()); - return this.day(this.day() % 7 ? weekday : weekday - 7); - } else { - return this.day() || 7; - } - } - - var defaultWeekdaysRegex = matchWord; - function weekdaysRegex (isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - if (isStrict) { - return this._weekdaysStrictRegex; - } else { - return this._weekdaysRegex; - } - } else { - if (!hasOwnProp(this, '_weekdaysRegex')) { - this._weekdaysRegex = defaultWeekdaysRegex; - } - return this._weekdaysStrictRegex && isStrict ? - this._weekdaysStrictRegex : this._weekdaysRegex; - } - } - - var defaultWeekdaysShortRegex = matchWord; - function weekdaysShortRegex (isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - if (isStrict) { - return this._weekdaysShortStrictRegex; - } else { - return this._weekdaysShortRegex; - } - } else { - if (!hasOwnProp(this, '_weekdaysShortRegex')) { - this._weekdaysShortRegex = defaultWeekdaysShortRegex; - } - return this._weekdaysShortStrictRegex && isStrict ? - this._weekdaysShortStrictRegex : this._weekdaysShortRegex; - } - } - - var defaultWeekdaysMinRegex = matchWord; - function weekdaysMinRegex (isStrict) { - if (this._weekdaysParseExact) { - if (!hasOwnProp(this, '_weekdaysRegex')) { - computeWeekdaysParse.call(this); - } - if (isStrict) { - return this._weekdaysMinStrictRegex; - } else { - return this._weekdaysMinRegex; - } - } else { - if (!hasOwnProp(this, '_weekdaysMinRegex')) { - this._weekdaysMinRegex = defaultWeekdaysMinRegex; - } - return this._weekdaysMinStrictRegex && isStrict ? - this._weekdaysMinStrictRegex : this._weekdaysMinRegex; - } - } - - - function computeWeekdaysParse () { - function cmpLenRev(a, b) { - return b.length - a.length; - } - - var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], - i, mom, minp, shortp, longp; - for (i = 0; i < 7; i++) { - // make the regex if we don't have it already - mom = create_utc__createUTC([2000, 1]).day(i); - minp = this.weekdaysMin(mom, ''); - shortp = this.weekdaysShort(mom, ''); - longp = this.weekdays(mom, ''); - minPieces.push(minp); - shortPieces.push(shortp); - longPieces.push(longp); - mixedPieces.push(minp); - mixedPieces.push(shortp); - mixedPieces.push(longp); - } - // Sorting makes sure if one weekday (or abbr) is a prefix of another it - // will match the longer piece. - minPieces.sort(cmpLenRev); - shortPieces.sort(cmpLenRev); - longPieces.sort(cmpLenRev); - mixedPieces.sort(cmpLenRev); - for (i = 0; i < 7; i++) { - shortPieces[i] = regexEscape(shortPieces[i]); - longPieces[i] = regexEscape(longPieces[i]); - mixedPieces[i] = regexEscape(mixedPieces[i]); - } - - this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); - this._weekdaysShortRegex = this._weekdaysRegex; - this._weekdaysMinRegex = this._weekdaysRegex; - - this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); - this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); - this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i'); - } - - // FORMATTING - - function hFormat() { - return this.hours() % 12 || 12; - } - - function kFormat() { - return this.hours() || 24; - } - - addFormatToken('H', ['HH', 2], 0, 'hour'); - addFormatToken('h', ['hh', 2], 0, hFormat); - addFormatToken('k', ['kk', 2], 0, kFormat); - - addFormatToken('hmm', 0, 0, function () { - return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); - }); - - addFormatToken('hmmss', 0, 0, function () { - return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + - zeroFill(this.seconds(), 2); - }); - - addFormatToken('Hmm', 0, 0, function () { - return '' + this.hours() + zeroFill(this.minutes(), 2); - }); - - addFormatToken('Hmmss', 0, 0, function () { - return '' + this.hours() + zeroFill(this.minutes(), 2) + - zeroFill(this.seconds(), 2); - }); - - function meridiem (token, lowercase) { - addFormatToken(token, 0, 0, function () { - return this.localeData().meridiem(this.hours(), this.minutes(), lowercase); - }); - } - - meridiem('a', true); - meridiem('A', false); - - // ALIASES - - addUnitAlias('hour', 'h'); - - // PRIORITY - addUnitPriority('hour', 13); - - // PARSING - - function matchMeridiem (isStrict, locale) { - return locale._meridiemParse; - } - - addRegexToken('a', matchMeridiem); - addRegexToken('A', matchMeridiem); - addRegexToken('H', match1to2); - addRegexToken('h', match1to2); - addRegexToken('HH', match1to2, match2); - addRegexToken('hh', match1to2, match2); - - addRegexToken('hmm', match3to4); - addRegexToken('hmmss', match5to6); - addRegexToken('Hmm', match3to4); - addRegexToken('Hmmss', match5to6); - - addParseToken(['H', 'HH'], HOUR); - addParseToken(['a', 'A'], function (input, array, config) { - config._isPm = config._locale.isPM(input); - config._meridiem = input; - }); - addParseToken(['h', 'hh'], function (input, array, config) { - array[HOUR] = toInt(input); - getParsingFlags(config).bigHour = true; - }); - addParseToken('hmm', function (input, array, config) { - var pos = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos)); - array[MINUTE] = toInt(input.substr(pos)); - getParsingFlags(config).bigHour = true; - }); - addParseToken('hmmss', function (input, array, config) { - var pos1 = input.length - 4; - var pos2 = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos1)); - array[MINUTE] = toInt(input.substr(pos1, 2)); - array[SECOND] = toInt(input.substr(pos2)); - getParsingFlags(config).bigHour = true; - }); - addParseToken('Hmm', function (input, array, config) { - var pos = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos)); - array[MINUTE] = toInt(input.substr(pos)); - }); - addParseToken('Hmmss', function (input, array, config) { - var pos1 = input.length - 4; - var pos2 = input.length - 2; - array[HOUR] = toInt(input.substr(0, pos1)); - array[MINUTE] = toInt(input.substr(pos1, 2)); - array[SECOND] = toInt(input.substr(pos2)); - }); - - // LOCALES - - function localeIsPM (input) { - // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays - // Using charAt should be more compatible. - return ((input + '').toLowerCase().charAt(0) === 'p'); - } - - var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i; - function localeMeridiem (hours, minutes, isLower) { - if (hours > 11) { - return isLower ? 'pm' : 'PM'; - } else { - return isLower ? 'am' : 'AM'; - } - } - - - // MOMENTS - - // Setting the hour should keep the time, because the user explicitly - // specified which hour he wants. So trying to maintain the same hour (in - // a new timezone) makes sense. Adding/subtracting hours does not follow - // this rule. - var getSetHour = makeGetSet('Hours', true); - - var baseConfig = { - calendar: defaultCalendar, - longDateFormat: defaultLongDateFormat, - invalidDate: defaultInvalidDate, - ordinal: defaultOrdinal, - ordinalParse: defaultOrdinalParse, - relativeTime: defaultRelativeTime, - - months: defaultLocaleMonths, - monthsShort: defaultLocaleMonthsShort, - - week: defaultLocaleWeek, - - weekdays: defaultLocaleWeekdays, - weekdaysMin: defaultLocaleWeekdaysMin, - weekdaysShort: defaultLocaleWeekdaysShort, - - meridiemParse: defaultLocaleMeridiemParse - }; - - // internal storage for locale config files - var locales = {}; - var globalLocale; - - function normalizeLocale(key) { - return key ? key.toLowerCase().replace('_', '-') : key; - } - - // pick the locale from the array - // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each - // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root - function chooseLocale(names) { - var i = 0, j, next, locale, split; - - while (i < names.length) { - split = normalizeLocale(names[i]).split('-'); - j = split.length; - next = normalizeLocale(names[i + 1]); - next = next ? next.split('-') : null; - while (j > 0) { - locale = loadLocale(split.slice(0, j).join('-')); - if (locale) { - return locale; - } - if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) { - //the next array item is better than a shallower substring of this one - break; - } - j--; - } - i++; - } - return null; - } - - function loadLocale(name) { - var oldLocale = null; - // TODO: Find a better way to register and load all the locales in Node - if (!locales[name] && (typeof module !== 'undefined') && - module && module.exports) { - try { - oldLocale = globalLocale._abbr; - require('./locale/' + name); - // because defineLocale currently also sets the global locale, we - // want to undo that for lazy loaded locales - locale_locales__getSetGlobalLocale(oldLocale); - } catch (e) { } - } - return locales[name]; - } - - // This function will load locale and then set the global locale. If - // no arguments are passed in, it will simply return the current global - // locale key. - function locale_locales__getSetGlobalLocale (key, values) { - var data; - if (key) { - if (isUndefined(values)) { - data = locale_locales__getLocale(key); - } - else { - data = defineLocale(key, values); - } - - if (data) { - // moment.duration._locale = moment._locale = data; - globalLocale = data; - } - } - - return globalLocale._abbr; - } - - function defineLocale (name, config) { - if (config !== null) { - var parentConfig = baseConfig; - config.abbr = name; - if (locales[name] != null) { - deprecateSimple('defineLocaleOverride', - 'use moment.updateLocale(localeName, config) to change ' + - 'an existing locale. moment.defineLocale(localeName, ' + - 'config) should only be used for creating a new locale ' + - 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'); - parentConfig = locales[name]._config; - } else if (config.parentLocale != null) { - if (locales[config.parentLocale] != null) { - parentConfig = locales[config.parentLocale]._config; - } else { - // treat as if there is no base config - deprecateSimple('parentLocaleUndefined', - 'specified parentLocale is not defined yet. See http://momentjs.com/guides/#/warnings/parent-locale/'); - } - } - locales[name] = new Locale(mergeConfigs(parentConfig, config)); - - // backwards compat for now: also set the locale - locale_locales__getSetGlobalLocale(name); - - return locales[name]; - } else { - // useful for testing - delete locales[name]; - return null; - } - } - - function updateLocale(name, config) { - if (config != null) { - var locale, parentConfig = baseConfig; - // MERGE - if (locales[name] != null) { - parentConfig = locales[name]._config; - } - config = mergeConfigs(parentConfig, config); - locale = new Locale(config); - locale.parentLocale = locales[name]; - locales[name] = locale; - - // backwards compat for now: also set the locale - locale_locales__getSetGlobalLocale(name); - } else { - // pass null for config to unupdate, useful for tests - if (locales[name] != null) { - if (locales[name].parentLocale != null) { - locales[name] = locales[name].parentLocale; - } else if (locales[name] != null) { - delete locales[name]; - } - } - } - return locales[name]; - } - - // returns locale data - function locale_locales__getLocale (key) { - var locale; - - if (key && key._locale && key._locale._abbr) { - key = key._locale._abbr; - } - - if (!key) { - return globalLocale; - } - - if (!isArray(key)) { - //short-circuit everything else - locale = loadLocale(key); - if (locale) { - return locale; - } - key = [key]; - } - - return chooseLocale(key); - } - - function locale_locales__listLocales() { - return keys(locales); - } - - function checkOverflow (m) { - var overflow; - var a = m._a; - - if (a && getParsingFlags(m).overflow === -2) { - overflow = - a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : - a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : - a[HOUR] < 0 || a[HOUR] > 24 || (a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0)) ? HOUR : - a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : - a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : - a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : - -1; - - if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) { - overflow = DATE; - } - if (getParsingFlags(m)._overflowWeeks && overflow === -1) { - overflow = WEEK; - } - if (getParsingFlags(m)._overflowWeekday && overflow === -1) { - overflow = WEEKDAY; - } - - getParsingFlags(m).overflow = overflow; - } - - return m; - } - - // iso 8601 regex - // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) - var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/; - var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?/; - - var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/; - - var isoDates = [ - ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/], - ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/], - ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/], - ['GGGG-[W]WW', /\d{4}-W\d\d/, false], - ['YYYY-DDD', /\d{4}-\d{3}/], - ['YYYY-MM', /\d{4}-\d\d/, false], - ['YYYYYYMMDD', /[+-]\d{10}/], - ['YYYYMMDD', /\d{8}/], - // YYYYMM is NOT allowed by the standard - ['GGGG[W]WWE', /\d{4}W\d{3}/], - ['GGGG[W]WW', /\d{4}W\d{2}/, false], - ['YYYYDDD', /\d{7}/] - ]; - - // iso time formats and regexes - var isoTimes = [ - ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/], - ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/], - ['HH:mm:ss', /\d\d:\d\d:\d\d/], - ['HH:mm', /\d\d:\d\d/], - ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/], - ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/], - ['HHmmss', /\d\d\d\d\d\d/], - ['HHmm', /\d\d\d\d/], - ['HH', /\d\d/] - ]; - - var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i; - - // date from iso format - function configFromISO(config) { - var i, l, - string = config._i, - match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), - allowTime, dateFormat, timeFormat, tzFormat; - - if (match) { - getParsingFlags(config).iso = true; - - for (i = 0, l = isoDates.length; i < l; i++) { - if (isoDates[i][1].exec(match[1])) { - dateFormat = isoDates[i][0]; - allowTime = isoDates[i][2] !== false; - break; - } - } - if (dateFormat == null) { - config._isValid = false; - return; - } - if (match[3]) { - for (i = 0, l = isoTimes.length; i < l; i++) { - if (isoTimes[i][1].exec(match[3])) { - // match[2] should be 'T' or space - timeFormat = (match[2] || ' ') + isoTimes[i][0]; - break; - } - } - if (timeFormat == null) { - config._isValid = false; - return; - } - } - if (!allowTime && timeFormat != null) { - config._isValid = false; - return; - } - if (match[4]) { - if (tzRegex.exec(match[4])) { - tzFormat = 'Z'; - } else { - config._isValid = false; - return; - } - } - config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); - configFromStringAndFormat(config); - } else { - config._isValid = false; - } - } - - // date from iso format or fallback - function configFromString(config) { - var matched = aspNetJsonRegex.exec(config._i); - - if (matched !== null) { - config._d = new Date(+matched[1]); - return; - } - - configFromISO(config); - if (config._isValid === false) { - delete config._isValid; - utils_hooks__hooks.createFromInputFallback(config); - } - } - - utils_hooks__hooks.createFromInputFallback = deprecate( - 'value provided is not in a recognized ISO format. moment construction falls back to js Date(), ' + - 'which is not reliable across all browsers and versions. Non ISO date formats are ' + - 'discouraged and will be removed in an upcoming major release. Please refer to ' + - 'http://momentjs.com/guides/#/warnings/js-date/ for more info.', - function (config) { - config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); - } - ); - - // Pick the first defined of two or three arguments. - function defaults(a, b, c) { - if (a != null) { - return a; - } - if (b != null) { - return b; - } - return c; - } - - function currentDateArray(config) { - // hooks is actually the exported moment object - var nowValue = new Date(utils_hooks__hooks.now()); - if (config._useUTC) { - return [nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate()]; - } - return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()]; - } - - // convert an array to a date. - // the array should mirror the parameters below - // note: all values past the year are optional and will default to the lowest possible value. - // [year, month, day , hour, minute, second, millisecond] - function configFromArray (config) { - var i, date, input = [], currentDate, yearToUse; - - if (config._d) { - return; - } - - currentDate = currentDateArray(config); - - //compute day of the year from weeks and weekdays - if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { - dayOfYearFromWeekInfo(config); - } - - //if the day of the year is set, figure out what it is - if (config._dayOfYear) { - yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); - - if (config._dayOfYear > daysInYear(yearToUse)) { - getParsingFlags(config)._overflowDayOfYear = true; - } - - date = createUTCDate(yearToUse, 0, config._dayOfYear); - config._a[MONTH] = date.getUTCMonth(); - config._a[DATE] = date.getUTCDate(); - } - - // Default to current date. - // * if no year, month, day of month are given, default to today - // * if day of month is given, default month and year - // * if month is given, default only year - // * if year is given, don't default anything - for (i = 0; i < 3 && config._a[i] == null; ++i) { - config._a[i] = input[i] = currentDate[i]; - } - - // Zero out whatever was not defaulted, including time - for (; i < 7; i++) { - config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; - } - - // Check for 24:00:00.000 - if (config._a[HOUR] === 24 && - config._a[MINUTE] === 0 && - config._a[SECOND] === 0 && - config._a[MILLISECOND] === 0) { - config._nextDay = true; - config._a[HOUR] = 0; - } - - config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); - // Apply timezone offset from input. The actual utcOffset can be changed - // with parseZone. - if (config._tzm != null) { - config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); - } - - if (config._nextDay) { - config._a[HOUR] = 24; - } - } - - function dayOfYearFromWeekInfo(config) { - var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow; - - w = config._w; - if (w.GG != null || w.W != null || w.E != null) { - dow = 1; - doy = 4; - - // TODO: We need to take the current isoWeekYear, but that depends on - // how we interpret now (local, utc, fixed offset). So create - // a now version of current config (take local/utc/offset flags, and - // create now). - weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(local__createLocal(), 1, 4).year); - week = defaults(w.W, 1); - weekday = defaults(w.E, 1); - if (weekday < 1 || weekday > 7) { - weekdayOverflow = true; - } - } else { - dow = config._locale._week.dow; - doy = config._locale._week.doy; - - weekYear = defaults(w.gg, config._a[YEAR], weekOfYear(local__createLocal(), dow, doy).year); - week = defaults(w.w, 1); - - if (w.d != null) { - // weekday -- low day numbers are considered next week - weekday = w.d; - if (weekday < 0 || weekday > 6) { - weekdayOverflow = true; - } - } else if (w.e != null) { - // local weekday -- counting starts from begining of week - weekday = w.e + dow; - if (w.e < 0 || w.e > 6) { - weekdayOverflow = true; - } - } else { - // default to begining of week - weekday = dow; - } - } - if (week < 1 || week > weeksInYear(weekYear, dow, doy)) { - getParsingFlags(config)._overflowWeeks = true; - } else if (weekdayOverflow != null) { - getParsingFlags(config)._overflowWeekday = true; - } else { - temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); - config._a[YEAR] = temp.year; - config._dayOfYear = temp.dayOfYear; - } - } - - // constant that refers to the ISO standard - utils_hooks__hooks.ISO_8601 = function () {}; - - // date from string and format string - function configFromStringAndFormat(config) { - // TODO: Move this to another part of the creation flow to prevent circular deps - if (config._f === utils_hooks__hooks.ISO_8601) { - configFromISO(config); - return; - } - - config._a = []; - getParsingFlags(config).empty = true; - - // This array is used to make a Date, either with `new Date` or `Date.UTC` - var string = '' + config._i, - i, parsedInput, tokens, token, skipped, - stringLength = string.length, - totalParsedInputLength = 0; - - tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; - - for (i = 0; i < tokens.length; i++) { - token = tokens[i]; - parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; - // console.log('token', token, 'parsedInput', parsedInput, - // 'regex', getParseRegexForToken(token, config)); - if (parsedInput) { - skipped = string.substr(0, string.indexOf(parsedInput)); - if (skipped.length > 0) { - getParsingFlags(config).unusedInput.push(skipped); - } - string = string.slice(string.indexOf(parsedInput) + parsedInput.length); - totalParsedInputLength += parsedInput.length; - } - // don't parse if it's not a known token - if (formatTokenFunctions[token]) { - if (parsedInput) { - getParsingFlags(config).empty = false; - } - else { - getParsingFlags(config).unusedTokens.push(token); - } - addTimeToArrayFromToken(token, parsedInput, config); - } - else if (config._strict && !parsedInput) { - getParsingFlags(config).unusedTokens.push(token); - } - } - - // add remaining unparsed input length to the string - getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; - if (string.length > 0) { - getParsingFlags(config).unusedInput.push(string); - } - - // clear _12h flag if hour is <= 12 - if (config._a[HOUR] <= 12 && - getParsingFlags(config).bigHour === true && - config._a[HOUR] > 0) { - getParsingFlags(config).bigHour = undefined; - } - - getParsingFlags(config).parsedDateParts = config._a.slice(0); - getParsingFlags(config).meridiem = config._meridiem; - // handle meridiem - config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); - - configFromArray(config); - checkOverflow(config); - } - - - function meridiemFixWrap (locale, hour, meridiem) { - var isPm; - - if (meridiem == null) { - // nothing to do - return hour; - } - if (locale.meridiemHour != null) { - return locale.meridiemHour(hour, meridiem); - } else if (locale.isPM != null) { - // Fallback - isPm = locale.isPM(meridiem); - if (isPm && hour < 12) { - hour += 12; - } - if (!isPm && hour === 12) { - hour = 0; - } - return hour; - } else { - // this is not supposed to happen - return hour; - } - } - - // date from string and array of format strings - function configFromStringAndArray(config) { - var tempConfig, - bestMoment, - - scoreToBeat, - i, - currentScore; - - if (config._f.length === 0) { - getParsingFlags(config).invalidFormat = true; - config._d = new Date(NaN); - return; - } - - for (i = 0; i < config._f.length; i++) { - currentScore = 0; - tempConfig = copyConfig({}, config); - if (config._useUTC != null) { - tempConfig._useUTC = config._useUTC; - } - tempConfig._f = config._f[i]; - configFromStringAndFormat(tempConfig); - - if (!valid__isValid(tempConfig)) { - continue; - } - - // if there is any input that was not parsed add a penalty for that format - currentScore += getParsingFlags(tempConfig).charsLeftOver; - - //or tokens - currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; - - getParsingFlags(tempConfig).score = currentScore; - - if (scoreToBeat == null || currentScore < scoreToBeat) { - scoreToBeat = currentScore; - bestMoment = tempConfig; - } - } - - extend(config, bestMoment || tempConfig); - } - - function configFromObject(config) { - if (config._d) { - return; - } - - var i = normalizeObjectUnits(config._i); - config._a = map([i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond], function (obj) { - return obj && parseInt(obj, 10); - }); - - configFromArray(config); - } - - function createFromConfig (config) { - var res = new Moment(checkOverflow(prepareConfig(config))); - if (res._nextDay) { - // Adding is smart enough around DST - res.add(1, 'd'); - res._nextDay = undefined; - } - - return res; - } - - function prepareConfig (config) { - var input = config._i, - format = config._f; - - config._locale = config._locale || locale_locales__getLocale(config._l); - - if (input === null || (format === undefined && input === '')) { - return valid__createInvalid({nullInput: true}); - } - - if (typeof input === 'string') { - config._i = input = config._locale.preparse(input); - } - - if (isMoment(input)) { - return new Moment(checkOverflow(input)); - } else if (isArray(format)) { - configFromStringAndArray(config); - } else if (isDate(input)) { - config._d = input; - } else if (format) { - configFromStringAndFormat(config); - } else { - configFromInput(config); - } - - if (!valid__isValid(config)) { - config._d = null; - } - - return config; - } - - function configFromInput(config) { - var input = config._i; - if (input === undefined) { - config._d = new Date(utils_hooks__hooks.now()); - } else if (isDate(input)) { - config._d = new Date(input.valueOf()); - } else if (typeof input === 'string') { - configFromString(config); - } else if (isArray(input)) { - config._a = map(input.slice(0), function (obj) { - return parseInt(obj, 10); - }); - configFromArray(config); - } else if (typeof(input) === 'object') { - configFromObject(config); - } else if (typeof(input) === 'number') { - // from milliseconds - config._d = new Date(input); - } else { - utils_hooks__hooks.createFromInputFallback(config); - } - } - - function createLocalOrUTC (input, format, locale, strict, isUTC) { - var c = {}; - - if (typeof(locale) === 'boolean') { - strict = locale; - locale = undefined; - } - - if ((isObject(input) && isObjectEmpty(input)) || - (isArray(input) && input.length === 0)) { - input = undefined; - } - // object construction must be done this way. - // https://github.com/moment/moment/issues/1423 - c._isAMomentObject = true; - c._useUTC = c._isUTC = isUTC; - c._l = locale; - c._i = input; - c._f = format; - c._strict = strict; - - return createFromConfig(c); - } - - function local__createLocal (input, format, locale, strict) { - return createLocalOrUTC(input, format, locale, strict, false); - } - - var prototypeMin = deprecate( - 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', - function () { - var other = local__createLocal.apply(null, arguments); - if (this.isValid() && other.isValid()) { - return other < this ? this : other; - } else { - return valid__createInvalid(); - } - } - ); - - var prototypeMax = deprecate( - 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', - function () { - var other = local__createLocal.apply(null, arguments); - if (this.isValid() && other.isValid()) { - return other > this ? this : other; - } else { - return valid__createInvalid(); - } - } - ); - - // Pick a moment m from moments so that m[fn](other) is true for all - // other. This relies on the function fn to be transitive. - // - // moments should either be an array of moment objects or an array, whose - // first element is an array of moment objects. - function pickBy(fn, moments) { - var res, i; - if (moments.length === 1 && isArray(moments[0])) { - moments = moments[0]; - } - if (!moments.length) { - return local__createLocal(); - } - res = moments[0]; - for (i = 1; i < moments.length; ++i) { - if (!moments[i].isValid() || moments[i][fn](res)) { - res = moments[i]; - } - } - return res; - } - - // TODO: Use [].sort instead? - function min () { - var args = [].slice.call(arguments, 0); - - return pickBy('isBefore', args); - } - - function max () { - var args = [].slice.call(arguments, 0); - - return pickBy('isAfter', args); - } - - var now = function () { - return Date.now ? Date.now() : +(new Date()); - }; - - function Duration (duration) { - var normalizedInput = normalizeObjectUnits(duration), - years = normalizedInput.year || 0, - quarters = normalizedInput.quarter || 0, - months = normalizedInput.month || 0, - weeks = normalizedInput.week || 0, - days = normalizedInput.day || 0, - hours = normalizedInput.hour || 0, - minutes = normalizedInput.minute || 0, - seconds = normalizedInput.second || 0, - milliseconds = normalizedInput.millisecond || 0; - - // representation for dateAddRemove - this._milliseconds = +milliseconds + - seconds * 1e3 + // 1000 - minutes * 6e4 + // 1000 * 60 - hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 - // Because of dateAddRemove treats 24 hours as different from a - // day when working around DST, we need to store them separately - this._days = +days + - weeks * 7; - // It is impossible translate months into days without knowing - // which months you are are talking about, so we have to store - // it separately. - this._months = +months + - quarters * 3 + - years * 12; - - this._data = {}; - - this._locale = locale_locales__getLocale(); - - this._bubble(); - } - - function isDuration (obj) { - return obj instanceof Duration; - } - - function absRound (number) { - if (number < 0) { - return Math.round(-1 * number) * -1; - } else { - return Math.round(number); - } - } - - // FORMATTING - - function offset (token, separator) { - addFormatToken(token, 0, 0, function () { - var offset = this.utcOffset(); - var sign = '+'; - if (offset < 0) { - offset = -offset; - sign = '-'; - } - return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~(offset) % 60, 2); - }); - } - - offset('Z', ':'); - offset('ZZ', ''); - - // PARSING - - addRegexToken('Z', matchShortOffset); - addRegexToken('ZZ', matchShortOffset); - addParseToken(['Z', 'ZZ'], function (input, array, config) { - config._useUTC = true; - config._tzm = offsetFromString(matchShortOffset, input); - }); - - // HELPERS - - // timezone chunker - // '+10:00' > ['10', '00'] - // '-1530' > ['-15', '30'] - var chunkOffset = /([\+\-]|\d\d)/gi; - - function offsetFromString(matcher, string) { - var matches = ((string || '').match(matcher) || []); - var chunk = matches[matches.length - 1] || []; - var parts = (chunk + '').match(chunkOffset) || ['-', 0, 0]; - var minutes = +(parts[1] * 60) + toInt(parts[2]); - - return parts[0] === '+' ? minutes : -minutes; - } - - // Return a moment from input, that is local/utc/zone equivalent to model. - function cloneWithOffset(input, model) { - var res, diff; - if (model._isUTC) { - res = model.clone(); - diff = (isMoment(input) || isDate(input) ? input.valueOf() : local__createLocal(input).valueOf()) - res.valueOf(); - // Use low-level api, because this fn is low-level api. - res._d.setTime(res._d.valueOf() + diff); - utils_hooks__hooks.updateOffset(res, false); - return res; - } else { - return local__createLocal(input).local(); - } - } - - function getDateOffset (m) { - // On Firefox.24 Date#getTimezoneOffset returns a floating point. - // https://github.com/moment/moment/pull/1871 - return -Math.round(m._d.getTimezoneOffset() / 15) * 15; - } - - // HOOKS - - // This function will be called whenever a moment is mutated. - // It is intended to keep the offset in sync with the timezone. - utils_hooks__hooks.updateOffset = function () {}; - - // MOMENTS - - // keepLocalTime = true means only change the timezone, without - // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> - // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset - // +0200, so we adjust the time as needed, to be valid. - // - // Keeping the time actually adds/subtracts (one hour) - // from the actual represented time. That is why we call updateOffset - // a second time. In case it wants us to change the offset again - // _changeInProgress == true case, then we have to adjust, because - // there is no such time in the given timezone. - function getSetOffset (input, keepLocalTime) { - var offset = this._offset || 0, - localAdjust; - if (!this.isValid()) { - return input != null ? this : NaN; - } - if (input != null) { - if (typeof input === 'string') { - input = offsetFromString(matchShortOffset, input); - } else if (Math.abs(input) < 16) { - input = input * 60; - } - if (!this._isUTC && keepLocalTime) { - localAdjust = getDateOffset(this); - } - this._offset = input; - this._isUTC = true; - if (localAdjust != null) { - this.add(localAdjust, 'm'); - } - if (offset !== input) { - if (!keepLocalTime || this._changeInProgress) { - add_subtract__addSubtract(this, create__createDuration(input - offset, 'm'), 1, false); - } else if (!this._changeInProgress) { - this._changeInProgress = true; - utils_hooks__hooks.updateOffset(this, true); - this._changeInProgress = null; - } - } - return this; - } else { - return this._isUTC ? offset : getDateOffset(this); - } - } - - function getSetZone (input, keepLocalTime) { - if (input != null) { - if (typeof input !== 'string') { - input = -input; - } - - this.utcOffset(input, keepLocalTime); - - return this; - } else { - return -this.utcOffset(); - } - } - - function setOffsetToUTC (keepLocalTime) { - return this.utcOffset(0, keepLocalTime); - } - - function setOffsetToLocal (keepLocalTime) { - if (this._isUTC) { - this.utcOffset(0, keepLocalTime); - this._isUTC = false; - - if (keepLocalTime) { - this.subtract(getDateOffset(this), 'm'); - } - } - return this; - } - - function setOffsetToParsedOffset () { - if (this._tzm) { - this.utcOffset(this._tzm); - } else if (typeof this._i === 'string') { - var tZone = offsetFromString(matchOffset, this._i); - - if (tZone === 0) { - this.utcOffset(0, true); - } else { - this.utcOffset(offsetFromString(matchOffset, this._i)); - } - } - return this; - } - - function hasAlignedHourOffset (input) { - if (!this.isValid()) { - return false; - } - input = input ? local__createLocal(input).utcOffset() : 0; - - return (this.utcOffset() - input) % 60 === 0; - } - - function isDaylightSavingTime () { - return ( - this.utcOffset() > this.clone().month(0).utcOffset() || - this.utcOffset() > this.clone().month(5).utcOffset() - ); - } - - function isDaylightSavingTimeShifted () { - if (!isUndefined(this._isDSTShifted)) { - return this._isDSTShifted; - } - - var c = {}; - - copyConfig(c, this); - c = prepareConfig(c); - - if (c._a) { - var other = c._isUTC ? create_utc__createUTC(c._a) : local__createLocal(c._a); - this._isDSTShifted = this.isValid() && - compareArrays(c._a, other.toArray()) > 0; - } else { - this._isDSTShifted = false; - } - - return this._isDSTShifted; - } - - function isLocal () { - return this.isValid() ? !this._isUTC : false; - } - - function isUtcOffset () { - return this.isValid() ? this._isUTC : false; - } - - function isUtc () { - return this.isValid() ? this._isUTC && this._offset === 0 : false; - } - - // ASP.NET json date format regex - var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/; - - // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html - // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere - // and further modified to allow for strings containing both week and day - var isoRegex = /^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/; - - function create__createDuration (input, key) { - var duration = input, - // matching against regexp is expensive, do it on demand - match = null, - sign, - ret, - diffRes; - - if (isDuration(input)) { - duration = { - ms : input._milliseconds, - d : input._days, - M : input._months - }; - } else if (typeof input === 'number') { - duration = {}; - if (key) { - duration[key] = input; - } else { - duration.milliseconds = input; - } - } else if (!!(match = aspNetRegex.exec(input))) { - sign = (match[1] === '-') ? -1 : 1; - duration = { - y : 0, - d : toInt(match[DATE]) * sign, - h : toInt(match[HOUR]) * sign, - m : toInt(match[MINUTE]) * sign, - s : toInt(match[SECOND]) * sign, - ms : toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match - }; - } else if (!!(match = isoRegex.exec(input))) { - sign = (match[1] === '-') ? -1 : 1; - duration = { - y : parseIso(match[2], sign), - M : parseIso(match[3], sign), - w : parseIso(match[4], sign), - d : parseIso(match[5], sign), - h : parseIso(match[6], sign), - m : parseIso(match[7], sign), - s : parseIso(match[8], sign) - }; - } else if (duration == null) {// checks for null or undefined - duration = {}; - } else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) { - diffRes = momentsDifference(local__createLocal(duration.from), local__createLocal(duration.to)); - - duration = {}; - duration.ms = diffRes.milliseconds; - duration.M = diffRes.months; - } - - ret = new Duration(duration); - - if (isDuration(input) && hasOwnProp(input, '_locale')) { - ret._locale = input._locale; - } - - return ret; - } - - create__createDuration.fn = Duration.prototype; - - function parseIso (inp, sign) { - // We'd normally use ~~inp for this, but unfortunately it also - // converts floats to ints. - // inp may be undefined, so careful calling replace on it. - var res = inp && parseFloat(inp.replace(',', '.')); - // apply sign while we're at it - return (isNaN(res) ? 0 : res) * sign; - } - - function positiveMomentsDifference(base, other) { - var res = {milliseconds: 0, months: 0}; - - res.months = other.month() - base.month() + - (other.year() - base.year()) * 12; - if (base.clone().add(res.months, 'M').isAfter(other)) { - --res.months; - } - - res.milliseconds = +other - +(base.clone().add(res.months, 'M')); - - return res; - } - - function momentsDifference(base, other) { - var res; - if (!(base.isValid() && other.isValid())) { - return {milliseconds: 0, months: 0}; - } - - other = cloneWithOffset(other, base); - if (base.isBefore(other)) { - res = positiveMomentsDifference(base, other); - } else { - res = positiveMomentsDifference(other, base); - res.milliseconds = -res.milliseconds; - res.months = -res.months; - } - - return res; - } - - // TODO: remove 'name' arg after deprecation is removed - function createAdder(direction, name) { - return function (val, period) { - var dur, tmp; - //invert the arguments, but complain about it - if (period !== null && !isNaN(+period)) { - deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + - 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'); - tmp = val; val = period; period = tmp; - } - - val = typeof val === 'string' ? +val : val; - dur = create__createDuration(val, period); - add_subtract__addSubtract(this, dur, direction); - return this; - }; - } - - function add_subtract__addSubtract (mom, duration, isAdding, updateOffset) { - var milliseconds = duration._milliseconds, - days = absRound(duration._days), - months = absRound(duration._months); - - if (!mom.isValid()) { - // No op - return; - } - - updateOffset = updateOffset == null ? true : updateOffset; - - if (milliseconds) { - mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); - } - if (days) { - get_set__set(mom, 'Date', get_set__get(mom, 'Date') + days * isAdding); - } - if (months) { - setMonth(mom, get_set__get(mom, 'Month') + months * isAdding); - } - if (updateOffset) { - utils_hooks__hooks.updateOffset(mom, days || months); - } - } - - var add_subtract__add = createAdder(1, 'add'); - var add_subtract__subtract = createAdder(-1, 'subtract'); - - function getCalendarFormat(myMoment, now) { - var diff = myMoment.diff(now, 'days', true); - return diff < -6 ? 'sameElse' : - diff < -1 ? 'lastWeek' : - diff < 0 ? 'lastDay' : - diff < 1 ? 'sameDay' : - diff < 2 ? 'nextDay' : - diff < 7 ? 'nextWeek' : 'sameElse'; - } - - function moment_calendar__calendar (time, formats) { - // We want to compare the start of today, vs this. - // Getting start-of-today depends on whether we're local/utc/offset or not. - var now = time || local__createLocal(), - sod = cloneWithOffset(now, this).startOf('day'), - format = utils_hooks__hooks.calendarFormat(this, sod) || 'sameElse'; - - var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]); - - return this.format(output || this.localeData().calendar(format, this, local__createLocal(now))); - } - - function clone () { - return new Moment(this); - } - - function isAfter (input, units) { - var localInput = isMoment(input) ? input : local__createLocal(input); - if (!(this.isValid() && localInput.isValid())) { - return false; - } - units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); - if (units === 'millisecond') { - return this.valueOf() > localInput.valueOf(); - } else { - return localInput.valueOf() < this.clone().startOf(units).valueOf(); - } - } - - function isBefore (input, units) { - var localInput = isMoment(input) ? input : local__createLocal(input); - if (!(this.isValid() && localInput.isValid())) { - return false; - } - units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); - if (units === 'millisecond') { - return this.valueOf() < localInput.valueOf(); - } else { - return this.clone().endOf(units).valueOf() < localInput.valueOf(); - } - } - - function isBetween (from, to, units, inclusivity) { - inclusivity = inclusivity || '()'; - return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) && - (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units)); - } - - function isSame (input, units) { - var localInput = isMoment(input) ? input : local__createLocal(input), - inputMs; - if (!(this.isValid() && localInput.isValid())) { - return false; - } - units = normalizeUnits(units || 'millisecond'); - if (units === 'millisecond') { - return this.valueOf() === localInput.valueOf(); - } else { - inputMs = localInput.valueOf(); - return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); - } - } - - function isSameOrAfter (input, units) { - return this.isSame(input, units) || this.isAfter(input,units); - } - - function isSameOrBefore (input, units) { - return this.isSame(input, units) || this.isBefore(input,units); - } - - function diff (input, units, asFloat) { - var that, - zoneDelta, - delta, output; - - if (!this.isValid()) { - return NaN; - } - - that = cloneWithOffset(input, this); - - if (!that.isValid()) { - return NaN; - } - - zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; - - units = normalizeUnits(units); - - if (units === 'year' || units === 'month' || units === 'quarter') { - output = monthDiff(this, that); - if (units === 'quarter') { - output = output / 3; - } else if (units === 'year') { - output = output / 12; - } - } else { - delta = this - that; - output = units === 'second' ? delta / 1e3 : // 1000 - units === 'minute' ? delta / 6e4 : // 1000 * 60 - units === 'hour' ? delta / 36e5 : // 1000 * 60 * 60 - units === 'day' ? (delta - zoneDelta) / 864e5 : // 1000 * 60 * 60 * 24, negate dst - units === 'week' ? (delta - zoneDelta) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst - delta; - } - return asFloat ? output : absFloor(output); - } - - function monthDiff (a, b) { - // difference in months - var wholeMonthDiff = ((b.year() - a.year()) * 12) + (b.month() - a.month()), - // b is in (anchor - 1 month, anchor + 1 month) - anchor = a.clone().add(wholeMonthDiff, 'months'), - anchor2, adjust; - - if (b - anchor < 0) { - anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); - // linear across the month - adjust = (b - anchor) / (anchor - anchor2); - } else { - anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); - // linear across the month - adjust = (b - anchor) / (anchor2 - anchor); - } - - //check for negative zero, return zero if negative zero - return -(wholeMonthDiff + adjust) || 0; - } - - utils_hooks__hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; - utils_hooks__hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; - - function toString () { - return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); - } - - function moment_format__toISOString () { - var m = this.clone().utc(); - if (0 < m.year() && m.year() <= 9999) { - if (isFunction(Date.prototype.toISOString)) { - // native implementation is ~50x faster, use it when we can - return this.toDate().toISOString(); - } else { - return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); - } - } else { - return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); - } - } - - function format (inputString) { - if (!inputString) { - inputString = this.isUtc() ? utils_hooks__hooks.defaultFormatUtc : utils_hooks__hooks.defaultFormat; - } - var output = formatMoment(this, inputString); - return this.localeData().postformat(output); - } - - function from (time, withoutSuffix) { - if (this.isValid() && - ((isMoment(time) && time.isValid()) || - local__createLocal(time).isValid())) { - return create__createDuration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix); - } else { - return this.localeData().invalidDate(); - } - } - - function fromNow (withoutSuffix) { - return this.from(local__createLocal(), withoutSuffix); - } - - function to (time, withoutSuffix) { - if (this.isValid() && - ((isMoment(time) && time.isValid()) || - local__createLocal(time).isValid())) { - return create__createDuration({from: this, to: time}).locale(this.locale()).humanize(!withoutSuffix); - } else { - return this.localeData().invalidDate(); - } - } - - function toNow (withoutSuffix) { - return this.to(local__createLocal(), withoutSuffix); - } - - // If passed a locale key, it will set the locale for this - // instance. Otherwise, it will return the locale configuration - // variables for this instance. - function locale (key) { - var newLocaleData; - - if (key === undefined) { - return this._locale._abbr; - } else { - newLocaleData = locale_locales__getLocale(key); - if (newLocaleData != null) { - this._locale = newLocaleData; - } - return this; - } - } - - var lang = deprecate( - 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', - function (key) { - if (key === undefined) { - return this.localeData(); - } else { - return this.locale(key); - } - } - ); - - function localeData () { - return this._locale; - } - - function startOf (units) { - units = normalizeUnits(units); - // the following switch intentionally omits break keywords - // to utilize falling through the cases. - switch (units) { - case 'year': - this.month(0); - /* falls through */ - case 'quarter': - case 'month': - this.date(1); - /* falls through */ - case 'week': - case 'isoWeek': - case 'day': - case 'date': - this.hours(0); - /* falls through */ - case 'hour': - this.minutes(0); - /* falls through */ - case 'minute': - this.seconds(0); - /* falls through */ - case 'second': - this.milliseconds(0); - } - - // weeks are a special case - if (units === 'week') { - this.weekday(0); - } - if (units === 'isoWeek') { - this.isoWeekday(1); - } - - // quarters are also special - if (units === 'quarter') { - this.month(Math.floor(this.month() / 3) * 3); - } - - return this; - } - - function endOf (units) { - units = normalizeUnits(units); - if (units === undefined || units === 'millisecond') { - return this; - } - - // 'date' is an alias for 'day', so it should be considered as such. - if (units === 'date') { - units = 'day'; - } - - return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms'); - } - - function to_type__valueOf () { - return this._d.valueOf() - ((this._offset || 0) * 60000); - } - - function unix () { - return Math.floor(this.valueOf() / 1000); - } - - function toDate () { - return new Date(this.valueOf()); - } - - function toArray () { - var m = this; - return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()]; - } - - function toObject () { - var m = this; - return { - years: m.year(), - months: m.month(), - date: m.date(), - hours: m.hours(), - minutes: m.minutes(), - seconds: m.seconds(), - milliseconds: m.milliseconds() - }; - } - - function toJSON () { - // new Date(NaN).toJSON() === null - return this.isValid() ? this.toISOString() : null; - } - - function moment_valid__isValid () { - return valid__isValid(this); - } - - function parsingFlags () { - return extend({}, getParsingFlags(this)); - } - - function invalidAt () { - return getParsingFlags(this).overflow; - } - - function creationData() { - return { - input: this._i, - format: this._f, - locale: this._locale, - isUTC: this._isUTC, - strict: this._strict - }; - } - - // FORMATTING - - addFormatToken(0, ['gg', 2], 0, function () { - return this.weekYear() % 100; - }); - - addFormatToken(0, ['GG', 2], 0, function () { - return this.isoWeekYear() % 100; - }); - - function addWeekYearFormatToken (token, getter) { - addFormatToken(0, [token, token.length], 0, getter); - } - - addWeekYearFormatToken('gggg', 'weekYear'); - addWeekYearFormatToken('ggggg', 'weekYear'); - addWeekYearFormatToken('GGGG', 'isoWeekYear'); - addWeekYearFormatToken('GGGGG', 'isoWeekYear'); - - // ALIASES - - addUnitAlias('weekYear', 'gg'); - addUnitAlias('isoWeekYear', 'GG'); - - // PRIORITY - - addUnitPriority('weekYear', 1); - addUnitPriority('isoWeekYear', 1); - - - // PARSING - - addRegexToken('G', matchSigned); - addRegexToken('g', matchSigned); - addRegexToken('GG', match1to2, match2); - addRegexToken('gg', match1to2, match2); - addRegexToken('GGGG', match1to4, match4); - addRegexToken('gggg', match1to4, match4); - addRegexToken('GGGGG', match1to6, match6); - addRegexToken('ggggg', match1to6, match6); - - addWeekParseToken(['gggg', 'ggggg', 'GGGG', 'GGGGG'], function (input, week, config, token) { - week[token.substr(0, 2)] = toInt(input); - }); - - addWeekParseToken(['gg', 'GG'], function (input, week, config, token) { - week[token] = utils_hooks__hooks.parseTwoDigitYear(input); - }); - - // MOMENTS - - function getSetWeekYear (input) { - return getSetWeekYearHelper.call(this, - input, - this.week(), - this.weekday(), - this.localeData()._week.dow, - this.localeData()._week.doy); - } - - function getSetISOWeekYear (input) { - return getSetWeekYearHelper.call(this, - input, this.isoWeek(), this.isoWeekday(), 1, 4); - } - - function getISOWeeksInYear () { - return weeksInYear(this.year(), 1, 4); - } - - function getWeeksInYear () { - var weekInfo = this.localeData()._week; - return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); - } - - function getSetWeekYearHelper(input, week, weekday, dow, doy) { - var weeksTarget; - if (input == null) { - return weekOfYear(this, dow, doy).year; - } else { - weeksTarget = weeksInYear(input, dow, doy); - if (week > weeksTarget) { - week = weeksTarget; - } - return setWeekAll.call(this, input, week, weekday, dow, doy); - } - } - - function setWeekAll(weekYear, week, weekday, dow, doy) { - var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), - date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); - - this.year(date.getUTCFullYear()); - this.month(date.getUTCMonth()); - this.date(date.getUTCDate()); - return this; - } - - // FORMATTING - - addFormatToken('Q', 0, 'Qo', 'quarter'); - - // ALIASES - - addUnitAlias('quarter', 'Q'); - - // PRIORITY - - addUnitPriority('quarter', 7); - - // PARSING - - addRegexToken('Q', match1); - addParseToken('Q', function (input, array) { - array[MONTH] = (toInt(input) - 1) * 3; - }); - - // MOMENTS - - function getSetQuarter (input) { - return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); - } - - // FORMATTING - - addFormatToken('D', ['DD', 2], 'Do', 'date'); - - // ALIASES - - addUnitAlias('date', 'D'); - - // PRIOROITY - addUnitPriority('date', 9); - - // PARSING - - addRegexToken('D', match1to2); - addRegexToken('DD', match1to2, match2); - addRegexToken('Do', function (isStrict, locale) { - return isStrict ? locale._ordinalParse : locale._ordinalParseLenient; - }); - - addParseToken(['D', 'DD'], DATE); - addParseToken('Do', function (input, array) { - array[DATE] = toInt(input.match(match1to2)[0], 10); - }); - - // MOMENTS - - var getSetDayOfMonth = makeGetSet('Date', true); - - // FORMATTING - - addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear'); - - // ALIASES - - addUnitAlias('dayOfYear', 'DDD'); - - // PRIORITY - addUnitPriority('dayOfYear', 4); - - // PARSING - - addRegexToken('DDD', match1to3); - addRegexToken('DDDD', match3); - addParseToken(['DDD', 'DDDD'], function (input, array, config) { - config._dayOfYear = toInt(input); - }); - - // HELPERS - - // MOMENTS - - function getSetDayOfYear (input) { - var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1; - return input == null ? dayOfYear : this.add((input - dayOfYear), 'd'); - } - - // FORMATTING - - addFormatToken('m', ['mm', 2], 0, 'minute'); - - // ALIASES - - addUnitAlias('minute', 'm'); - - // PRIORITY - - addUnitPriority('minute', 14); - - // PARSING - - addRegexToken('m', match1to2); - addRegexToken('mm', match1to2, match2); - addParseToken(['m', 'mm'], MINUTE); - - // MOMENTS - - var getSetMinute = makeGetSet('Minutes', false); - - // FORMATTING - - addFormatToken('s', ['ss', 2], 0, 'second'); - - // ALIASES - - addUnitAlias('second', 's'); - - // PRIORITY - - addUnitPriority('second', 15); - - // PARSING - - addRegexToken('s', match1to2); - addRegexToken('ss', match1to2, match2); - addParseToken(['s', 'ss'], SECOND); - - // MOMENTS - - var getSetSecond = makeGetSet('Seconds', false); - - // FORMATTING - - addFormatToken('S', 0, 0, function () { - return ~~(this.millisecond() / 100); - }); - - addFormatToken(0, ['SS', 2], 0, function () { - return ~~(this.millisecond() / 10); - }); - - addFormatToken(0, ['SSS', 3], 0, 'millisecond'); - addFormatToken(0, ['SSSS', 4], 0, function () { - return this.millisecond() * 10; - }); - addFormatToken(0, ['SSSSS', 5], 0, function () { - return this.millisecond() * 100; - }); - addFormatToken(0, ['SSSSSS', 6], 0, function () { - return this.millisecond() * 1000; - }); - addFormatToken(0, ['SSSSSSS', 7], 0, function () { - return this.millisecond() * 10000; - }); - addFormatToken(0, ['SSSSSSSS', 8], 0, function () { - return this.millisecond() * 100000; - }); - addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { - return this.millisecond() * 1000000; - }); - - - // ALIASES - - addUnitAlias('millisecond', 'ms'); - - // PRIORITY - - addUnitPriority('millisecond', 16); - - // PARSING - - addRegexToken('S', match1to3, match1); - addRegexToken('SS', match1to3, match2); - addRegexToken('SSS', match1to3, match3); - - var token; - for (token = 'SSSS'; token.length <= 9; token += 'S') { - addRegexToken(token, matchUnsigned); - } - - function parseMs(input, array) { - array[MILLISECOND] = toInt(('0.' + input) * 1000); - } - - for (token = 'S'; token.length <= 9; token += 'S') { - addParseToken(token, parseMs); - } - // MOMENTS - - var getSetMillisecond = makeGetSet('Milliseconds', false); - - // FORMATTING - - addFormatToken('z', 0, 0, 'zoneAbbr'); - addFormatToken('zz', 0, 0, 'zoneName'); - - // MOMENTS - - function getZoneAbbr () { - return this._isUTC ? 'UTC' : ''; - } - - function getZoneName () { - return this._isUTC ? 'Coordinated Universal Time' : ''; - } - - var momentPrototype__proto = Moment.prototype; - - momentPrototype__proto.add = add_subtract__add; - momentPrototype__proto.calendar = moment_calendar__calendar; - momentPrototype__proto.clone = clone; - momentPrototype__proto.diff = diff; - momentPrototype__proto.endOf = endOf; - momentPrototype__proto.format = format; - momentPrototype__proto.from = from; - momentPrototype__proto.fromNow = fromNow; - momentPrototype__proto.to = to; - momentPrototype__proto.toNow = toNow; - momentPrototype__proto.get = stringGet; - momentPrototype__proto.invalidAt = invalidAt; - momentPrototype__proto.isAfter = isAfter; - momentPrototype__proto.isBefore = isBefore; - momentPrototype__proto.isBetween = isBetween; - momentPrototype__proto.isSame = isSame; - momentPrototype__proto.isSameOrAfter = isSameOrAfter; - momentPrototype__proto.isSameOrBefore = isSameOrBefore; - momentPrototype__proto.isValid = moment_valid__isValid; - momentPrototype__proto.lang = lang; - momentPrototype__proto.locale = locale; - momentPrototype__proto.localeData = localeData; - momentPrototype__proto.max = prototypeMax; - momentPrototype__proto.min = prototypeMin; - momentPrototype__proto.parsingFlags = parsingFlags; - momentPrototype__proto.set = stringSet; - momentPrototype__proto.startOf = startOf; - momentPrototype__proto.subtract = add_subtract__subtract; - momentPrototype__proto.toArray = toArray; - momentPrototype__proto.toObject = toObject; - momentPrototype__proto.toDate = toDate; - momentPrototype__proto.toISOString = moment_format__toISOString; - momentPrototype__proto.toJSON = toJSON; - momentPrototype__proto.toString = toString; - momentPrototype__proto.unix = unix; - momentPrototype__proto.valueOf = to_type__valueOf; - momentPrototype__proto.creationData = creationData; - - // Year - momentPrototype__proto.year = getSetYear; - momentPrototype__proto.isLeapYear = getIsLeapYear; - - // Week Year - momentPrototype__proto.weekYear = getSetWeekYear; - momentPrototype__proto.isoWeekYear = getSetISOWeekYear; - - // Quarter - momentPrototype__proto.quarter = momentPrototype__proto.quarters = getSetQuarter; - - // Month - momentPrototype__proto.month = getSetMonth; - momentPrototype__proto.daysInMonth = getDaysInMonth; - - // Week - momentPrototype__proto.week = momentPrototype__proto.weeks = getSetWeek; - momentPrototype__proto.isoWeek = momentPrototype__proto.isoWeeks = getSetISOWeek; - momentPrototype__proto.weeksInYear = getWeeksInYear; - momentPrototype__proto.isoWeeksInYear = getISOWeeksInYear; - - // Day - momentPrototype__proto.date = getSetDayOfMonth; - momentPrototype__proto.day = momentPrototype__proto.days = getSetDayOfWeek; - momentPrototype__proto.weekday = getSetLocaleDayOfWeek; - momentPrototype__proto.isoWeekday = getSetISODayOfWeek; - momentPrototype__proto.dayOfYear = getSetDayOfYear; - - // Hour - momentPrototype__proto.hour = momentPrototype__proto.hours = getSetHour; - - // Minute - momentPrototype__proto.minute = momentPrototype__proto.minutes = getSetMinute; - - // Second - momentPrototype__proto.second = momentPrototype__proto.seconds = getSetSecond; - - // Millisecond - momentPrototype__proto.millisecond = momentPrototype__proto.milliseconds = getSetMillisecond; - - // Offset - momentPrototype__proto.utcOffset = getSetOffset; - momentPrototype__proto.utc = setOffsetToUTC; - momentPrototype__proto.local = setOffsetToLocal; - momentPrototype__proto.parseZone = setOffsetToParsedOffset; - momentPrototype__proto.hasAlignedHourOffset = hasAlignedHourOffset; - momentPrototype__proto.isDST = isDaylightSavingTime; - momentPrototype__proto.isLocal = isLocal; - momentPrototype__proto.isUtcOffset = isUtcOffset; - momentPrototype__proto.isUtc = isUtc; - momentPrototype__proto.isUTC = isUtc; - - // Timezone - momentPrototype__proto.zoneAbbr = getZoneAbbr; - momentPrototype__proto.zoneName = getZoneName; - - // Deprecations - momentPrototype__proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth); - momentPrototype__proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth); - momentPrototype__proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear); - momentPrototype__proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone); - momentPrototype__proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted); - - var momentPrototype = momentPrototype__proto; - - function moment__createUnix (input) { - return local__createLocal(input * 1000); - } - - function moment__createInZone () { - return local__createLocal.apply(null, arguments).parseZone(); - } - - function preParsePostFormat (string) { - return string; - } - - var prototype__proto = Locale.prototype; - - prototype__proto.calendar = locale_calendar__calendar; - prototype__proto.longDateFormat = longDateFormat; - prototype__proto.invalidDate = invalidDate; - prototype__proto.ordinal = ordinal; - prototype__proto.preparse = preParsePostFormat; - prototype__proto.postformat = preParsePostFormat; - prototype__proto.relativeTime = relative__relativeTime; - prototype__proto.pastFuture = pastFuture; - prototype__proto.set = locale_set__set; - - // Month - prototype__proto.months = localeMonths; - prototype__proto.monthsShort = localeMonthsShort; - prototype__proto.monthsParse = localeMonthsParse; - prototype__proto.monthsRegex = monthsRegex; - prototype__proto.monthsShortRegex = monthsShortRegex; - - // Week - prototype__proto.week = localeWeek; - prototype__proto.firstDayOfYear = localeFirstDayOfYear; - prototype__proto.firstDayOfWeek = localeFirstDayOfWeek; - - // Day of Week - prototype__proto.weekdays = localeWeekdays; - prototype__proto.weekdaysMin = localeWeekdaysMin; - prototype__proto.weekdaysShort = localeWeekdaysShort; - prototype__proto.weekdaysParse = localeWeekdaysParse; - - prototype__proto.weekdaysRegex = weekdaysRegex; - prototype__proto.weekdaysShortRegex = weekdaysShortRegex; - prototype__proto.weekdaysMinRegex = weekdaysMinRegex; - - // Hours - prototype__proto.isPM = localeIsPM; - prototype__proto.meridiem = localeMeridiem; - - function lists__get (format, index, field, setter) { - var locale = locale_locales__getLocale(); - var utc = create_utc__createUTC().set(setter, index); - return locale[field](utc, format); - } - - function listMonthsImpl (format, index, field) { - if (typeof format === 'number') { - index = format; - format = undefined; - } - - format = format || ''; - - if (index != null) { - return lists__get(format, index, field, 'month'); - } - - var i; - var out = []; - for (i = 0; i < 12; i++) { - out[i] = lists__get(format, i, field, 'month'); - } - return out; - } - - // () - // (5) - // (fmt, 5) - // (fmt) - // (true) - // (true, 5) - // (true, fmt, 5) - // (true, fmt) - function listWeekdaysImpl (localeSorted, format, index, field) { - if (typeof localeSorted === 'boolean') { - if (typeof format === 'number') { - index = format; - format = undefined; - } - - format = format || ''; - } else { - format = localeSorted; - index = format; - localeSorted = false; - - if (typeof format === 'number') { - index = format; - format = undefined; - } - - format = format || ''; - } - - var locale = locale_locales__getLocale(), - shift = localeSorted ? locale._week.dow : 0; - - if (index != null) { - return lists__get(format, (index + shift) % 7, field, 'day'); - } - - var i; - var out = []; - for (i = 0; i < 7; i++) { - out[i] = lists__get(format, (i + shift) % 7, field, 'day'); - } - return out; - } - - function lists__listMonths (format, index) { - return listMonthsImpl(format, index, 'months'); - } - - function lists__listMonthsShort (format, index) { - return listMonthsImpl(format, index, 'monthsShort'); - } - - function lists__listWeekdays (localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); - } - - function lists__listWeekdaysShort (localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); - } - - function lists__listWeekdaysMin (localeSorted, format, index) { - return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); - } - - locale_locales__getSetGlobalLocale('en', { - ordinalParse: /\d{1,2}(th|st|nd|rd)/, - ordinal : function (number) { - var b = number % 10, - output = (toInt(number % 100 / 10) === 1) ? 'th' : - (b === 1) ? 'st' : - (b === 2) ? 'nd' : - (b === 3) ? 'rd' : 'th'; - return number + output; - } - }); - - // Side effect imports - utils_hooks__hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', locale_locales__getSetGlobalLocale); - utils_hooks__hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', locale_locales__getLocale); - - var mathAbs = Math.abs; - - function duration_abs__abs () { - var data = this._data; - - this._milliseconds = mathAbs(this._milliseconds); - this._days = mathAbs(this._days); - this._months = mathAbs(this._months); - - data.milliseconds = mathAbs(data.milliseconds); - data.seconds = mathAbs(data.seconds); - data.minutes = mathAbs(data.minutes); - data.hours = mathAbs(data.hours); - data.months = mathAbs(data.months); - data.years = mathAbs(data.years); - - return this; - } - - function duration_add_subtract__addSubtract (duration, input, value, direction) { - var other = create__createDuration(input, value); - - duration._milliseconds += direction * other._milliseconds; - duration._days += direction * other._days; - duration._months += direction * other._months; - - return duration._bubble(); - } - - // supports only 2.0-style add(1, 's') or add(duration) - function duration_add_subtract__add (input, value) { - return duration_add_subtract__addSubtract(this, input, value, 1); - } - - // supports only 2.0-style subtract(1, 's') or subtract(duration) - function duration_add_subtract__subtract (input, value) { - return duration_add_subtract__addSubtract(this, input, value, -1); - } - - function absCeil (number) { - if (number < 0) { - return Math.floor(number); - } else { - return Math.ceil(number); - } - } - - function bubble () { - var milliseconds = this._milliseconds; - var days = this._days; - var months = this._months; - var data = this._data; - var seconds, minutes, hours, years, monthsFromDays; - - // if we have a mix of positive and negative values, bubble down first - // check: https://github.com/moment/moment/issues/2166 - if (!((milliseconds >= 0 && days >= 0 && months >= 0) || - (milliseconds <= 0 && days <= 0 && months <= 0))) { - milliseconds += absCeil(monthsToDays(months) + days) * 864e5; - days = 0; - months = 0; - } - - // The following code bubbles up values, see the tests for - // examples of what that means. - data.milliseconds = milliseconds % 1000; - - seconds = absFloor(milliseconds / 1000); - data.seconds = seconds % 60; - - minutes = absFloor(seconds / 60); - data.minutes = minutes % 60; - - hours = absFloor(minutes / 60); - data.hours = hours % 24; - - days += absFloor(hours / 24); - - // convert days to months - monthsFromDays = absFloor(daysToMonths(days)); - months += monthsFromDays; - days -= absCeil(monthsToDays(monthsFromDays)); - - // 12 months -> 1 year - years = absFloor(months / 12); - months %= 12; - - data.days = days; - data.months = months; - data.years = years; - - return this; - } - - function daysToMonths (days) { - // 400 years have 146097 days (taking into account leap year rules) - // 400 years have 12 months === 4800 - return days * 4800 / 146097; - } - - function monthsToDays (months) { - // the reverse of daysToMonths - return months * 146097 / 4800; - } - - function as (units) { - var days; - var months; - var milliseconds = this._milliseconds; - - units = normalizeUnits(units); - - if (units === 'month' || units === 'year') { - days = this._days + milliseconds / 864e5; - months = this._months + daysToMonths(days); - return units === 'month' ? months : months / 12; - } else { - // handle milliseconds separately because of floating point math errors (issue #1867) - days = this._days + Math.round(monthsToDays(this._months)); - switch (units) { - case 'week' : return days / 7 + milliseconds / 6048e5; - case 'day' : return days + milliseconds / 864e5; - case 'hour' : return days * 24 + milliseconds / 36e5; - case 'minute' : return days * 1440 + milliseconds / 6e4; - case 'second' : return days * 86400 + milliseconds / 1000; - // Math.floor prevents floating point math errors here - case 'millisecond': return Math.floor(days * 864e5) + milliseconds; - default: throw new Error('Unknown unit ' + units); - } - } - } - - // TODO: Use this.as('ms')? - function duration_as__valueOf () { - return ( - this._milliseconds + - this._days * 864e5 + - (this._months % 12) * 2592e6 + - toInt(this._months / 12) * 31536e6 - ); - } - - function makeAs (alias) { - return function () { - return this.as(alias); - }; - } - - var asMilliseconds = makeAs('ms'); - var asSeconds = makeAs('s'); - var asMinutes = makeAs('m'); - var asHours = makeAs('h'); - var asDays = makeAs('d'); - var asWeeks = makeAs('w'); - var asMonths = makeAs('M'); - var asYears = makeAs('y'); - - function duration_get__get (units) { - units = normalizeUnits(units); - return this[units + 's'](); - } - - function makeGetter(name) { - return function () { - return this._data[name]; - }; - } - - var milliseconds = makeGetter('milliseconds'); - var seconds = makeGetter('seconds'); - var minutes = makeGetter('minutes'); - var hours = makeGetter('hours'); - var days = makeGetter('days'); - var months = makeGetter('months'); - var years = makeGetter('years'); - - function weeks () { - return absFloor(this.days() / 7); - } - - var round = Math.round; - var thresholds = { - s: 45, // seconds to minute - m: 45, // minutes to hour - h: 22, // hours to day - d: 26, // days to month - M: 11 // months to year - }; - - // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize - function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { - return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); - } - - function duration_humanize__relativeTime (posNegDuration, withoutSuffix, locale) { - var duration = create__createDuration(posNegDuration).abs(); - var seconds = round(duration.as('s')); - var minutes = round(duration.as('m')); - var hours = round(duration.as('h')); - var days = round(duration.as('d')); - var months = round(duration.as('M')); - var years = round(duration.as('y')); - - var a = seconds < thresholds.s && ['s', seconds] || - minutes <= 1 && ['m'] || - minutes < thresholds.m && ['mm', minutes] || - hours <= 1 && ['h'] || - hours < thresholds.h && ['hh', hours] || - days <= 1 && ['d'] || - days < thresholds.d && ['dd', days] || - months <= 1 && ['M'] || - months < thresholds.M && ['MM', months] || - years <= 1 && ['y'] || ['yy', years]; - - a[2] = withoutSuffix; - a[3] = +posNegDuration > 0; - a[4] = locale; - return substituteTimeAgo.apply(null, a); - } - - // This function allows you to set the rounding function for relative time strings - function duration_humanize__getSetRelativeTimeRounding (roundingFunction) { - if (roundingFunction === undefined) { - return round; - } - if (typeof(roundingFunction) === 'function') { - round = roundingFunction; - return true; - } - return false; - } - - // This function allows you to set a threshold for relative time strings - function duration_humanize__getSetRelativeTimeThreshold (threshold, limit) { - if (thresholds[threshold] === undefined) { - return false; - } - if (limit === undefined) { - return thresholds[threshold]; - } - thresholds[threshold] = limit; - return true; - } - - function humanize (withSuffix) { - var locale = this.localeData(); - var output = duration_humanize__relativeTime(this, !withSuffix, locale); - - if (withSuffix) { - output = locale.pastFuture(+this, output); - } - - return locale.postformat(output); - } - - var iso_string__abs = Math.abs; - - function iso_string__toISOString() { - // for ISO strings we do not use the normal bubbling rules: - // * milliseconds bubble up until they become hours - // * days do not bubble at all - // * months bubble up until they become years - // This is because there is no context-free conversion between hours and days - // (think of clock changes) - // and also not between days and months (28-31 days per month) - var seconds = iso_string__abs(this._milliseconds) / 1000; - var days = iso_string__abs(this._days); - var months = iso_string__abs(this._months); - var minutes, hours, years; - - // 3600 seconds -> 60 minutes -> 1 hour - minutes = absFloor(seconds / 60); - hours = absFloor(minutes / 60); - seconds %= 60; - minutes %= 60; - - // 12 months -> 1 year - years = absFloor(months / 12); - months %= 12; - - - // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js - var Y = years; - var M = months; - var D = days; - var h = hours; - var m = minutes; - var s = seconds; - var total = this.asSeconds(); - - if (!total) { - // this is the same as C#'s (Noda) and python (isodate)... - // but not other JS (goog.date) - return 'P0D'; - } - - return (total < 0 ? '-' : '') + - 'P' + - (Y ? Y + 'Y' : '') + - (M ? M + 'M' : '') + - (D ? D + 'D' : '') + - ((h || m || s) ? 'T' : '') + - (h ? h + 'H' : '') + - (m ? m + 'M' : '') + - (s ? s + 'S' : ''); - } - - var duration_prototype__proto = Duration.prototype; - - duration_prototype__proto.abs = duration_abs__abs; - duration_prototype__proto.add = duration_add_subtract__add; - duration_prototype__proto.subtract = duration_add_subtract__subtract; - duration_prototype__proto.as = as; - duration_prototype__proto.asMilliseconds = asMilliseconds; - duration_prototype__proto.asSeconds = asSeconds; - duration_prototype__proto.asMinutes = asMinutes; - duration_prototype__proto.asHours = asHours; - duration_prototype__proto.asDays = asDays; - duration_prototype__proto.asWeeks = asWeeks; - duration_prototype__proto.asMonths = asMonths; - duration_prototype__proto.asYears = asYears; - duration_prototype__proto.valueOf = duration_as__valueOf; - duration_prototype__proto._bubble = bubble; - duration_prototype__proto.get = duration_get__get; - duration_prototype__proto.milliseconds = milliseconds; - duration_prototype__proto.seconds = seconds; - duration_prototype__proto.minutes = minutes; - duration_prototype__proto.hours = hours; - duration_prototype__proto.days = days; - duration_prototype__proto.weeks = weeks; - duration_prototype__proto.months = months; - duration_prototype__proto.years = years; - duration_prototype__proto.humanize = humanize; - duration_prototype__proto.toISOString = iso_string__toISOString; - duration_prototype__proto.toString = iso_string__toISOString; - duration_prototype__proto.toJSON = iso_string__toISOString; - duration_prototype__proto.locale = locale; - duration_prototype__proto.localeData = localeData; - - // Deprecations - duration_prototype__proto.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', iso_string__toISOString); - duration_prototype__proto.lang = lang; - - // Side effect imports - - // FORMATTING - - addFormatToken('X', 0, 0, 'unix'); - addFormatToken('x', 0, 0, 'valueOf'); - - // PARSING - - addRegexToken('x', matchSigned); - addRegexToken('X', matchTimestamp); - addParseToken('X', function (input, array, config) { - config._d = new Date(parseFloat(input, 10) * 1000); - }); - addParseToken('x', function (input, array, config) { - config._d = new Date(toInt(input)); - }); - - // Side effect imports - - - utils_hooks__hooks.version = '2.15.1'; - - setHookCallback(local__createLocal); - - utils_hooks__hooks.fn = momentPrototype; - utils_hooks__hooks.min = min; - utils_hooks__hooks.max = max; - utils_hooks__hooks.now = now; - utils_hooks__hooks.utc = create_utc__createUTC; - utils_hooks__hooks.unix = moment__createUnix; - utils_hooks__hooks.months = lists__listMonths; - utils_hooks__hooks.isDate = isDate; - utils_hooks__hooks.locale = locale_locales__getSetGlobalLocale; - utils_hooks__hooks.invalid = valid__createInvalid; - utils_hooks__hooks.duration = create__createDuration; - utils_hooks__hooks.isMoment = isMoment; - utils_hooks__hooks.weekdays = lists__listWeekdays; - utils_hooks__hooks.parseZone = moment__createInZone; - utils_hooks__hooks.localeData = locale_locales__getLocale; - utils_hooks__hooks.isDuration = isDuration; - utils_hooks__hooks.monthsShort = lists__listMonthsShort; - utils_hooks__hooks.weekdaysMin = lists__listWeekdaysMin; - utils_hooks__hooks.defineLocale = defineLocale; - utils_hooks__hooks.updateLocale = updateLocale; - utils_hooks__hooks.locales = locale_locales__listLocales; - utils_hooks__hooks.weekdaysShort = lists__listWeekdaysShort; - utils_hooks__hooks.normalizeUnits = normalizeUnits; - utils_hooks__hooks.relativeTimeRounding = duration_humanize__getSetRelativeTimeRounding; - utils_hooks__hooks.relativeTimeThreshold = duration_humanize__getSetRelativeTimeThreshold; - utils_hooks__hooks.calendarFormat = getCalendarFormat; - utils_hooks__hooks.prototype = momentPrototype; - - var _moment = utils_hooks__hooks; - - return _moment; - -})); -},{}],7:[function(require,module,exports){ -/** - * @namespace Chart - */ -var Chart = require(27)(); - -require(26)(Chart); -require(22)(Chart); -require(25)(Chart); -require(21)(Chart); -require(23)(Chart); -require(24)(Chart); -require(28)(Chart); -require(32)(Chart); -require(30)(Chart); -require(31)(Chart); -require(33)(Chart); -require(29)(Chart); -require(34)(Chart); - -require(35)(Chart); -require(36)(Chart); -require(37)(Chart); -require(38)(Chart); - -require(41)(Chart); -require(39)(Chart); -require(40)(Chart); -require(42)(Chart); -require(43)(Chart); -require(44)(Chart); - -// Controllers must be loaded after elements -// See Chart.core.datasetController.dataElementType -require(15)(Chart); -require(16)(Chart); -require(17)(Chart); -require(18)(Chart); -require(19)(Chart); -require(20)(Chart); - -require(8)(Chart); -require(9)(Chart); -require(10)(Chart); -require(11)(Chart); -require(12)(Chart); -require(13)(Chart); -require(14)(Chart); - -window.Chart = module.exports = Chart; - -},{"10":10,"11":11,"12":12,"13":13,"14":14,"15":15,"16":16,"17":17,"18":18,"19":19,"20":20,"21":21,"22":22,"23":23,"24":24,"25":25,"26":26,"27":27,"28":28,"29":29,"30":30,"31":31,"32":32,"33":33,"34":34,"35":35,"36":36,"37":37,"38":38,"39":39,"40":40,"41":41,"42":42,"43":43,"44":44,"8":8,"9":9}],8:[function(require,module,exports){ -'use strict'; - -module.exports = function(Chart) { - - Chart.Bar = function(context, config) { - config.type = 'bar'; - - return new Chart(context, config); - }; - -}; - -},{}],9:[function(require,module,exports){ -'use strict'; - -module.exports = function(Chart) { - - Chart.Bubble = function(context, config) { - config.type = 'bubble'; - return new Chart(context, config); - }; - -}; - -},{}],10:[function(require,module,exports){ -'use strict'; - -module.exports = function(Chart) { - - Chart.Doughnut = function(context, config) { - config.type = 'doughnut'; - - return new Chart(context, config); - }; - -}; - -},{}],11:[function(require,module,exports){ -'use strict'; - -module.exports = function(Chart) { - - Chart.Line = function(context, config) { - config.type = 'line'; - - return new Chart(context, config); - }; - -}; - -},{}],12:[function(require,module,exports){ -'use strict'; - -module.exports = function(Chart) { - - Chart.PolarArea = function(context, config) { - config.type = 'polarArea'; - - return new Chart(context, config); - }; - -}; - -},{}],13:[function(require,module,exports){ -'use strict'; - -module.exports = function(Chart) { - - Chart.Radar = function(context, config) { - config.options = Chart.helpers.configMerge({aspectRatio: 1}, config.options); - config.type = 'radar'; - - return new Chart(context, config); - }; - -}; - -},{}],14:[function(require,module,exports){ -'use strict'; - -module.exports = function(Chart) { - - var defaultConfig = { - hover: { - mode: 'single' - }, - - scales: { - xAxes: [{ - type: 'linear', // scatter should not use a category axis - position: 'bottom', - id: 'x-axis-1' // need an ID so datasets can reference the scale - }], - yAxes: [{ - type: 'linear', - position: 'left', - id: 'y-axis-1' - }] - }, - - tooltips: { - callbacks: { - title: function() { - // Title doesn't make sense for scatter since we format the data as a point - return ''; - }, - label: function(tooltipItem) { - return '(' + tooltipItem.xLabel + ', ' + tooltipItem.yLabel + ')'; - } - } - } - }; - - // Register the default config for this type - Chart.defaults.scatter = defaultConfig; - - // Scatter charts use line controllers - Chart.controllers.scatter = Chart.controllers.line; - - Chart.Scatter = function(context, config) { - config.type = 'scatter'; - return new Chart(context, config); - }; - -}; - -},{}],15:[function(require,module,exports){ -'use strict'; - -module.exports = function(Chart) { - - var helpers = Chart.helpers; - - Chart.defaults.bar = { - hover: { - mode: 'label' - }, - - scales: { - xAxes: [{ - type: 'category', - - // Specific to Bar Controller - categoryPercentage: 0.8, - barPercentage: 0.9, - - // grid line settings - gridLines: { - offsetGridLines: true - } - }], - yAxes: [{ - type: 'linear' - }] - } - }; - - Chart.controllers.bar = Chart.DatasetController.extend({ - - dataElementType: Chart.elements.Rectangle, - - initialize: function(chart, datasetIndex) { - Chart.DatasetController.prototype.initialize.call(this, chart, datasetIndex); - - // Use this to indicate that this is a bar dataset. - this.getMeta().bar = true; - }, - - // Get the number of datasets that display bars. We use this to correctly calculate the bar width - getBarCount: function() { - var me = this; - var barCount = 0; - helpers.each(me.chart.data.datasets, function(dataset, datasetIndex) { - var meta = me.chart.getDatasetMeta(datasetIndex); - if (meta.bar && me.chart.isDatasetVisible(datasetIndex)) { - ++barCount; - } - }, me); - return barCount; - }, - - update: function(reset) { - var me = this; - helpers.each(me.getMeta().data, function(rectangle, index) { - me.updateElement(rectangle, index, reset); - }, me); - }, - - updateElement: function(rectangle, index, reset) { - var me = this; - var meta = me.getMeta(); - var xScale = me.getScaleForId(meta.xAxisID); - var yScale = me.getScaleForId(meta.yAxisID); - var scaleBase = yScale.getBasePixel(); - var rectangleElementOptions = me.chart.options.elements.rectangle; - var custom = rectangle.custom || {}; - var dataset = me.getDataset(); - - helpers.extend(rectangle, { - // Utility - _xScale: xScale, - _yScale: yScale, - _datasetIndex: me.index, - _index: index, - - // Desired view properties - _model: { - x: me.calculateBarX(index, me.index), - y: reset ? scaleBase : me.calculateBarY(index, me.index), - - // Tooltip - label: me.chart.data.labels[index], - datasetLabel: dataset.label, - - // Appearance - base: reset ? scaleBase : me.calculateBarBase(me.index, index), - width: me.calculateBarWidth(index), - backgroundColor: custom.backgroundColor ? custom.backgroundColor : helpers.getValueAtIndexOrDefault(dataset.backgroundColor, index, rectangleElementOptions.backgroundColor), - borderSkipped: custom.borderSkipped ? custom.borderSkipped : rectangleElementOptions.borderSkipped, - borderColor: custom.borderColor ? custom.borderColor : helpers.getValueAtIndexOrDefault(dataset.borderColor, index, rectangleElementOptions.borderColor), - borderWidth: custom.borderWidth ? custom.borderWidth : helpers.getValueAtIndexOrDefault(dataset.borderWidth, index, rectangleElementOptions.borderWidth) - } - }); - rectangle.pivot(); - }, - - calculateBarBase: function(datasetIndex, index) { - var me = this; - var meta = me.getMeta(); - var yScale = me.getScaleForId(meta.yAxisID); - var base = 0; - - if (yScale.options.stacked) { - var chart = me.chart; - var datasets = chart.data.datasets; - var value = Number(datasets[datasetIndex].data[index]); - - for (var i = 0; i < datasetIndex; i++) { - var currentDs = datasets[i]; - var currentDsMeta = chart.getDatasetMeta(i); - if (currentDsMeta.bar && currentDsMeta.yAxisID === yScale.id && chart.isDatasetVisible(i)) { - var currentVal = Number(currentDs.data[index]); - base += value < 0 ? Math.min(currentVal, 0) : Math.max(currentVal, 0); - } - } - - return yScale.getPixelForValue(base); - } - - return yScale.getBasePixel(); - }, - - getRuler: function(index) { - var me = this; - var meta = me.getMeta(); - var xScale = me.getScaleForId(meta.xAxisID); - var datasetCount = me.getBarCount(); - - var tickWidth; - - if (xScale.options.type === 'category') { - tickWidth = xScale.getPixelForTick(index + 1) - xScale.getPixelForTick(index); - } else { - // Average width - tickWidth = xScale.width / xScale.ticks.length; - } - var categoryWidth = tickWidth * xScale.options.categoryPercentage; - var categorySpacing = (tickWidth - (tickWidth * xScale.options.categoryPercentage)) / 2; - var fullBarWidth = categoryWidth / datasetCount; - - if (xScale.ticks.length !== me.chart.data.labels.length) { - var perc = xScale.ticks.length / me.chart.data.labels.length; - fullBarWidth = fullBarWidth * perc; - } - - var barWidth = fullBarWidth * xScale.options.barPercentage; - var barSpacing = fullBarWidth - (fullBarWidth * xScale.options.barPercentage); - - return { - datasetCount: datasetCount, - tickWidth: tickWidth, - categoryWidth: categoryWidth, - categorySpacing: categorySpacing, - fullBarWidth: fullBarWidth, - barWidth: barWidth, - barSpacing: barSpacing - }; - }, - - calculateBarWidth: function(index) { - var xScale = this.getScaleForId(this.getMeta().xAxisID); - if (xScale.options.barThickness) { - return xScale.options.barThickness; - } - var ruler = this.getRuler(index); - return xScale.options.stacked ? ruler.categoryWidth : ruler.barWidth; - }, - - // Get bar index from the given dataset index accounting for the fact that not all bars are visible - getBarIndex: function(datasetIndex) { - var barIndex = 0; - var meta, j; - - for (j = 0; j < datasetIndex; ++j) { - meta = this.chart.getDatasetMeta(j); - if (meta.bar && this.chart.isDatasetVisible(j)) { - ++barIndex; - } - } - - return barIndex; - }, - - calculateBarX: function(index, datasetIndex) { - var me = this; - var meta = me.getMeta(); - var xScale = me.getScaleForId(meta.xAxisID); - var barIndex = me.getBarIndex(datasetIndex); - - var ruler = me.getRuler(index); - var leftTick = xScale.getPixelForValue(null, index, datasetIndex, me.chart.isCombo); - leftTick -= me.chart.isCombo ? (ruler.tickWidth / 2) : 0; - - if (xScale.options.stacked) { - return leftTick + (ruler.categoryWidth / 2) + ruler.categorySpacing; - } - - return leftTick + - (ruler.barWidth / 2) + - ruler.categorySpacing + - (ruler.barWidth * barIndex) + - (ruler.barSpacing / 2) + - (ruler.barSpacing * barIndex); - }, - - calculateBarY: function(index, datasetIndex) { - var me = this; - var meta = me.getMeta(); - var yScale = me.getScaleForId(meta.yAxisID); - var value = Number(me.getDataset().data[index]); - - if (yScale.options.stacked) { - - var sumPos = 0, - sumNeg = 0; - - for (var i = 0; i < datasetIndex; i++) { - var ds = me.chart.data.datasets[i]; - var dsMeta = me.chart.getDatasetMeta(i); - if (dsMeta.bar && dsMeta.yAxisID === yScale.id && me.chart.isDatasetVisible(i)) { - var stackedVal = Number(ds.data[index]); - if (stackedVal < 0) { - sumNeg += stackedVal || 0; - } else { - sumPos += stackedVal || 0; - } - } - } - - if (value < 0) { - return yScale.getPixelForValue(sumNeg + value); - } - return yScale.getPixelForValue(sumPos + value); - } - - return yScale.getPixelForValue(value); - }, - - draw: function(ease) { - var me = this; - var easingDecimal = ease || 1; - helpers.each(me.getMeta().data, function(rectangle, index) { - var d = me.getDataset().data[index]; - if (d !== null && d !== undefined && !isNaN(d)) { - rectangle.transition(easingDecimal).draw(); - } - }, me); - }, - - setHoverStyle: function(rectangle) { - var dataset = this.chart.data.datasets[rectangle._datasetIndex]; - var index = rectangle._index; - - var custom = rectangle.custom || {}; - var model = rectangle._model; - model.backgroundColor = custom.hoverBackgroundColor ? custom.hoverBackgroundColor : helpers.getValueAtIndexOrDefault(dataset.hoverBackgroundColor, index, helpers.getHoverColor(model.backgroundColor)); - model.borderColor = custom.hoverBorderColor ? custom.hoverBorderColor : helpers.getValueAtIndexOrDefault(dataset.hoverBorderColor, index, helpers.getHoverColor(model.borderColor)); - model.borderWidth = custom.hoverBorderWidth ? custom.hoverBorderWidth : helpers.getValueAtIndexOrDefault(dataset.hoverBorderWidth, index, model.borderWidth); - }, - - removeHoverStyle: function(rectangle) { - var dataset = this.chart.data.datasets[rectangle._datasetIndex]; - var index = rectangle._index; - var custom = rectangle.custom || {}; - var model = rectangle._model; - var rectangleElementOptions = this.chart.options.elements.rectangle; - - model.backgroundColor = custom.backgroundColor ? custom.backgroundColor : helpers.getValueAtIndexOrDefault(dataset.backgroundColor, index, rectangleElementOptions.backgroundColor); - model.borderColor = custom.borderColor ? custom.borderColor : helpers.getValueAtIndexOrDefault(dataset.borderColor, index, rectangleElementOptions.borderColor); - model.borderWidth = custom.borderWidth ? custom.borderWidth : helpers.getValueAtIndexOrDefault(dataset.borderWidth, index, rectangleElementOptions.borderWidth); - } - - }); - - - // including horizontalBar in the bar file, instead of a file of its own - // it extends bar (like pie extends doughnut) - Chart.defaults.horizontalBar = { - hover: { - mode: 'label' - }, - - scales: { - xAxes: [{ - type: 'linear', - position: 'bottom' - }], - yAxes: [{ - position: 'left', - type: 'category', - - // Specific to Horizontal Bar Controller - categoryPercentage: 0.8, - barPercentage: 0.9, - - // grid line settings - gridLines: { - offsetGridLines: true - } - }] - }, - elements: { - rectangle: { - borderSkipped: 'left' - } - }, - tooltips: { - callbacks: { - title: function(tooltipItems, data) { - // Pick first xLabel for now - var title = ''; - - if (tooltipItems.length > 0) { - if (tooltipItems[0].yLabel) { - title = tooltipItems[0].yLabel; - } else if (data.labels.length > 0 && tooltipItems[0].index < data.labels.length) { - title = data.labels[tooltipItems[0].index]; - } - } - - return title; - }, - label: function(tooltipItem, data) { - var datasetLabel = data.datasets[tooltipItem.datasetIndex].label || ''; - return datasetLabel + ': ' + tooltipItem.xLabel; - } - } - } - }; - - Chart.controllers.horizontalBar = Chart.controllers.bar.extend({ - updateElement: function(rectangle, index, reset) { - var me = this; - var meta = me.getMeta(); - var xScale = me.getScaleForId(meta.xAxisID); - var yScale = me.getScaleForId(meta.yAxisID); - var scaleBase = xScale.getBasePixel(); - var custom = rectangle.custom || {}; - var dataset = me.getDataset(); - var rectangleElementOptions = me.chart.options.elements.rectangle; - - helpers.extend(rectangle, { - // Utility - _xScale: xScale, - _yScale: yScale, - _datasetIndex: me.index, - _index: index, - - // Desired view properties - _model: { - x: reset ? scaleBase : me.calculateBarX(index, me.index), - y: me.calculateBarY(index, me.index), - - // Tooltip - label: me.chart.data.labels[index], - datasetLabel: dataset.label, - - // Appearance - base: reset ? scaleBase : me.calculateBarBase(me.index, index), - height: me.calculateBarHeight(index), - backgroundColor: custom.backgroundColor ? custom.backgroundColor : helpers.getValueAtIndexOrDefault(dataset.backgroundColor, index, rectangleElementOptions.backgroundColor), - borderSkipped: custom.borderSkipped ? custom.borderSkipped : rectangleElementOptions.borderSkipped, - borderColor: custom.borderColor ? custom.borderColor : helpers.getValueAtIndexOrDefault(dataset.borderColor, index, rectangleElementOptions.borderColor), - borderWidth: custom.borderWidth ? custom.borderWidth : helpers.getValueAtIndexOrDefault(dataset.borderWidth, index, rectangleElementOptions.borderWidth) - }, - - draw: function() { - var ctx = this._chart.ctx; - var vm = this._view; - - var halfHeight = vm.height / 2, - topY = vm.y - halfHeight, - bottomY = vm.y + halfHeight, - right = vm.base - (vm.base - vm.x), - halfStroke = vm.borderWidth / 2; - - // Canvas doesn't allow us to stroke inside the width so we can - // adjust the sizes to fit if we're setting a stroke on the line - if (vm.borderWidth) { - topY += halfStroke; - bottomY -= halfStroke; - right += halfStroke; - } - - ctx.beginPath(); - - ctx.fillStyle = vm.backgroundColor; - ctx.strokeStyle = vm.borderColor; - ctx.lineWidth = vm.borderWidth; - - // Corner points, from bottom-left to bottom-right clockwise - // | 1 2 | - // | 0 3 | - var corners = [ - [vm.base, bottomY], - [vm.base, topY], - [right, topY], - [right, bottomY] - ]; - - // Find first (starting) corner with fallback to 'bottom' - var borders = ['bottom', 'left', 'top', 'right']; - var startCorner = borders.indexOf(vm.borderSkipped, 0); - if (startCorner === -1) { - startCorner = 0; - } - - function cornerAt(cornerIndex) { - return corners[(startCorner + cornerIndex) % 4]; - } - - // Draw rectangle from 'startCorner' - ctx.moveTo.apply(ctx, cornerAt(0)); - for (var i = 1; i < 4; i++) { - ctx.lineTo.apply(ctx, cornerAt(i)); - } - - ctx.fill(); - if (vm.borderWidth) { - ctx.stroke(); - } - }, - - inRange: function(mouseX, mouseY) { - var vm = this._view; - var inRange = false; - - if (vm) { - if (vm.x < vm.base) { - inRange = (mouseY >= vm.y - vm.height / 2 && mouseY <= vm.y + vm.height / 2) && (mouseX >= vm.x && mouseX <= vm.base); - } else { - inRange = (mouseY >= vm.y - vm.height / 2 && mouseY <= vm.y + vm.height / 2) && (mouseX >= vm.base && mouseX <= vm.x); - } - } - - return inRange; - } - }); - - rectangle.pivot(); - }, - - calculateBarBase: function(datasetIndex, index) { - var me = this; - var meta = me.getMeta(); - var xScale = me.getScaleForId(meta.xAxisID); - var base = 0; - - if (xScale.options.stacked) { - var chart = me.chart; - var datasets = chart.data.datasets; - var value = Number(datasets[datasetIndex].data[index]); - - for (var i = 0; i < datasetIndex; i++) { - var currentDs = datasets[i]; - var currentDsMeta = chart.getDatasetMeta(i); - if (currentDsMeta.bar && currentDsMeta.xAxisID === xScale.id && chart.isDatasetVisible(i)) { - var currentVal = Number(currentDs.data[index]); - base += value < 0 ? Math.min(currentVal, 0) : Math.max(currentVal, 0); - } - } - - return xScale.getPixelForValue(base); - } - - return xScale.getBasePixel(); - }, - - getRuler: function(index) { - var me = this; - var meta = me.getMeta(); - var yScale = me.getScaleForId(meta.yAxisID); - var datasetCount = me.getBarCount(); - - var tickHeight; - if (yScale.options.type === 'category') { - tickHeight = yScale.getPixelForTick(index + 1) - yScale.getPixelForTick(index); - } else { - // Average width - tickHeight = yScale.width / yScale.ticks.length; - } - var categoryHeight = tickHeight * yScale.options.categoryPercentage; - var categorySpacing = (tickHeight - (tickHeight * yScale.options.categoryPercentage)) / 2; - var fullBarHeight = categoryHeight / datasetCount; - - if (yScale.ticks.length !== me.chart.data.labels.length) { - var perc = yScale.ticks.length / me.chart.data.labels.length; - fullBarHeight = fullBarHeight * perc; - } - - var barHeight = fullBarHeight * yScale.options.barPercentage; - var barSpacing = fullBarHeight - (fullBarHeight * yScale.options.barPercentage); - - return { - datasetCount: datasetCount, - tickHeight: tickHeight, - categoryHeight: categoryHeight, - categorySpacing: categorySpacing, - fullBarHeight: fullBarHeight, - barHeight: barHeight, - barSpacing: barSpacing - }; - }, - - calculateBarHeight: function(index) { - var me = this; - var yScale = me.getScaleForId(me.getMeta().yAxisID); - if (yScale.options.barThickness) { - return yScale.options.barThickness; - } - var ruler = me.getRuler(index); - return yScale.options.stacked ? ruler.categoryHeight : ruler.barHeight; - }, - - calculateBarX: function(index, datasetIndex) { - var me = this; - var meta = me.getMeta(); - var xScale = me.getScaleForId(meta.xAxisID); - var value = Number(me.getDataset().data[index]); - - if (xScale.options.stacked) { - - var sumPos = 0, - sumNeg = 0; - - for (var i = 0; i < datasetIndex; i++) { - var ds = me.chart.data.datasets[i]; - var dsMeta = me.chart.getDatasetMeta(i); - if (dsMeta.bar && dsMeta.xAxisID === xScale.id && me.chart.isDatasetVisible(i)) { - var stackedVal = Number(ds.data[index]); - if (stackedVal < 0) { - sumNeg += stackedVal || 0; - } else { - sumPos += stackedVal || 0; - } - } - } - - if (value < 0) { - return xScale.getPixelForValue(sumNeg + value); - } - return xScale.getPixelForValue(sumPos + value); - } - - return xScale.getPixelForValue(value); - }, - - calculateBarY: function(index, datasetIndex) { - var me = this; - var meta = me.getMeta(); - var yScale = me.getScaleForId(meta.yAxisID); - var barIndex = me.getBarIndex(datasetIndex); - - var ruler = me.getRuler(index); - var topTick = yScale.getPixelForValue(null, index, datasetIndex, me.chart.isCombo); - topTick -= me.chart.isCombo ? (ruler.tickHeight / 2) : 0; - - if (yScale.options.stacked) { - return topTick + (ruler.categoryHeight / 2) + ruler.categorySpacing; - } - - return topTick + - (ruler.barHeight / 2) + - ruler.categorySpacing + - (ruler.barHeight * barIndex) + - (ruler.barSpacing / 2) + - (ruler.barSpacing * barIndex); - } - }); -}; - -},{}],16:[function(require,module,exports){ -'use strict'; - -module.exports = function(Chart) { - - var helpers = Chart.helpers; - - Chart.defaults.bubble = { - hover: { - mode: 'single' - }, - - scales: { - xAxes: [{ - type: 'linear', // bubble should probably use a linear scale by default - position: 'bottom', - id: 'x-axis-0' // need an ID so datasets can reference the scale - }], - yAxes: [{ - type: 'linear', - position: 'left', - id: 'y-axis-0' - }] - }, - - tooltips: { - callbacks: { - title: function() { - // Title doesn't make sense for scatter since we format the data as a point - return ''; - }, - label: function(tooltipItem, data) { - var datasetLabel = data.datasets[tooltipItem.datasetIndex].label || ''; - var dataPoint = data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index]; - return datasetLabel + ': (' + dataPoint.x + ', ' + dataPoint.y + ', ' + dataPoint.r + ')'; - } - } - } - }; - - Chart.controllers.bubble = Chart.DatasetController.extend({ - - dataElementType: Chart.elements.Point, - - update: function(reset) { - var me = this; - var meta = me.getMeta(); - var points = meta.data; - - // Update Points - helpers.each(points, function(point, index) { - me.updateElement(point, index, reset); - }); - }, - - updateElement: function(point, index, reset) { - var me = this; - var meta = me.getMeta(); - var xScale = me.getScaleForId(meta.xAxisID); - var yScale = me.getScaleForId(meta.yAxisID); - - var custom = point.custom || {}; - var dataset = me.getDataset(); - var data = dataset.data[index]; - var pointElementOptions = me.chart.options.elements.point; - var dsIndex = me.index; - - helpers.extend(point, { - // Utility - _xScale: xScale, - _yScale: yScale, - _datasetIndex: dsIndex, - _index: index, - - // Desired view properties - _model: { - x: reset ? xScale.getPixelForDecimal(0.5) : xScale.getPixelForValue(typeof data === 'object' ? data : NaN, index, dsIndex, me.chart.isCombo), - y: reset ? yScale.getBasePixel() : yScale.getPixelForValue(data, index, dsIndex), - // Appearance - radius: reset ? 0 : custom.radius ? custom.radius : me.getRadius(data), - - // Tooltip - hitRadius: custom.hitRadius ? custom.hitRadius : helpers.getValueAtIndexOrDefault(dataset.hitRadius, index, pointElementOptions.hitRadius) - } - }); - - // Trick to reset the styles of the point - Chart.DatasetController.prototype.removeHoverStyle.call(me, point, pointElementOptions); - - var model = point._model; - model.skip = custom.skip ? custom.skip : (isNaN(model.x) || isNaN(model.y)); - - point.pivot(); - }, - - getRadius: function(value) { - return value.r || this.chart.options.elements.point.radius; - }, - - setHoverStyle: function(point) { - var me = this; - Chart.DatasetController.prototype.setHoverStyle.call(me, point); - - // Radius - var dataset = me.chart.data.datasets[point._datasetIndex]; - var index = point._index; - var custom = point.custom || {}; - var model = point._model; - model.radius = custom.hoverRadius ? custom.hoverRadius : (helpers.getValueAtIndexOrDefault(dataset.hoverRadius, index, me.chart.options.elements.point.hoverRadius)) + me.getRadius(dataset.data[index]); - }, - - removeHoverStyle: function(point) { - var me = this; - Chart.DatasetController.prototype.removeHoverStyle.call(me, point, me.chart.options.elements.point); - - var dataVal = me.chart.data.datasets[point._datasetIndex].data[point._index]; - var custom = point.custom || {}; - var model = point._model; - - model.radius = custom.radius ? custom.radius : me.getRadius(dataVal); - } - }); -}; - -},{}],17:[function(require,module,exports){ -'use strict'; - -module.exports = function(Chart) { - - var helpers = Chart.helpers, - defaults = Chart.defaults; - - defaults.doughnut = { - animation: { - // Boolean - Whether we animate the rotation of the Doughnut - animateRotate: true, - // Boolean - Whether we animate scaling the Doughnut from the centre - animateScale: false - }, - aspectRatio: 1, - hover: { - mode: 'single' - }, - legendCallback: function(chart) { - var text = []; - text.push('
    '); - - var data = chart.data; - var datasets = data.datasets; - var labels = data.labels; - - if (datasets.length) { - for (var i = 0; i < datasets[0].data.length; ++i) { - text.push('
  • '); - if (labels[i]) { - text.push(labels[i]); - } - text.push('
  • '); - } - } - - text.push('
'); - return text.join(''); - }, - legend: { - labels: { - generateLabels: function(chart) { - var data = chart.data; - if (data.labels.length && data.datasets.length) { - return data.labels.map(function(label, i) { - var meta = chart.getDatasetMeta(0); - var ds = data.datasets[0]; - var arc = meta.data[i]; - var custom = arc && arc.custom || {}; - var getValueAtIndexOrDefault = helpers.getValueAtIndexOrDefault; - var arcOpts = chart.options.elements.arc; - var fill = custom.backgroundColor ? custom.backgroundColor : getValueAtIndexOrDefault(ds.backgroundColor, i, arcOpts.backgroundColor); - var stroke = custom.borderColor ? custom.borderColor : getValueAtIndexOrDefault(ds.borderColor, i, arcOpts.borderColor); - var bw = custom.borderWidth ? custom.borderWidth : getValueAtIndexOrDefault(ds.borderWidth, i, arcOpts.borderWidth); - - return { - text: label, - fillStyle: fill, - strokeStyle: stroke, - lineWidth: bw, - hidden: isNaN(ds.data[i]) || meta.data[i].hidden, - - // Extra data used for toggling the correct item - index: i - }; - }); - } - return []; - } - }, - - onClick: function(e, legendItem) { - var index = legendItem.index; - var chart = this.chart; - var i, ilen, meta; - - for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) { - meta = chart.getDatasetMeta(i); - // toggle visibility of index if exists - if (meta.data[index]) { - meta.data[index].hidden = !meta.data[index].hidden; - } - } - - chart.update(); - } - }, - - // The percentage of the chart that we cut out of the middle. - cutoutPercentage: 50, - - // The rotation of the chart, where the first data arc begins. - rotation: Math.PI * -0.5, - - // The total circumference of the chart. - circumference: Math.PI * 2.0, - - // Need to override these to give a nice default - tooltips: { - callbacks: { - title: function() { - return ''; - }, - label: function(tooltipItem, data) { - return data.labels[tooltipItem.index] + ': ' + data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index]; - } - } - } - }; - - defaults.pie = helpers.clone(defaults.doughnut); - helpers.extend(defaults.pie, { - cutoutPercentage: 0 - }); - - - Chart.controllers.doughnut = Chart.controllers.pie = Chart.DatasetController.extend({ - - dataElementType: Chart.elements.Arc, - - linkScales: helpers.noop, - - // Get index of the dataset in relation to the visible datasets. This allows determining the inner and outer radius correctly - getRingIndex: function(datasetIndex) { - var ringIndex = 0; - - for (var j = 0; j < datasetIndex; ++j) { - if (this.chart.isDatasetVisible(j)) { - ++ringIndex; - } - } - - return ringIndex; - }, - - update: function(reset) { - var me = this; - var chart = me.chart, - chartArea = chart.chartArea, - opts = chart.options, - arcOpts = opts.elements.arc, - availableWidth = chartArea.right - chartArea.left - arcOpts.borderWidth, - availableHeight = chartArea.bottom - chartArea.top - arcOpts.borderWidth, - minSize = Math.min(availableWidth, availableHeight), - offset = { - x: 0, - y: 0 - }, - meta = me.getMeta(), - cutoutPercentage = opts.cutoutPercentage, - circumference = opts.circumference; - - // If the chart's circumference isn't a full circle, calculate minSize as a ratio of the width/height of the arc - if (circumference < Math.PI * 2.0) { - var startAngle = opts.rotation % (Math.PI * 2.0); - startAngle += Math.PI * 2.0 * (startAngle >= Math.PI ? -1 : startAngle < -Math.PI ? 1 : 0); - var endAngle = startAngle + circumference; - var start = {x: Math.cos(startAngle), y: Math.sin(startAngle)}; - var end = {x: Math.cos(endAngle), y: Math.sin(endAngle)}; - var contains0 = (startAngle <= 0 && 0 <= endAngle) || (startAngle <= Math.PI * 2.0 && Math.PI * 2.0 <= endAngle); - var contains90 = (startAngle <= Math.PI * 0.5 && Math.PI * 0.5 <= endAngle) || (startAngle <= Math.PI * 2.5 && Math.PI * 2.5 <= endAngle); - var contains180 = (startAngle <= -Math.PI && -Math.PI <= endAngle) || (startAngle <= Math.PI && Math.PI <= endAngle); - var contains270 = (startAngle <= -Math.PI * 0.5 && -Math.PI * 0.5 <= endAngle) || (startAngle <= Math.PI * 1.5 && Math.PI * 1.5 <= endAngle); - var cutout = cutoutPercentage / 100.0; - var min = {x: contains180 ? -1 : Math.min(start.x * (start.x < 0 ? 1 : cutout), end.x * (end.x < 0 ? 1 : cutout)), y: contains270 ? -1 : Math.min(start.y * (start.y < 0 ? 1 : cutout), end.y * (end.y < 0 ? 1 : cutout))}; - var max = {x: contains0 ? 1 : Math.max(start.x * (start.x > 0 ? 1 : cutout), end.x * (end.x > 0 ? 1 : cutout)), y: contains90 ? 1 : Math.max(start.y * (start.y > 0 ? 1 : cutout), end.y * (end.y > 0 ? 1 : cutout))}; - var size = {width: (max.x - min.x) * 0.5, height: (max.y - min.y) * 0.5}; - minSize = Math.min(availableWidth / size.width, availableHeight / size.height); - offset = {x: (max.x + min.x) * -0.5, y: (max.y + min.y) * -0.5}; - } - - chart.borderWidth = me.getMaxBorderWidth(meta.data); - chart.outerRadius = Math.max((minSize - chart.borderWidth) / 2, 0); - chart.innerRadius = Math.max(cutoutPercentage ? (chart.outerRadius / 100) * (cutoutPercentage) : 1, 0); - chart.radiusLength = (chart.outerRadius - chart.innerRadius) / chart.getVisibleDatasetCount(); - chart.offsetX = offset.x * chart.outerRadius; - chart.offsetY = offset.y * chart.outerRadius; - - meta.total = me.calculateTotal(); - - me.outerRadius = chart.outerRadius - (chart.radiusLength * me.getRingIndex(me.index)); - me.innerRadius = me.outerRadius - chart.radiusLength; - - helpers.each(meta.data, function(arc, index) { - me.updateElement(arc, index, reset); - }); - }, - - updateElement: function(arc, index, reset) { - var me = this; - var chart = me.chart, - chartArea = chart.chartArea, - opts = chart.options, - animationOpts = opts.animation, - centerX = (chartArea.left + chartArea.right) / 2, - centerY = (chartArea.top + chartArea.bottom) / 2, - startAngle = opts.rotation, // non reset case handled later - endAngle = opts.rotation, // non reset case handled later - dataset = me.getDataset(), - circumference = reset && animationOpts.animateRotate ? 0 : arc.hidden ? 0 : me.calculateCircumference(dataset.data[index]) * (opts.circumference / (2.0 * Math.PI)), - innerRadius = reset && animationOpts.animateScale ? 0 : me.innerRadius, - outerRadius = reset && animationOpts.animateScale ? 0 : me.outerRadius, - valueAtIndexOrDefault = helpers.getValueAtIndexOrDefault; - - helpers.extend(arc, { - // Utility - _datasetIndex: me.index, - _index: index, - - // Desired view properties - _model: { - x: centerX + chart.offsetX, - y: centerY + chart.offsetY, - startAngle: startAngle, - endAngle: endAngle, - circumference: circumference, - outerRadius: outerRadius, - innerRadius: innerRadius, - label: valueAtIndexOrDefault(dataset.label, index, chart.data.labels[index]) - } - }); - - var model = arc._model; - // Resets the visual styles - this.removeHoverStyle(arc); - - // Set correct angles if not resetting - if (!reset || !animationOpts.animateRotate) { - if (index === 0) { - model.startAngle = opts.rotation; - } else { - model.startAngle = me.getMeta().data[index - 1]._model.endAngle; - } - - model.endAngle = model.startAngle + model.circumference; - } - - arc.pivot(); - }, - - removeHoverStyle: function(arc) { - Chart.DatasetController.prototype.removeHoverStyle.call(this, arc, this.chart.options.elements.arc); - }, - - calculateTotal: function() { - var dataset = this.getDataset(); - var meta = this.getMeta(); - var total = 0; - var value; - - helpers.each(meta.data, function(element, index) { - value = dataset.data[index]; - if (!isNaN(value) && !element.hidden) { - total += Math.abs(value); - } - }); - - /* if (total === 0) { - total = NaN; - }*/ - - return total; - }, - - calculateCircumference: function(value) { - var total = this.getMeta().total; - if (total > 0 && !isNaN(value)) { - return (Math.PI * 2.0) * (value / total); - } - return 0; - }, - - // gets the max border or hover width to properly scale pie charts - getMaxBorderWidth: function(elements) { - var max = 0, - index = this.index, - length = elements.length, - borderWidth, - hoverWidth; - - for (var i = 0; i < length; i++) { - borderWidth = elements[i]._model ? elements[i]._model.borderWidth : 0; - hoverWidth = elements[i]._chart ? elements[i]._chart.config.data.datasets[index].hoverBorderWidth : 0; - - max = borderWidth > max ? borderWidth : max; - max = hoverWidth > max ? hoverWidth : max; - } - return max; - } - }); -}; - -},{}],18:[function(require,module,exports){ -'use strict'; - -module.exports = function(Chart) { - - var helpers = Chart.helpers; - - Chart.defaults.line = { - showLines: true, - spanGaps: false, - - hover: { - mode: 'label' - }, - - scales: { - xAxes: [{ - type: 'category', - id: 'x-axis-0' - }], - yAxes: [{ - type: 'linear', - id: 'y-axis-0' - }] - } - }; - - function lineEnabled(dataset, options) { - return helpers.getValueOrDefault(dataset.showLine, options.showLines); - } - - Chart.controllers.line = Chart.DatasetController.extend({ - - datasetElementType: Chart.elements.Line, - - dataElementType: Chart.elements.Point, - - addElementAndReset: function(index) { - var me = this; - var options = me.chart.options; - var meta = me.getMeta(); - - Chart.DatasetController.prototype.addElementAndReset.call(me, index); - - // Make sure bezier control points are updated - if (lineEnabled(me.getDataset(), options) && meta.dataset._model.tension !== 0) { - me.updateBezierControlPoints(); - } - }, - - update: function(reset) { - var me = this; - var meta = me.getMeta(); - var line = meta.dataset; - var points = meta.data || []; - var options = me.chart.options; - var lineElementOptions = options.elements.line; - var scale = me.getScaleForId(meta.yAxisID); - var i, ilen, custom; - var dataset = me.getDataset(); - var showLine = lineEnabled(dataset, options); - - // Update Line - if (showLine) { - custom = line.custom || {}; - - // Compatibility: If the properties are defined with only the old name, use those values - if ((dataset.tension !== undefined) && (dataset.lineTension === undefined)) { - dataset.lineTension = dataset.tension; - } - - // Utility - line._scale = scale; - line._datasetIndex = me.index; - // Data - line._children = points; - // Model - line._model = { - // Appearance - // The default behavior of lines is to break at null values, according - // to https://github.com/chartjs/Chart.js/issues/2435#issuecomment-216718158 - // This option gives linse the ability to span gaps - spanGaps: dataset.spanGaps ? dataset.spanGaps : options.spanGaps, - tension: custom.tension ? custom.tension : helpers.getValueOrDefault(dataset.lineTension, lineElementOptions.tension), - backgroundColor: custom.backgroundColor ? custom.backgroundColor : (dataset.backgroundColor || lineElementOptions.backgroundColor), - borderWidth: custom.borderWidth ? custom.borderWidth : (dataset.borderWidth || lineElementOptions.borderWidth), - borderColor: custom.borderColor ? custom.borderColor : (dataset.borderColor || lineElementOptions.borderColor), - borderCapStyle: custom.borderCapStyle ? custom.borderCapStyle : (dataset.borderCapStyle || lineElementOptions.borderCapStyle), - borderDash: custom.borderDash ? custom.borderDash : (dataset.borderDash || lineElementOptions.borderDash), - borderDashOffset: custom.borderDashOffset ? custom.borderDashOffset : (dataset.borderDashOffset || lineElementOptions.borderDashOffset), - borderJoinStyle: custom.borderJoinStyle ? custom.borderJoinStyle : (dataset.borderJoinStyle || lineElementOptions.borderJoinStyle), - fill: custom.fill ? custom.fill : (dataset.fill !== undefined ? dataset.fill : lineElementOptions.fill), - steppedLine: custom.steppedLine ? custom.steppedLine : helpers.getValueOrDefault(dataset.steppedLine, lineElementOptions.stepped), - cubicInterpolationMode: custom.cubicInterpolationMode ? custom.cubicInterpolationMode : helpers.getValueOrDefault(dataset.cubicInterpolationMode, lineElementOptions.cubicInterpolationMode), - // Scale - scaleTop: scale.top, - scaleBottom: scale.bottom, - scaleZero: scale.getBasePixel() - }; - - line.pivot(); - } - - // Update Points - for (i=0, ilen=points.length; i'); - - var data = chart.data; - var datasets = data.datasets; - var labels = data.labels; - - if (datasets.length) { - for (var i = 0; i < datasets[0].data.length; ++i) { - text.push('
  • '); - if (labels[i]) { - text.push(labels[i]); - } - text.push('
  • '); - } - } - - text.push(''); - return text.join(''); - }, - legend: { - labels: { - generateLabels: function(chart) { - var data = chart.data; - if (data.labels.length && data.datasets.length) { - return data.labels.map(function(label, i) { - var meta = chart.getDatasetMeta(0); - var ds = data.datasets[0]; - var arc = meta.data[i]; - var custom = arc.custom || {}; - var getValueAtIndexOrDefault = helpers.getValueAtIndexOrDefault; - var arcOpts = chart.options.elements.arc; - var fill = custom.backgroundColor ? custom.backgroundColor : getValueAtIndexOrDefault(ds.backgroundColor, i, arcOpts.backgroundColor); - var stroke = custom.borderColor ? custom.borderColor : getValueAtIndexOrDefault(ds.borderColor, i, arcOpts.borderColor); - var bw = custom.borderWidth ? custom.borderWidth : getValueAtIndexOrDefault(ds.borderWidth, i, arcOpts.borderWidth); - - return { - text: label, - fillStyle: fill, - strokeStyle: stroke, - lineWidth: bw, - hidden: isNaN(ds.data[i]) || meta.data[i].hidden, - - // Extra data used for toggling the correct item - index: i - }; - }); - } - return []; - } - }, - - onClick: function(e, legendItem) { - var index = legendItem.index; - var chart = this.chart; - var i, ilen, meta; - - for (i = 0, ilen = (chart.data.datasets || []).length; i < ilen; ++i) { - meta = chart.getDatasetMeta(i); - meta.data[index].hidden = !meta.data[index].hidden; - } - - chart.update(); - } - }, - - // Need to override these to give a nice default - tooltips: { - callbacks: { - title: function() { - return ''; - }, - label: function(tooltipItem, data) { - return data.labels[tooltipItem.index] + ': ' + tooltipItem.yLabel; - } - } - } - }; - - Chart.controllers.polarArea = Chart.DatasetController.extend({ - - dataElementType: Chart.elements.Arc, - - linkScales: helpers.noop, - - update: function(reset) { - var me = this; - var chart = me.chart; - var chartArea = chart.chartArea; - var meta = me.getMeta(); - var opts = chart.options; - var arcOpts = opts.elements.arc; - var minSize = Math.min(chartArea.right - chartArea.left, chartArea.bottom - chartArea.top); - chart.outerRadius = Math.max((minSize - arcOpts.borderWidth / 2) / 2, 0); - chart.innerRadius = Math.max(opts.cutoutPercentage ? (chart.outerRadius / 100) * (opts.cutoutPercentage) : 1, 0); - chart.radiusLength = (chart.outerRadius - chart.innerRadius) / chart.getVisibleDatasetCount(); - - me.outerRadius = chart.outerRadius - (chart.radiusLength * me.index); - me.innerRadius = me.outerRadius - chart.radiusLength; - - meta.count = me.countVisibleElements(); - - helpers.each(meta.data, function(arc, index) { - me.updateElement(arc, index, reset); - }); - }, - - updateElement: function(arc, index, reset) { - var me = this; - var chart = me.chart; - var dataset = me.getDataset(); - var opts = chart.options; - var animationOpts = opts.animation; - var scale = chart.scale; - var getValueAtIndexOrDefault = helpers.getValueAtIndexOrDefault; - var labels = chart.data.labels; - - var circumference = me.calculateCircumference(dataset.data[index]); - var centerX = scale.xCenter; - var centerY = scale.yCenter; - - // If there is NaN data before us, we need to calculate the starting angle correctly. - // We could be way more efficient here, but its unlikely that the polar area chart will have a lot of data - var visibleCount = 0; - var meta = me.getMeta(); - for (var i = 0; i < index; ++i) { - if (!isNaN(dataset.data[i]) && !meta.data[i].hidden) { - ++visibleCount; - } - } - - // var negHalfPI = -0.5 * Math.PI; - var datasetStartAngle = opts.startAngle; - var distance = arc.hidden ? 0 : scale.getDistanceFromCenterForValue(dataset.data[index]); - var startAngle = datasetStartAngle + (circumference * visibleCount); - var endAngle = startAngle + (arc.hidden ? 0 : circumference); - - var resetRadius = animationOpts.animateScale ? 0 : scale.getDistanceFromCenterForValue(dataset.data[index]); - - helpers.extend(arc, { - // Utility - _datasetIndex: me.index, - _index: index, - _scale: scale, - - // Desired view properties - _model: { - x: centerX, - y: centerY, - innerRadius: 0, - outerRadius: reset ? resetRadius : distance, - startAngle: reset && animationOpts.animateRotate ? datasetStartAngle : startAngle, - endAngle: reset && animationOpts.animateRotate ? datasetStartAngle : endAngle, - label: getValueAtIndexOrDefault(labels, index, labels[index]) - } - }); - - // Apply border and fill style - me.removeHoverStyle(arc); - - arc.pivot(); - }, - - removeHoverStyle: function(arc) { - Chart.DatasetController.prototype.removeHoverStyle.call(this, arc, this.chart.options.elements.arc); - }, - - countVisibleElements: function() { - var dataset = this.getDataset(); - var meta = this.getMeta(); - var count = 0; - - helpers.each(meta.data, function(element, index) { - if (!isNaN(dataset.data[index]) && !element.hidden) { - count++; - } - }); - - return count; - }, - - calculateCircumference: function(value) { - var count = this.getMeta().count; - if (count > 0 && !isNaN(value)) { - return (2 * Math.PI) / count; - } - return 0; - } - }); -}; - -},{}],20:[function(require,module,exports){ -'use strict'; - -module.exports = function(Chart) { - - var helpers = Chart.helpers; - - Chart.defaults.radar = { - scale: { - type: 'radialLinear' - }, - elements: { - line: { - tension: 0 // no bezier in radar - } - } - }; - - Chart.controllers.radar = Chart.DatasetController.extend({ - - datasetElementType: Chart.elements.Line, - - dataElementType: Chart.elements.Point, - - linkScales: helpers.noop, - - addElementAndReset: function(index) { - Chart.DatasetController.prototype.addElementAndReset.call(this, index); - - // Make sure bezier control points are updated - this.updateBezierControlPoints(); - }, - - update: function(reset) { - var me = this; - var meta = me.getMeta(); - var line = meta.dataset; - var points = meta.data; - var custom = line.custom || {}; - var dataset = me.getDataset(); - var lineElementOptions = me.chart.options.elements.line; - var scale = me.chart.scale; - - // Compatibility: If the properties are defined with only the old name, use those values - if ((dataset.tension !== undefined) && (dataset.lineTension === undefined)) { - dataset.lineTension = dataset.tension; - } - - helpers.extend(meta.dataset, { - // Utility - _datasetIndex: me.index, - // Data - _children: points, - _loop: true, - // Model - _model: { - // Appearance - tension: custom.tension ? custom.tension : helpers.getValueOrDefault(dataset.lineTension, lineElementOptions.tension), - backgroundColor: custom.backgroundColor ? custom.backgroundColor : (dataset.backgroundColor || lineElementOptions.backgroundColor), - borderWidth: custom.borderWidth ? custom.borderWidth : (dataset.borderWidth || lineElementOptions.borderWidth), - borderColor: custom.borderColor ? custom.borderColor : (dataset.borderColor || lineElementOptions.borderColor), - fill: custom.fill ? custom.fill : (dataset.fill !== undefined ? dataset.fill : lineElementOptions.fill), - borderCapStyle: custom.borderCapStyle ? custom.borderCapStyle : (dataset.borderCapStyle || lineElementOptions.borderCapStyle), - borderDash: custom.borderDash ? custom.borderDash : (dataset.borderDash || lineElementOptions.borderDash), - borderDashOffset: custom.borderDashOffset ? custom.borderDashOffset : (dataset.borderDashOffset || lineElementOptions.borderDashOffset), - borderJoinStyle: custom.borderJoinStyle ? custom.borderJoinStyle : (dataset.borderJoinStyle || lineElementOptions.borderJoinStyle), - - // Scale - scaleTop: scale.top, - scaleBottom: scale.bottom, - scaleZero: scale.getBasePosition() - } - }); - - meta.dataset.pivot(); - - // Update Points - helpers.each(points, function(point, index) { - me.updateElement(point, index, reset); - }, me); - - - // Update bezier control points - me.updateBezierControlPoints(); - }, - updateElement: function(point, index, reset) { - var me = this; - var custom = point.custom || {}; - var dataset = me.getDataset(); - var scale = me.chart.scale; - var pointElementOptions = me.chart.options.elements.point; - var pointPosition = scale.getPointPositionForValue(index, dataset.data[index]); - - helpers.extend(point, { - // Utility - _datasetIndex: me.index, - _index: index, - _scale: scale, - - // Desired view properties - _model: { - x: reset ? scale.xCenter : pointPosition.x, // value not used in dataset scale, but we want a consistent API between scales - y: reset ? scale.yCenter : pointPosition.y, - - // Appearance - tension: custom.tension ? custom.tension : helpers.getValueOrDefault(dataset.tension, me.chart.options.elements.line.tension), - radius: custom.radius ? custom.radius : helpers.getValueAtIndexOrDefault(dataset.pointRadius, index, pointElementOptions.radius), - backgroundColor: custom.backgroundColor ? custom.backgroundColor : helpers.getValueAtIndexOrDefault(dataset.pointBackgroundColor, index, pointElementOptions.backgroundColor), - borderColor: custom.borderColor ? custom.borderColor : helpers.getValueAtIndexOrDefault(dataset.pointBorderColor, index, pointElementOptions.borderColor), - borderWidth: custom.borderWidth ? custom.borderWidth : helpers.getValueAtIndexOrDefault(dataset.pointBorderWidth, index, pointElementOptions.borderWidth), - pointStyle: custom.pointStyle ? custom.pointStyle : helpers.getValueAtIndexOrDefault(dataset.pointStyle, index, pointElementOptions.pointStyle), - - // Tooltip - hitRadius: custom.hitRadius ? custom.hitRadius : helpers.getValueAtIndexOrDefault(dataset.hitRadius, index, pointElementOptions.hitRadius) - } - }); - - point._model.skip = custom.skip ? custom.skip : (isNaN(point._model.x) || isNaN(point._model.y)); - }, - updateBezierControlPoints: function() { - var chartArea = this.chart.chartArea; - var meta = this.getMeta(); - - helpers.each(meta.data, function(point, index) { - var model = point._model; - var controlPoints = helpers.splineCurve( - helpers.previousItem(meta.data, index, true)._model, - model, - helpers.nextItem(meta.data, index, true)._model, - model.tension - ); - - // Prevent the bezier going outside of the bounds of the graph - model.controlPointPreviousX = Math.max(Math.min(controlPoints.previous.x, chartArea.right), chartArea.left); - model.controlPointPreviousY = Math.max(Math.min(controlPoints.previous.y, chartArea.bottom), chartArea.top); - - model.controlPointNextX = Math.max(Math.min(controlPoints.next.x, chartArea.right), chartArea.left); - model.controlPointNextY = Math.max(Math.min(controlPoints.next.y, chartArea.bottom), chartArea.top); - - // Now pivot the point for animation - point.pivot(); - }); - }, - - draw: function(ease) { - var meta = this.getMeta(); - var easingDecimal = ease || 1; - - // Transition Point Locations - helpers.each(meta.data, function(point) { - point.transition(easingDecimal); - }); - - // Transition and Draw the line - meta.dataset.transition(easingDecimal).draw(); - - // Draw the points - helpers.each(meta.data, function(point) { - point.draw(); - }); - }, - - setHoverStyle: function(point) { - // Point - var dataset = this.chart.data.datasets[point._datasetIndex]; - var custom = point.custom || {}; - var index = point._index; - var model = point._model; - - model.radius = custom.hoverRadius ? custom.hoverRadius : helpers.getValueAtIndexOrDefault(dataset.pointHoverRadius, index, this.chart.options.elements.point.hoverRadius); - model.backgroundColor = custom.hoverBackgroundColor ? custom.hoverBackgroundColor : helpers.getValueAtIndexOrDefault(dataset.pointHoverBackgroundColor, index, helpers.getHoverColor(model.backgroundColor)); - model.borderColor = custom.hoverBorderColor ? custom.hoverBorderColor : helpers.getValueAtIndexOrDefault(dataset.pointHoverBorderColor, index, helpers.getHoverColor(model.borderColor)); - model.borderWidth = custom.hoverBorderWidth ? custom.hoverBorderWidth : helpers.getValueAtIndexOrDefault(dataset.pointHoverBorderWidth, index, model.borderWidth); - }, - - removeHoverStyle: function(point) { - var dataset = this.chart.data.datasets[point._datasetIndex]; - var custom = point.custom || {}; - var index = point._index; - var model = point._model; - var pointElementOptions = this.chart.options.elements.point; - - model.radius = custom.radius ? custom.radius : helpers.getValueAtIndexOrDefault(dataset.radius, index, pointElementOptions.radius); - model.backgroundColor = custom.backgroundColor ? custom.backgroundColor : helpers.getValueAtIndexOrDefault(dataset.pointBackgroundColor, index, pointElementOptions.backgroundColor); - model.borderColor = custom.borderColor ? custom.borderColor : helpers.getValueAtIndexOrDefault(dataset.pointBorderColor, index, pointElementOptions.borderColor); - model.borderWidth = custom.borderWidth ? custom.borderWidth : helpers.getValueAtIndexOrDefault(dataset.pointBorderWidth, index, pointElementOptions.borderWidth); - } - }); -}; - -},{}],21:[function(require,module,exports){ -/* global window: false */ -'use strict'; - -module.exports = function(Chart) { - - var helpers = Chart.helpers; - - Chart.defaults.global.animation = { - duration: 1000, - easing: 'easeOutQuart', - onProgress: helpers.noop, - onComplete: helpers.noop - }; - - Chart.Animation = Chart.Element.extend({ - currentStep: null, // the current animation step - numSteps: 60, // default number of steps - easing: '', // the easing to use for this animation - render: null, // render function used by the animation service - - onAnimationProgress: null, // user specified callback to fire on each step of the animation - onAnimationComplete: null // user specified callback to fire when the animation finishes - }); - - Chart.animationService = { - frameDuration: 17, - animations: [], - dropFrames: 0, - request: null, - addAnimation: function(chartInstance, animationObject, duration, lazy) { - var me = this; - - if (!lazy) { - chartInstance.animating = true; - } - - for (var index = 0; index < me.animations.length; ++index) { - if (me.animations[index].chartInstance === chartInstance) { - // replacing an in progress animation - me.animations[index].animationObject = animationObject; - return; - } - } - - me.animations.push({ - chartInstance: chartInstance, - animationObject: animationObject - }); - - // If there are no animations queued, manually kickstart a digest, for lack of a better word - if (me.animations.length === 1) { - me.requestAnimationFrame(); - } - }, - // Cancel the animation for a given chart instance - cancelAnimation: function(chartInstance) { - var index = helpers.findIndex(this.animations, function(animationWrapper) { - return animationWrapper.chartInstance === chartInstance; - }); - - if (index !== -1) { - this.animations.splice(index, 1); - chartInstance.animating = false; - } - }, - requestAnimationFrame: function() { - var me = this; - if (me.request === null) { - // Skip animation frame requests until the active one is executed. - // This can happen when processing mouse events, e.g. 'mousemove' - // and 'mouseout' events will trigger multiple renders. - me.request = helpers.requestAnimFrame.call(window, function() { - me.request = null; - me.startDigest(); - }); - } - }, - startDigest: function() { - var me = this; - - var startTime = Date.now(); - var framesToDrop = 0; - - if (me.dropFrames > 1) { - framesToDrop = Math.floor(me.dropFrames); - me.dropFrames = me.dropFrames % 1; - } - - var i = 0; - while (i < me.animations.length) { - if (me.animations[i].animationObject.currentStep === null) { - me.animations[i].animationObject.currentStep = 0; - } - - me.animations[i].animationObject.currentStep += 1 + framesToDrop; - - if (me.animations[i].animationObject.currentStep > me.animations[i].animationObject.numSteps) { - me.animations[i].animationObject.currentStep = me.animations[i].animationObject.numSteps; - } - - me.animations[i].animationObject.render(me.animations[i].chartInstance, me.animations[i].animationObject); - if (me.animations[i].animationObject.onAnimationProgress && me.animations[i].animationObject.onAnimationProgress.call) { - me.animations[i].animationObject.onAnimationProgress.call(me.animations[i].chartInstance, me.animations[i]); - } - - if (me.animations[i].animationObject.currentStep === me.animations[i].animationObject.numSteps) { - if (me.animations[i].animationObject.onAnimationComplete && me.animations[i].animationObject.onAnimationComplete.call) { - me.animations[i].animationObject.onAnimationComplete.call(me.animations[i].chartInstance, me.animations[i]); - } - - // executed the last frame. Remove the animation. - me.animations[i].chartInstance.animating = false; - - me.animations.splice(i, 1); - } else { - ++i; - } - } - - var endTime = Date.now(); - var dropFrames = (endTime - startTime) / me.frameDuration; - - me.dropFrames += dropFrames; - - // Do we have more stuff to animate? - if (me.animations.length > 0) { - me.requestAnimationFrame(); - } - } - }; -}; - -},{}],22:[function(require,module,exports){ -'use strict'; - -module.exports = function(Chart) { - // Global Chart canvas helpers object for drawing items to canvas - var helpers = Chart.canvasHelpers = {}; - - helpers.drawPoint = function(ctx, pointStyle, radius, x, y) { - var type, edgeLength, xOffset, yOffset, height, size; - - if (typeof pointStyle === 'object') { - type = pointStyle.toString(); - if (type === '[object HTMLImageElement]' || type === '[object HTMLCanvasElement]') { - ctx.drawImage(pointStyle, x - pointStyle.width / 2, y - pointStyle.height / 2); - return; - } - } - - if (isNaN(radius) || radius <= 0) { - return; - } - - switch (pointStyle) { - // Default includes circle - default: - ctx.beginPath(); - ctx.arc(x, y, radius, 0, Math.PI * 2); - ctx.closePath(); - ctx.fill(); - break; - case 'triangle': - ctx.beginPath(); - edgeLength = 3 * radius / Math.sqrt(3); - height = edgeLength * Math.sqrt(3) / 2; - ctx.moveTo(x - edgeLength / 2, y + height / 3); - ctx.lineTo(x + edgeLength / 2, y + height / 3); - ctx.lineTo(x, y - 2 * height / 3); - ctx.closePath(); - ctx.fill(); - break; - case 'rect': - size = 1 / Math.SQRT2 * radius; - ctx.beginPath(); - ctx.fillRect(x - size, y - size, 2 * size, 2 * size); - ctx.strokeRect(x - size, y - size, 2 * size, 2 * size); - break; - case 'rectRot': - size = 1 / Math.SQRT2 * radius; - ctx.beginPath(); - ctx.moveTo(x - size, y); - ctx.lineTo(x, y + size); - ctx.lineTo(x + size, y); - ctx.lineTo(x, y - size); - ctx.closePath(); - ctx.fill(); - break; - case 'cross': - ctx.beginPath(); - ctx.moveTo(x, y + radius); - ctx.lineTo(x, y - radius); - ctx.moveTo(x - radius, y); - ctx.lineTo(x + radius, y); - ctx.closePath(); - break; - case 'crossRot': - ctx.beginPath(); - xOffset = Math.cos(Math.PI / 4) * radius; - yOffset = Math.sin(Math.PI / 4) * radius; - ctx.moveTo(x - xOffset, y - yOffset); - ctx.lineTo(x + xOffset, y + yOffset); - ctx.moveTo(x - xOffset, y + yOffset); - ctx.lineTo(x + xOffset, y - yOffset); - ctx.closePath(); - break; - case 'star': - ctx.beginPath(); - ctx.moveTo(x, y + radius); - ctx.lineTo(x, y - radius); - ctx.moveTo(x - radius, y); - ctx.lineTo(x + radius, y); - xOffset = Math.cos(Math.PI / 4) * radius; - yOffset = Math.sin(Math.PI / 4) * radius; - ctx.moveTo(x - xOffset, y - yOffset); - ctx.lineTo(x + xOffset, y + yOffset); - ctx.moveTo(x - xOffset, y + yOffset); - ctx.lineTo(x + xOffset, y - yOffset); - ctx.closePath(); - break; - case 'line': - ctx.beginPath(); - ctx.moveTo(x - radius, y); - ctx.lineTo(x + radius, y); - ctx.closePath(); - break; - case 'dash': - ctx.beginPath(); - ctx.moveTo(x, y); - ctx.lineTo(x + radius, y); - ctx.closePath(); - break; - } - - ctx.stroke(); - }; -}; - -},{}],23:[function(require,module,exports){ -'use strict'; - -module.exports = function(Chart) { - - var helpers = Chart.helpers; - // Create a dictionary of chart types, to allow for extension of existing types - Chart.types = {}; - - // Store a reference to each instance - allowing us to globally resize chart instances on window resize. - // Destroy method on the chart will remove the instance of the chart from this reference. - Chart.instances = {}; - - // Controllers available for dataset visualization eg. bar, line, slice, etc. - Chart.controllers = {}; - - /** - * @class Chart.Controller - * The main controller of a chart. - */ - Chart.Controller = function(instance) { - - this.chart = instance; - this.config = instance.config; - this.options = this.config.options = helpers.configMerge(Chart.defaults.global, Chart.defaults[this.config.type], this.config.options || {}); - this.id = helpers.uid(); - - Object.defineProperty(this, 'data', { - get: function() { - return this.config.data; - } - }); - - // Add the chart instance to the global namespace - Chart.instances[this.id] = this; - - if (this.options.responsive) { - // Silent resize before chart draws - this.resize(true); - } - - this.initialize(); - - return this; - }; - - helpers.extend(Chart.Controller.prototype, /** @lends Chart.Controller */ { - - initialize: function() { - var me = this; - // Before init plugin notification - Chart.plugins.notify('beforeInit', [me]); - - me.bindEvents(); - - // Make sure controllers are built first so that each dataset is bound to an axis before the scales - // are built - me.ensureScalesHaveIDs(); - me.buildOrUpdateControllers(); - me.buildScales(); - me.updateLayout(); - me.resetElements(); - me.initToolTip(); - me.update(); - - // After init plugin notification - Chart.plugins.notify('afterInit', [me]); - - return me; - }, - - clear: function() { - helpers.clear(this.chart); - return this; - }, - - stop: function() { - // Stops any current animation loop occuring - Chart.animationService.cancelAnimation(this); - return this; - }, - - resize: function(silent) { - var me = this; - var chart = me.chart; - var canvas = chart.canvas; - var newWidth = helpers.getMaximumWidth(canvas); - var aspectRatio = chart.aspectRatio; - var newHeight = (me.options.maintainAspectRatio && isNaN(aspectRatio) === false && isFinite(aspectRatio) && aspectRatio !== 0) ? newWidth / aspectRatio : helpers.getMaximumHeight(canvas); - - var sizeChanged = chart.width !== newWidth || chart.height !== newHeight; - - if (!sizeChanged) { - return me; - } - - canvas.width = chart.width = newWidth; - canvas.height = chart.height = newHeight; - - helpers.retinaScale(chart); - - // Notify any plugins about the resize - var newSize = {width: newWidth, height: newHeight}; - Chart.plugins.notify('resize', [me, newSize]); - - // Notify of resize - if (me.options.onResize) { - me.options.onResize(me, newSize); - } - - if (!silent) { - me.stop(); - me.update(me.options.responsiveAnimationDuration); - } - - return me; - }, - - ensureScalesHaveIDs: function() { - var options = this.options; - var scalesOptions = options.scales || {}; - var scaleOptions = options.scale; - - helpers.each(scalesOptions.xAxes, function(xAxisOptions, index) { - xAxisOptions.id = xAxisOptions.id || ('x-axis-' + index); - }); - - helpers.each(scalesOptions.yAxes, function(yAxisOptions, index) { - yAxisOptions.id = yAxisOptions.id || ('y-axis-' + index); - }); - - if (scaleOptions) { - scaleOptions.id = scaleOptions.id || 'scale'; - } - }, - - /** - * Builds a map of scale ID to scale object for future lookup. - */ - buildScales: function() { - var me = this; - var options = me.options; - var scales = me.scales = {}; - var items = []; - - if (options.scales) { - items = items.concat( - (options.scales.xAxes || []).map(function(xAxisOptions) { - return {options: xAxisOptions, dtype: 'category'}; - }), - (options.scales.yAxes || []).map(function(yAxisOptions) { - return {options: yAxisOptions, dtype: 'linear'}; - }) - ); - } - - if (options.scale) { - items.push({options: options.scale, dtype: 'radialLinear', isDefault: true}); - } - - helpers.each(items, function(item) { - var scaleOptions = item.options; - var scaleType = helpers.getValueOrDefault(scaleOptions.type, item.dtype); - var scaleClass = Chart.scaleService.getScaleConstructor(scaleType); - if (!scaleClass) { - return; - } - - var scale = new scaleClass({ - id: scaleOptions.id, - options: scaleOptions, - ctx: me.chart.ctx, - chart: me - }); - - scales[scale.id] = scale; - - // TODO(SB): I think we should be able to remove this custom case (options.scale) - // and consider it as a regular scale part of the "scales"" map only! This would - // make the logic easier and remove some useless? custom code. - if (item.isDefault) { - me.scale = scale; - } - }); - - Chart.scaleService.addScalesToLayout(this); - }, - - updateLayout: function() { - Chart.layoutService.update(this, this.chart.width, this.chart.height); - }, - - buildOrUpdateControllers: function() { - var me = this; - var types = []; - var newControllers = []; - - helpers.each(me.data.datasets, function(dataset, datasetIndex) { - var meta = me.getDatasetMeta(datasetIndex); - if (!meta.type) { - meta.type = dataset.type || me.config.type; - } - - types.push(meta.type); - - if (meta.controller) { - meta.controller.updateIndex(datasetIndex); - } else { - meta.controller = new Chart.controllers[meta.type](me, datasetIndex); - newControllers.push(meta.controller); - } - }, me); - - if (types.length > 1) { - for (var i = 1; i < types.length; i++) { - if (types[i] !== types[i - 1]) { - me.isCombo = true; - break; - } - } - } - - return newControllers; - }, - - resetElements: function() { - var me = this; - helpers.each(me.data.datasets, function(dataset, datasetIndex) { - me.getDatasetMeta(datasetIndex).controller.reset(); - }, me); - }, - - update: function(animationDuration, lazy) { - var me = this; - Chart.plugins.notify('beforeUpdate', [me]); - - // In case the entire data object changed - me.tooltip._data = me.data; - - // Make sure dataset controllers are updated and new controllers are reset - var newControllers = me.buildOrUpdateControllers(); - - // Make sure all dataset controllers have correct meta data counts - helpers.each(me.data.datasets, function(dataset, datasetIndex) { - me.getDatasetMeta(datasetIndex).controller.buildOrUpdateElements(); - }, me); - - Chart.layoutService.update(me, me.chart.width, me.chart.height); - - // Apply changes to the dataets that require the scales to have been calculated i.e BorderColor chages - Chart.plugins.notify('afterScaleUpdate', [me]); - - // Can only reset the new controllers after the scales have been updated - helpers.each(newControllers, function(controller) { - controller.reset(); - }); - - me.updateDatasets(); - - // Do this before render so that any plugins that need final scale updates can use it - Chart.plugins.notify('afterUpdate', [me]); - - me.render(animationDuration, lazy); - }, - - /** - * @method beforeDatasetsUpdate - * @description Called before all datasets are updated. If a plugin returns false, - * the datasets update will be cancelled until another chart update is triggered. - * @param {Object} instance the chart instance being updated. - * @returns {Boolean} false to cancel the datasets update. - * @memberof Chart.PluginBase - * @since version 2.1.5 - * @instance - */ - - /** - * @method afterDatasetsUpdate - * @description Called after all datasets have been updated. Note that this - * extension will not be called if the datasets update has been cancelled. - * @param {Object} instance the chart instance being updated. - * @memberof Chart.PluginBase - * @since version 2.1.5 - * @instance - */ - - /** - * Updates all datasets unless a plugin returns false to the beforeDatasetsUpdate - * extension, in which case no datasets will be updated and the afterDatasetsUpdate - * notification will be skipped. - * @protected - * @instance - */ - updateDatasets: function() { - var me = this; - var i, ilen; - - if (Chart.plugins.notify('beforeDatasetsUpdate', [me])) { - for (i = 0, ilen = me.data.datasets.length; i < ilen; ++i) { - me.getDatasetMeta(i).controller.update(); - } - - Chart.plugins.notify('afterDatasetsUpdate', [me]); - } - }, - - render: function(duration, lazy) { - var me = this; - Chart.plugins.notify('beforeRender', [me]); - - var animationOptions = me.options.animation; - if (animationOptions && ((typeof duration !== 'undefined' && duration !== 0) || (typeof duration === 'undefined' && animationOptions.duration !== 0))) { - var animation = new Chart.Animation(); - animation.numSteps = (duration || animationOptions.duration) / 16.66; // 60 fps - animation.easing = animationOptions.easing; - - // render function - animation.render = function(chartInstance, animationObject) { - var easingFunction = helpers.easingEffects[animationObject.easing]; - var stepDecimal = animationObject.currentStep / animationObject.numSteps; - var easeDecimal = easingFunction(stepDecimal); - - chartInstance.draw(easeDecimal, stepDecimal, animationObject.currentStep); - }; - - // user events - animation.onAnimationProgress = animationOptions.onProgress; - animation.onAnimationComplete = animationOptions.onComplete; - - Chart.animationService.addAnimation(me, animation, duration, lazy); - } else { - me.draw(); - if (animationOptions && animationOptions.onComplete && animationOptions.onComplete.call) { - animationOptions.onComplete.call(me); - } - } - return me; - }, - - draw: function(ease) { - var me = this; - var easingDecimal = ease || 1; - me.clear(); - - Chart.plugins.notify('beforeDraw', [me, easingDecimal]); - - // Draw all the scales - helpers.each(me.boxes, function(box) { - box.draw(me.chartArea); - }, me); - if (me.scale) { - me.scale.draw(); - } - - Chart.plugins.notify('beforeDatasetsDraw', [me, easingDecimal]); - - // Draw each dataset via its respective controller (reversed to support proper line stacking) - helpers.each(me.data.datasets, function(dataset, datasetIndex) { - if (me.isDatasetVisible(datasetIndex)) { - me.getDatasetMeta(datasetIndex).controller.draw(ease); - } - }, me, true); - - Chart.plugins.notify('afterDatasetsDraw', [me, easingDecimal]); - - // Finally draw the tooltip - me.tooltip.transition(easingDecimal).draw(); - - Chart.plugins.notify('afterDraw', [me, easingDecimal]); - }, - - // Get the single element that was clicked on - // @return : An object containing the dataset index and element index of the matching element. Also contains the rectangle that was draw - getElementAtEvent: function(e) { - var me = this; - var eventPosition = helpers.getRelativePosition(e, me.chart); - var elementsArray = []; - - helpers.each(me.data.datasets, function(dataset, datasetIndex) { - if (me.isDatasetVisible(datasetIndex)) { - var meta = me.getDatasetMeta(datasetIndex); - helpers.each(meta.data, function(element) { - if (element.inRange(eventPosition.x, eventPosition.y)) { - elementsArray.push(element); - return elementsArray; - } - }); - } - }); - - return elementsArray.slice(0, 1); - }, - - getElementsAtEvent: function(e) { - var me = this; - var eventPosition = helpers.getRelativePosition(e, me.chart); - var elementsArray = []; - - var found = function() { - if (me.data.datasets) { - for (var i = 0; i < me.data.datasets.length; i++) { - var meta = me.getDatasetMeta(i); - if (me.isDatasetVisible(i)) { - for (var j = 0; j < meta.data.length; j++) { - if (meta.data[j].inRange(eventPosition.x, eventPosition.y)) { - return meta.data[j]; - } - } - } - } - } - }.call(me); - - if (!found) { - return elementsArray; - } - - helpers.each(me.data.datasets, function(dataset, datasetIndex) { - if (me.isDatasetVisible(datasetIndex)) { - var meta = me.getDatasetMeta(datasetIndex), - element = meta.data[found._index]; - if (element && !element._view.skip) { - elementsArray.push(element); - } - } - }, me); - - return elementsArray; - }, - - getElementsAtXAxis: function(e) { - var me = this; - var eventPosition = helpers.getRelativePosition(e, me.chart); - var elementsArray = []; - - var found = function() { - if (me.data.datasets) { - for (var i = 0; i < me.data.datasets.length; i++) { - var meta = me.getDatasetMeta(i); - if (me.isDatasetVisible(i)) { - for (var j = 0; j < meta.data.length; j++) { - if (meta.data[j].inLabelRange(eventPosition.x, eventPosition.y)) { - return meta.data[j]; - } - } - } - } - } - }.call(me); - - if (!found) { - return elementsArray; - } - - helpers.each(me.data.datasets, function(dataset, datasetIndex) { - if (me.isDatasetVisible(datasetIndex)) { - var meta = me.getDatasetMeta(datasetIndex); - var index = helpers.findIndex(meta.data, function(it) { - return found._model.x === it._model.x; - }); - if (index !== -1 && !meta.data[index]._view.skip) { - elementsArray.push(meta.data[index]); - } - } - }, me); - - return elementsArray; - }, - - getElementsAtEventForMode: function(e, mode) { - var me = this; - switch (mode) { - case 'single': - return me.getElementAtEvent(e); - case 'label': - return me.getElementsAtEvent(e); - case 'dataset': - return me.getDatasetAtEvent(e); - case 'x-axis': - return me.getElementsAtXAxis(e); - default: - return e; - } - }, - - getDatasetAtEvent: function(e) { - var elementsArray = this.getElementAtEvent(e); - - if (elementsArray.length > 0) { - elementsArray = this.getDatasetMeta(elementsArray[0]._datasetIndex).data; - } - - return elementsArray; - }, - - getDatasetMeta: function(datasetIndex) { - var me = this; - var dataset = me.data.datasets[datasetIndex]; - if (!dataset._meta) { - dataset._meta = {}; - } - - var meta = dataset._meta[me.id]; - if (!meta) { - meta = dataset._meta[me.id] = { - type: null, - data: [], - dataset: null, - controller: null, - hidden: null, // See isDatasetVisible() comment - xAxisID: null, - yAxisID: null - }; - } - - return meta; - }, - - getVisibleDatasetCount: function() { - var count = 0; - for (var i = 0, ilen = this.data.datasets.length; i