From 3832c46f1c9c741dce7b35e2dd438cd0ce098f36 Mon Sep 17 00:00:00 2001 From: Domagoj Kriskovic Date: Mon, 24 Nov 2025 15:17:05 +0100 Subject: [PATCH] Skip projects that are already in new track_changes format GitOrigin-RevId: 3162d15852664707e2072b5c7af6d3849f1d0677 --- .../convert_track_changes_to_explicit_format.mjs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/services/web/scripts/convert_track_changes_to_explicit_format.mjs b/services/web/scripts/convert_track_changes_to_explicit_format.mjs index ed812c7e89..226b5121c2 100644 --- a/services/web/scripts/convert_track_changes_to_explicit_format.mjs +++ b/services/web/scripts/convert_track_changes_to_explicit_format.mjs @@ -57,6 +57,15 @@ async function processProject(project) { ) } + if (typeof project.track_changes === 'object') { + if (DEBUG) { + console.log( + `Skipping project ${project._id} as it is already in the new format` + ) + } + return + } + const newTrackChangesState = await CollaboratorsHandler.promises.convertTrackChangesToExplicitFormat( project._id, @@ -76,6 +85,13 @@ async function processProject(project) { { _id: project._id }, { $set: { track_changes: newTrackChangesState } } ) + console.log( + `Updated project ${project._id} track_changes from ${JSON.stringify(project.track_changes)} to ${JSON.stringify(newTrackChangesState)}` + ) + } else { + console.log( + `Dry run - would have updated project ${project._id} track_changes from ${JSON.stringify(project.track_changes)} to ${JSON.stringify(newTrackChangesState)}` + ) } }