diff options
Diffstat (limited to 'parsers/logbooks.py')
-rw-r--r-- | parsers/logbooks.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/parsers/logbooks.py b/parsers/logbooks.py index c4f2c9c..b18e839 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -114,6 +114,7 @@ def EnterLogIntoDbase(date, place, title, text, trippeople, expedition, logtime_ expeditionday = expedition.get_expedition_day(date) lookupAttribs={'date':date, 'title':title} # 'cave' is converted to a string doing this, which renders as the cave slug. + # but it is a db query which we should try to avoid - rewrite this nonLookupAttribs={'place':place, 'text':text, 'expedition':expedition, 'cave_slug':str(cave), 'slug':slugify(title)[:50], 'entry_type':entry_type} lbo, created=save_carefully(LogbookEntry, lookupAttribs, nonLookupAttribs) @@ -356,6 +357,8 @@ def SetDatesFromLogbookEntries(expedition): Sets the date_from and date_to field for an expedition based on persontrips. Then sets the expedition date_from and date_to based on the personexpeditions. """ + # Probably a faster way to do this. This uses a lot of db queries, but we have all this + # in memory.. for personexpedition in expedition.personexpedition_set.all(): persontrips = personexpedition.persontrip_set.order_by('logbook_entry__date') # sequencing is difficult to do |