Skip to content

Commit 76b25fb

Browse files
committed
Minor improvements to the query builder group by time method
Now it always leaves the properties in a consistent state, specifically during empty calls
1 parent 5765748 commit 76b25fb

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

influxdb-client/QueryBuilder.m

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
Before = []
1111
After = []
1212
Where = []
13-
GroupByTimeInterval = {}
14-
GroupByTimeFill = []
13+
GroupByTimeInterval = ''
14+
GroupByTimeFill = ''
1515
GroupByTags = {}
1616
Limit = []
1717
end
@@ -176,18 +176,16 @@
176176

177177
% Configure a group by time clause
178178
function obj = groupByTime(obj, time, fill)
179-
if ~isempty(time)
180-
obj.GroupByTimeInterval = {['time(' time ')']};
181-
if nargin > 2
182-
if ~isempty(fill)
183-
obj.GroupByTimeFill = ['fill(' fill ')'];
184-
else
185-
obj.GroupByTimeFill = [];
186-
end
179+
if nargin > 1 && ~isempty(time)
180+
obj.GroupByTimeInterval = ['time(' time ')'];
181+
if nargin > 2 && ~isempty(fill)
182+
obj.GroupByTimeFill = ['fill(' fill ')'];
183+
else
184+
obj.GroupByTimeFill = '';
187185
end
188186
else
189-
obj.GroupByTimeInterval = {};
190-
obj.GroupByTimeInterval = [];
187+
obj.GroupByTimeInterval = '';
188+
obj.GroupByTimeFill = '';
191189
end
192190
end
193191

0 commit comments

Comments
 (0)