Skip to content
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.

Commit

Permalink
Merge pull request #859 from akatsoulas/1092989-post-event-metrics
Browse files Browse the repository at this point in the history
Add a free text field in post event metrics.
  • Loading branch information
akatsoulas committed Nov 12, 2014
2 parents 9dc4137 + 9d17ef1 commit c5acc23
Show file tree
Hide file tree
Showing 9 changed files with 409 additions and 11 deletions.
9 changes: 9 additions & 0 deletions remo/base/static/base/css/app-fd4.less
Original file line number Diff line number Diff line change
Expand Up @@ -2123,6 +2123,15 @@ meter::-o-meter-suboptimum-value {
textarea + .required-field {
top: -50px;
}
textarea.postevent-details {
height: 100px;
font-size: 13px;
background: none;
border: none;
border-bottom: 1px solid #ccc;
border-radius: 0px;
box-shadow: none;
}
.more-info {
font-size: 10px;
}
Expand Down
3 changes: 2 additions & 1 deletion remo/dashboard/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def resolve(instance, user, name):
action_model = ContentType.objects.get_for_model(instance)
action_items = ActionItem.objects.filter(content_type=action_model,
object_id=instance.id,
user=user, name=name)
name__icontains=name,
user=user)
action_items.update(completed=True, resolved=True)


Expand Down
10 changes: 6 additions & 4 deletions remo/events/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ def clean(self):

# Disable adding new forms in post event form.
if self.instance.is_past_event and self.instance.has_new_metrics:
if self.extra_forms:
if self.extra_forms and len(self.extra_forms) > 2:
error_msg = 'You cannot add new metrics in a past event.'
raise ValidationError(error_msg)
elif [key for key in self.cleaned_data if key.get('DELETE')]:
if [key for key in self.cleaned_data if key.get('DELETE')]:
error_msg = 'You cannot delete metrics in a past event.'
raise ValidationError(error_msg)

Expand Down Expand Up @@ -133,6 +133,7 @@ def save(self, *args, **kwargs):
if self.clone:
self.instance.pk = None
self.instance.outcome = None
self.instance.details = ''
return super(EventMetricsForm, self).save(*args, **kwargs)


Expand All @@ -142,12 +143,13 @@ class PostEventMetricsForm(EventMetricsForm):
error_messages={'invalid': 'Please enter a number.'})

class Meta(EventMetricsForm.Meta):
fields = ('metric', 'expected_outcome', 'outcome')
fields = ('metric', 'expected_outcome', 'outcome', 'details')

def __init__(self, *args, **kwargs):
"""Make expected outcome readonly."""
super(PostEventMetricsForm, self).__init__(*args, **kwargs)
self.fields['expected_outcome'].widget.attrs['readonly'] = True
if self.instance.expected_outcome:
self.fields['expected_outcome'].widget.attrs['readonly'] = True


class EventForm(happyforms.ModelForm):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,4 @@ def backwards(self, orm):
}
}

complete_apps = ['events']
complete_apps = ['events']
3 changes: 1 addition & 2 deletions remo/events/migrations/0016_tag_events_old_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.utils.timezone import now


class Migration(DataMigration):

