Skip to content

Commit

Permalink
fixes issue adding dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
davelandry committed May 19, 2023
1 parent 1c44c61 commit 42c311e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/cms/src/api/cmsRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ module.exports = function(app) {
const {profileData, includeAllMembers} = req.body;
const {profile_id} = profileData; // eslint-disable-line
profileData.dimension = profileData.dimName;
const oldmeta = await db.profile_meta.findOne({where: {id: profileData.id}}).catch(catcher);
const oldmeta = await db.profile_meta.findOne({where: {id: profileData.id || null}}).catch(catcher);
// Inserts are simple
if (!oldmeta) {
// If no ordering was provided, divine ordering from meta length.
Expand All @@ -484,7 +484,7 @@ module.exports = function(app) {
// Updates are more complex - the user may have changed levels, or even modified the dimension
// entirely. We have to prune the search before repopulating it.
else {
await db.profile_meta.update(profileData, {where: {id: profileData.id}});
await db.profile_meta.update(profileData, {where: {id: profileData.id || null}});
if (oldmeta.cubeName !== profileData.cubeName || oldmeta.dimension !== profileData.dimension || oldmeta.levels.join() !== profileData.levels.join()) {
pruneSearch(oldmeta.cubeName, oldmeta.dimension, oldmeta.levels, db);
await populateSearch(profileData, db, false, false, includeAllMembers);
Expand Down

0 comments on commit 42c311e

Please sign in to comment.