Skip to main content

index

Context

This feature addresses the need to perform bulk updates on job details, specifically to resolve the issues outlined in #2266 and parent issue #2264. The current process for updating hundreds of jobs with varying schedules is inefficient and prone to error.

The immediate business requirements are:

  • Update Job Titles: Change a large number of jobs from legacy titles (e.g., Food Packer x4) to new, standardized titles (e.g., Food Packer).
  • Update Job Durations: Adjust the start and end times for a specific group of jobs (e.g., change 9am - 5pm to 7am - 5pm for all Culinary Asst jobs).

Key Updates

  • Created a dynamic command UpdateJodJobsDetails that can update posted job details.
  • The command can now update job start and end dates or just the start and end times independently.
  • The logic for calculating total salary and insurance has been corrected to properly account for multi-day jobs.
  • Slots for multi-day jobs are now correctly updated on a per-day basis, ensuring each slot has the new start and end times but retains its original date.

command:update-jod-jobs-details

The new added command has the following features:

  • can be run using a combination of --locations and --job-titles to target a group of jobs
  • --job-ids option allows for direct, targeted updates on a specific list of jobs, ignoring other filters
  • --exclude-job-ids option provides a "blacklist" feature, allowing a user to exclude specific jobs from a broader update query
  • --dry-run flag performs all calculations and generates a detailed CSV report of "before" and "after" values without committing any changes to the database. This is critical for data validation and safety
  • When a new job_start_date and job_end_date are provided, the command automatically recalculates total_job_salary and job_insurance based on the new duration.
  • The command also accepts --new-job-start-time and --new-job-end-time to update only the time of the job excluding the dates.

Test

In this update, we thoroughly performed testing both in local and QA to check if the command is working as expected now, and fixed the bug in generating the post-update CSV report.

  • Dry Run with Title change and new times

Expected result: Generate a pre-update CSV report that will include the before and after data of the jobs without updating the database. The after data must be accurate on what params are passed to the command:

php artisan command:update-jod-jobs-details \
--dry-run \
--locations=1336,140 \
--job-titles="JOD Ambassador x2,JOD Ambassador x3,JOD Ambassador x4" \
--new-title="JOD Ambassador" \
--new-job-start-time="08:00:00" \
--new-job-end-time="18:00:00" \
--start-date="2025-09-08" \
--end-date="2025-09-30"

Actual Result: jod_jobs_update_report_pre_update_2025-09-07_22-58-09.csv

  • Live Run with title change and new times

Expected result: Generate a post-update CSV report that will include the before and now data of the updated jobs. The now data must be accurate on what was in the dry run report, and the actual value in the database:

php artisan command:update-jod-jobs-details \
--locations=1336,140 \
--job-titles="JOD Ambassador x2,JOD Ambassador x3,JOD Ambassador x4" \
--new-title="JOD Ambassador" \
--new-job-start-time="08:00:00" \
--new-job-end-time="18:00:00" \
--start-date="2025-09-08" \
--end-date="2025-09-30"

Actual Result: jod_jobs_update_report_post_update_2025-09-07_23-02-25.csv


  • Dry Run with Title change and new times for specific jobs

Expected result: Generate a pre-update CSV report that will include the before and after data of the specific jobs without updating the database. Since we already updated the data in the previous test, we are now going to pass job-ids as a parameter of the command to be specific with the update of jobs:

php artisan command:update-jod-jobs-details \
--dry-run \
--job-ids=476222,476221 \
--new-title="JOD Ambassador x2" \
--new-job-start-time="07:00:00" \
--new-job-end-time="19:00:00"

Actual Result: jod_jobs_update_report_pre_update_2025-09-07_23-43-46.csv

  • Live Run with title change and new times for specific jobs

Expected result: Generate a post-update CSV report that will include the before and now data of the updated jobs. We will also used job-ids param to update specific jobs to test if post-update CSV is generated.

php artisan command:update-jod-jobs-details \
--job-ids=476222,476221 \
--new-title="JOD Ambassador x2" \
--new-job-start-time="07:00:00" \
--new-job-end-time="19:00:00"

Actual Result: jod_jobs_update_report_post_update_2025-09-07_23-45-43.csv

FoodFare Job Update Commands

These will be the commands to be executed in updating the jobs for FoodFare:

Food Packer

php artisan command:update-jod-jobs-details \
--locations=2228,2225,2227,2226 \
--job-titles="Food Packer x4" \
--new-title="Food Packer" \
--start-date="2025-09-01 00:00:00" \
--end-date="2025-09-30 23:59:59" \

Culinary Asst

php artisan command:update-jod-jobs-details \
--locations=2228,2225,2227,2226 \
--job-titles="Culinary Asst x2,Culinary x2" \
--new-title="Culinary Asst" \
--new-job-start-time="2025-09-06 07:00:00" \
--new-job-end-time="2025-09-06 17:00:00" \
--start-date="2025-09-01 00:00:00" \
--end-date="2025-09-30 23:59:59" \

Limitations

Here are the list of limitations of the command that can be improved in the future:

  • The command cannot create slots if updating a single-day job into multi-day job
  • The command cannot delete slots if updating a multi-day job into single-day job
  • Cannot update related data from the following tables:
    • slot_user
    • payments
  • Command is focused more on just updating jod_jobs details such as:
    • job_title
    • job_start_date
    • job_end_date
    • recalculating total_job_salary
    • recalculating job_insurance
  • Other jod_jobs columns cannot be updated in this command

Note

Basically focused on the necessary column we need to update for the company FoodFare for now