harvest-dev team mailing list archive
-
harvest-dev team
-
Mailing list archive
-
Message #00166
[Merge] lp:~dholbach/harvest/schema-changes into lp:harvest
Daniel Holbach has proposed merging lp:~dholbach/harvest/schema-changes into lp:harvest.
Requested reviews:
harvest-dev (harvest-dev)
Related bugs:
#581726 in addition to "irrelevant" add "applied"
https://bugs.launchpad.net/bugs/581726
#585847 Note down who marked something as irrelevant/applied
https://bugs.launchpad.net/bugs/585847
--
https://code.launchpad.net/~dholbach/harvest/schema-changes/+merge/26598
Your team harvest-dev is requested to review the proposed merge of lp:~dholbach/harvest/schema-changes into lp:harvest.
=== modified file 'harvest/common/launchpad.py'
--- harvest/common/launchpad.py 2010-01-27 12:34:37 +0000
+++ harvest/common/launchpad.py 2010-06-02 14:38:19 +0000
@@ -4,7 +4,6 @@
from django.conf import settings
-import sys
import os
def lp_login(lp_instance=EDGE_SERVICE_ROOT):
=== modified file 'harvest/opportunities/models.py'
--- harvest/opportunities/models.py 2010-03-08 16:32:02 +0000
+++ harvest/opportunities/models.py 2010-06-02 14:38:19 +0000
@@ -1,6 +1,8 @@
from django.db import models
from django.utils.translation import ugettext as _
+import datetime
+
PACKAGE_GREEN_THRESHOLD = 5
PACKAGE_RED_THRESHOLD = 20
@@ -84,6 +86,7 @@
last_updated = models.DateTimeField(_("Last Updated"), null=True)
since = models.DateTimeField(_("Since"), help_text=_("On the list since"), null=True)
reviewed = models.BooleanField(_("Irrelevant"), default=False, blank=True)
+ applied = models.BooleanField(_("Applied"), default=False, blank=True)
sourcepackage = models.ForeignKey(SourcePackage)
opportunitylist = models.ForeignKey(OpportunityList)
comment = models.TextField(_("Comment"), blank=True)
@@ -101,3 +104,22 @@
@models.permalink
def get_absolute_url(self):
return ('opportunity_detail', [self.id])
+
+class Person(models.Model):
+ lpid = models.TextField(_("Who"), max_length=80)
+
+class ActionLogEntry(models.Model):
+ timestamp = models.DateTimeField(_("Timestamp"))
+ who = models.ForeignKey(Person)
+ action = models.TextField(_("Action"), max_length=120)
+ opportunity = models.ForeignKey(Opportunity, blank=True)
+
+def log_action(who, action=None, opportunity=None):
+ person, created = Person.objects.get_or_create(lpid=who)
+ if created:
+ person.save()
+ log_entry = ActionLogEntry(timestamp=datetime.datetime.now(),
+ who=person, action=action,
+ opportunity=opportunity)
+ log_entry.save()
+
=== modified file 'harvest/opportunities/views.py'
--- harvest/opportunities/views.py 2010-03-08 16:33:21 +0000
+++ harvest/opportunities/views.py 2010-06-02 14:38:19 +0000
@@ -54,6 +54,17 @@
if request.method == "POST":
form = forms.OpportunityForm(data=request.POST, instance=opportunity)
if form.is_valid():
+ if form.cleaned_data["reviewed"] != opportunity.reviewed:
+ models.log_action(request.user.username, action="marked as reviewed",
+ opportunity=opportunity)
+ if form.cleaned_data["applied"] != opportunity.applied:
+ models.log_action(request.user.username, action="marked as applied",
+ opportunity=opportunity)
+ if form.cleaned_data["comment"] != opportunity.comment:
+ models.log_action(request.user.username,
+ action="changed comment to: '%s'" % \
+ form.cleaned_data["comment"],
+ opportunity=opportunity)
form.save()
return HttpResponseRedirect(request.POST["next"])
else: