rt-auto-remind: Avoid <= or >= operands for date searches.
RT doesn't seem to support these well. See the comment for details.
This commit is contained in:
		
							parent
							
								
									ddf525f0c5
								
							
						
					
					
						commit
						b1249cc40f
					
				
					 1 changed files with 6 additions and 2 deletions
				
			
		|  | @ -124,7 +124,7 @@ def main(arglist=None, stdout=sys.stdout, stderr=sys.stderr): | |||
|     if (last_run_range_end is not None) and (last_run_range_end > date_range_start): | ||||
|         date_range_start = last_run_range_end | ||||
|     date_range_end = start_datetime + args.max_delta | ||||
|     search = '({search}) AND {field} > "{start}" AND {field} <= "{end}"'.format( | ||||
|     search = '({search}) AND {field} > "{start}" AND {field} < "{end}"'.format( | ||||
|         search=args.search, | ||||
|         field=args.date_field, | ||||
|         start=date_range_start.strftime(DATETIME_FMT), | ||||
|  | @ -144,7 +144,11 @@ def main(arglist=None, stdout=sys.stdout, stderr=sys.stderr): | |||
|         except subprocess.CalledProcessError as error: | ||||
|             returncode = error.returncode | ||||
|         else: | ||||
|             last_run_db.save(date_range_end) | ||||
|             # RT doesn't support <= or >= operands well in date searches. | ||||
|             # We work around that by storing the previous second so our next | ||||
|             # search will find tickets that were exactly at date_range_end | ||||
|             # for this run. | ||||
|             last_run_db.save(date_range_end - datetime.timedelta(seconds=1)) | ||||
|             returncode = 0 | ||||
|     last_run_db.close() | ||||
|     return returncode | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Brett Smith
						Brett Smith