Add job number filter to prevent processing old jobs
- Add MIN_JOB_NUMBER = 663000 threshold in Config - Skip jobs with OMG# below 663000 (old jobs) - Only process new jobs >= 663000 - Log skipped old jobs for visibility - Move skipped files to processed folder (not failed) This prevents conflicts with existing old entries that may not have proper custom fields populated.
This commit is contained in:
parent
143aaf245a
commit
fb17c9b63b
1 changed files with 15 additions and 0 deletions
|
|
@ -52,6 +52,9 @@ class Config:
|
|||
WRIKE_SPACE_NAME = "LGL Team"
|
||||
DELIVERABLE_ITEM_TYPE_ID = None # Custom item types not available in LGL team space
|
||||
|
||||
# Job number filtering - only process new jobs
|
||||
MIN_JOB_NUMBER = 663000 # Only accept job numbers >= this value
|
||||
|
||||
# Custom field IDs for LGL Team space
|
||||
CUSTOM_FIELDS = {
|
||||
"budget": "IEAGUQQ3JUAJHWE5",
|
||||
|
|
@ -660,6 +663,18 @@ class WrikeMonitor:
|
|||
project_details = job_spec.get("ProjectDetails", {})
|
||||
job_details = job_spec.get("JobDetails", {})
|
||||
|
||||
# Validate job number - only process new jobs (>= MIN_JOB_NUMBER)
|
||||
job_number = job_details.get("Number", "")
|
||||
try:
|
||||
job_num_int = int(job_number) if job_number else 0
|
||||
if job_num_int > 0 and job_num_int < Config.MIN_JOB_NUMBER:
|
||||
self.logger.info(f"⊘ Skipping old job #{job_number} (below threshold {Config.MIN_JOB_NUMBER}) - {file_path.name}")
|
||||
# Move to processed folder (not failed, since it's intentionally skipped)
|
||||
self.move_to_processed(file_path)
|
||||
return True
|
||||
except ValueError:
|
||||
pass # Invalid job number, continue processing
|
||||
|
||||
# Extract folder name
|
||||
business_area = project_details.get("BusinessArea", job_details.get("BusinessArea", ""))
|
||||
folder_name = self.parse_business_area(business_area)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue