text: # -*- coding: utf-8 -*-
  # Generated by Django 1.10.2 on 2017-01-21 18:42
  from __future__ import unicode_literals
  
  from django.db import migrations
  
  
  def calc_total_time(apps, schema_editor):
      ToiletLecture = apps.get_model("toilet", "ToiletLecture")
      for toilet_lecture in ToiletLecture.objects.all():
          if toilet_lecture.end_at:
              toilet_lecture.total_time = toilet_lecture.end_at - toilet_lecture.start_at
              toilet_lecture.save()
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('toilet', '0003_toiletlecture_total_time'),
      ]
  
      operations = [
          migrations.RunPython(calc_total_time),
      ]
  