Skip to content

Commit

Permalink
Merge pull request #3267 from Countly/fix/dashboard-dimensions-fix
Browse files Browse the repository at this point in the history
Fix/dashboard dimensions fix
  • Loading branch information
ar2rsawseen authored Jun 15, 2022
2 parents 4b4218d + 882ccf0 commit ef7a5d6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions bin/upgrade/22.03/upgrade_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ then
nodejs "$CUR/scripts/remove_old_flows_collections.js"
nodejs "$CUR/scripts/update_widgets_reports.js"
nodejs "$CUR/scripts/clear_old_report_data.js"
nodejs "$CUR/scripts/mark_upgraded_custom_dashboards.js"

#change config settings
countly config "api.batch_on_master" null --force
Expand Down
16 changes: 14 additions & 2 deletions bin/upgrade/22.06/scripts/reset_upgraded_custom_dashboards.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,23 @@ pluginManager.dbConnection().then(async (countlyDb) => {
});
}
if (doReset) {
/**
* Script ran on 22.03, which means upgrade is from 20.x
* the 22.03 sets gridsize at 4
* So we do not unset position for gridsize 4, since they are coming from 20.x
* The new script in 22.03 would not have run for users who are already on 22.03,
* so they would have gridsize 4 and need to unset the position
*/
await countlyDb.collection('widgets').updateMany(
{ gridsize: 4 },
{ gridsize: { $ne: 4 } },
{
$mul: { 'size.0': 3 },
$unset: { position: 1 },
$unset: { position: 1 }
}
);
await countlyDb.collection('widgets').updateMany(
{ gridsize: 4 },
{
$set: { gridsize: 12 }
}
);
Expand Down

0 comments on commit ef7a5d6

Please sign in to comment.