forked from 0x2620/pandora
merge
This commit is contained in:
commit
2e8fb609bf
3 changed files with 8 additions and 1 deletions
|
@ -11,7 +11,9 @@ import managers
|
|||
|
||||
class MetaClip:
|
||||
def update_calculated_values(self):
|
||||
self.duration = self.end - self.start
|
||||
start = min(self.start, self.item.sort.duration)
|
||||
end = min(self.end, self.item.sort.duration)
|
||||
self.duration = end - start
|
||||
if self.duration > 0:
|
||||
self.hue, self.saturation, self.lightness = extract.average_color(
|
||||
self.item.timeline_prefix, self.start, self.end)
|
||||
|
|
|
@ -23,6 +23,7 @@ class SessionData(models.Model):
|
|||
firstseen = models.DateTimeField(auto_now_add=True, db_index=True)
|
||||
lastseen = models.DateTimeField(auto_now=True, db_index=True)
|
||||
username = models.CharField(max_length=255, null=True, db_index=True)
|
||||
level = models.IntegerField(default=0)
|
||||
|
||||
timesseen = models.IntegerField(default=0)
|
||||
ip = models.CharField(default='', max_length=255)
|
||||
|
@ -40,7 +41,10 @@ class SessionData(models.Model):
|
|||
def save(self, *args, **kwargs):
|
||||
if self.user:
|
||||
self.username = self.user.username
|
||||
self.level = self.user.get_profile().level
|
||||
self.firstseen = self.user.date_joined
|
||||
else:
|
||||
self.level = 0
|
||||
super(SessionData, self).save(*args, **kwargs)
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -422,6 +422,7 @@ def order_query(qs, sort):
|
|||
'useragent': 'useragent',
|
||||
'username': 'username',
|
||||
'windowsize': 'windowsize',
|
||||
'level': 'level',
|
||||
}.get(e['key'], 'user__profile__%s'%e['key'])
|
||||
if key == 'user__profile__numberoflists':
|
||||
qs = qs.annotate(numberoflists=Sum('user__lists'))
|
||||
|
|
Loading…
Reference in a new issue