Beispiel #1
0
    def save(self, *args, **kwargs):
        try:
            old_fell_asleep_time = GutterBumper.objects.get(pk=self.pk).fell_asleep_at
        except:
            old_fell_asleep_time = None

        if self.calculated_sleep_hrs:
            self.sleep_hrs = self.calculated_sleep_hrs

        if not self.id:
            self.moon_phase = moon_position(datetime.datetime.combine(self.date, datetime.datetime.min.time()))

        # if not self.weight:
        #     self.weight = self.fitbit_data.weight
        #     self.body_fat_percent = self.fitbit_data.body_fat_percent

        super(GutterBumper, self).save(*args, **kwargs)
        if old_fell_asleep_time and old_fell_asleep_time != self.fell_asleep_at and self.tomorrow:
            self.tomorrow.save()
Beispiel #2
0
    def save(self, *args, **kwargs):
        try:
            old_fell_asleep_time = GutterBumper.objects.get(pk=self.pk).fell_asleep_at
        except:
            old_fell_asleep_time = None

        if self.calculated_sleep_hrs:
            self.sleep_hrs = self.calculated_sleep_hrs

        if not self.id:
            self.moon_phase = moon_position(datetime.datetime.combine(self.date, datetime.datetime.min.time()))

        # if not self.weight:
        #     self.weight = self.fitbit_data.weight
        #     self.body_fat_percent = self.fitbit_data.body_fat_percent

        super(GutterBumper, self).save(*args, **kwargs)
        if old_fell_asleep_time and old_fell_asleep_time != self.fell_asleep_at and self.tomorrow:
            self.tomorrow.save()
Beispiel #3
0
 def forwards(self, orm):
     for b in orm.GutterBumper.objects.all():
         b.moon_phase = moon_position(
             datetime.datetime.combine(b.date,
                                       datetime.datetime.min.time()))
         b.save()
Beispiel #4
0
 def forwards(self, orm):
     for b in orm.GutterBumper.objects.all():
         b.moon_phase = moon_position(datetime.datetime.combine(b.date, datetime.datetime.min.time()))
         b.save()