Expand Down Expand Up @@ -67,6 +65,7 @@ def backwards(self, orm):
},
u'events.event': {
'Meta': {'ordering': "['start']", 'object_name': 'Event'},
'actual_attendance': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'attendees': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'events_attended'", 'symmetrical': 'False', 'through': u"orm['events.Attendance']", 'to': u"orm['auth.User']"}),
'budget_bug': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'event_budget_requests'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': u"orm['remozilla.Bug']"}),
'categories': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'events_categories'", 'symmetrical': 'False', 'to': u"orm['profiles.FunctionalArea']"}),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models


class Migration(SchemaMigration):

def forwards(self, orm):
# Adding field 'EventMetricOutcome.details'
db.add_column(u'events_eventmetricoutcome', 'details',
self.gf('django.db.models.fields.TextField')(default='', blank=True),
keep_default=False)


def backwards(self, orm):
# Deleting field 'EventMetricOutcome.details'
db.delete_column(u'events_eventmetricoutcome', 'details')


models = {
u'auth.group': {
'Meta': {'object_name': 'Group'},
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
u'auth.permission': {
'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
u'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
u'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'dashboard.actionitem': {
'Meta': {'ordering': "['-due_date', '-updated_on', '-created_on']", 'object_name': 'ActionItem'},
'completed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
'created_on': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'due_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'object_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
'priority': ('django.db.models.fields.IntegerField', [], {}),
'resolved': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'updated_on': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'action_items_assigned'", 'to': u"orm['auth.User']"})
},
u'events.attendance': {
'Meta': {'object_name': 'Attendance'},
'date_subscribed': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'email': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'event': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['events.Event']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"})
},
u'events.event': {
'Meta': {'ordering': "['start']", 'object_name': 'Event'},
'actual_attendance': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'attendees': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'events_attended'", 'symmetrical': 'False', 'through': u"orm['events.Attendance']", 'to': u"orm['auth.User']"}),
'budget_bug': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'event_budget_requests'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': u"orm['remozilla.Bug']"}),
'categories': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'events_categories'", 'symmetrical': 'False', 'to': u"orm['profiles.FunctionalArea']"}),
'city': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50'}),
'converted_visitors': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'country': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
'description': ('django.db.models.fields.TextField', [], {}),
'end': ('django.db.models.fields.DateTimeField', [], {}),
'estimated_attendance': ('django.db.models.fields.PositiveIntegerField', [], {}),
'external_link': ('django.db.models.fields.URLField', [], {'max_length': '300', 'null': 'True', 'blank': 'True'}),
'extra_content': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
'goals': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'events_goals'", 'symmetrical': 'False', 'to': u"orm['events.EventGoal']"}),
'has_new_metrics': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'hashtag': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'lat': ('django.db.models.fields.FloatField', [], {}),
'lon': ('django.db.models.fields.FloatField', [], {}),
'metrics': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['events.EventMetric']", 'through': u"orm['events.EventMetricOutcome']", 'symmetrical': 'False'}),
'mozilla_event': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'owner': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'events_created'", 'to': u"orm['auth.User']"}),
'planning_pad_url': ('django.db.models.fields.URLField', [], {'max_length': '300', 'blank': 'True'}),
'region': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50', 'blank': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '100', 'blank': 'True'}),
'start': ('django.db.models.fields.DateTimeField', [], {}),
'swag_bug': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'event_swag_requests'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': u"orm['remozilla.Bug']"}),
'times_edited': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
'timezone': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'venue': ('django.db.models.fields.CharField', [], {'max_length': '150'})
},
u'events.eventcomment': {
'Meta': {'ordering': "['id']", 'object_name': 'EventComment'},
'comment': ('django.db.models.fields.TextField', [], {}),
'created_on': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'event': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['events.Event']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"})
},
u'events.eventgoal': {
'Meta': {'ordering': "['name']", 'object_name': 'EventGoal'},
'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '127'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '127', 'blank': 'True'})
},
u'events.eventmetric': {
'Meta': {'ordering': "['name']", 'object_name': 'EventMetric'},
'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'events.eventmetricoutcome': {
'Meta': {'object_name': 'EventMetricOutcome'},
'details': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
'event': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['events.Event']"}),
'expected_outcome': ('django.db.models.fields.IntegerField', [], {}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'metric': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['events.EventMetric']"}),
'outcome': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
},
u'events.metric': {
'Meta': {'object_name': 'Metric'},
'event': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['events.Event']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'outcome': ('django.db.models.fields.CharField', [], {'max_length': '300'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '300'})
},
u'profiles.functionalarea': {
'Meta': {'ordering': "['name']", 'object_name': 'FunctionalArea'},
'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '100', 'blank': 'True'})
},
u'remozilla.bug': {
'Meta': {'ordering': "['-bug_last_change_time']", 'object_name': 'Bug'},
'assigned_to': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'bugs_assigned'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': u"orm['auth.User']"}),
'budget_needinfo': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.User']", 'symmetrical': 'False'}),
'bug_creation_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'bug_id': ('django.db.models.fields.PositiveIntegerField', [], {'unique': 'True'}),
'bug_last_change_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
'cc': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'bugs_cced'", 'symmetrical': 'False', 'to': u"orm['auth.User']"}),
'component': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'council_member_assigned': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'council_vote_requested': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'created_on': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'bugs_created'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': u"orm['auth.User']"}),
'first_comment': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'pending_mentor_validation': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'resolution': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '30'}),
'status': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '30'}),
'summary': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '500'}),
'updated_on': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'whiteboard': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '500'})
}
}

complete_apps = ['events']
Loading

0 comments on commit c5acc23

Please sign in to comment.