Skip to content

Commit 5aa0f22

Browse files
author
Miguel Leon
authored
Merge pull request #142 from miguelcleon/miguelworking
properly setup time series start and end dates
2 parents 69f4e82 + 7d1a361 commit 5aa0f22

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

odm2admin/management/commands/ProcessDataLoggerFile.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,23 @@ def updateStartDateEndDate(results, startdate, enddate):
6969
try:
7070
# raise CommandError(" start date "str(startdate)))
7171
#
72-
Resultextensionpropertyvalues.objects.filter(resultid=results.resultid).filter(
73-
propertyid=StartDateProperty).update(propertyvalue=startdate)
74-
# repvstart.propertyvalue=startdate
75-
76-
Resultextensionpropertyvalues.objects.filter(resultid=results.resultid).filter(
77-
propertyid=EndDateProperty).update(propertyvalue=enddate)
78-
# repvend.propertyvalue = enddate
72+
repvstart= Resultextensionpropertyvalues.objects.filter(resultid=results.resultid).filter(
73+
propertyid=StartDateProperty).get() #.update(propertyvalue=startdate)
74+
repvstart.propertyvalue=startdate
75+
repvstart.save()
76+
repvend = Resultextensionpropertyvalues.objects.filter(resultid=results.resultid).filter(
77+
propertyid=EndDateProperty).get() #.update(propertyvalue=enddate)
78+
repvend.propertyvalue = enddate
79+
repvend.save()
7980

8081
except ObjectDoesNotExist:
8182
# raise CommandError("couldn't find extension property values " +str(repvstart) + "for " +
8283
# str(StartDateProperty + "for" + str(results))
83-
repvstart = Resultextensionpropertyvalues(resultid=results, propertyid=StartDateProperty,
84+
repvstart = Resultextensionpropertyvalues(resultid=results.resultid, propertyid=StartDateProperty,
8485
propertyvalue=startdate)
8586
# print(repvstart.propertyvalue)
8687
repvstart.save()
87-
repvend = Resultextensionpropertyvalues(resultid=results, propertyid=EndDateProperty,
88+
repvend = Resultextensionpropertyvalues(resultid=results.resultid, propertyid=EndDateProperty,
8889
propertyvalue=enddate)
8990
# print(repvend.propertyvalue)
9091
repvend.save()

0 commit comments

Comments
 (0)