Skip to content

Commit

Permalink
chore: use simpler approach by dropping existing enabled override in …
Browse files Browse the repository at this point in the history
…response
  • Loading branch information
nunogois committed Nov 29, 2024
1 parent 608c233 commit 3b6789d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -535,13 +535,9 @@ class FeatureStrategiesStore implements IFeatureStrategiesStore {
return a.sortOrder - b.sortOrder;
});
featureToggle.environments = featureToggle.environments.map((e) => {
if (e.strategies && e.strategies.length === 0) {
e.enabled = false;
}
e.strategies = e.strategies
.filter(({ milestoneId }) => !milestoneId)
.map(({ milestoneId, ...strategy }) => strategy)
.sort((a, b) => a.sortOrder - b.sortOrder);
e.strategies = e.strategies.sort(
(a, b) => a.sortOrder - b.sortOrder,
);
return e;
});

Expand Down Expand Up @@ -861,7 +857,6 @@ class FeatureStrategiesStore implements IFeatureStrategiesStore {
id: r.strategy_id,
title: r.strategy_title,
disabled: r.strategy_disabled || false,
milestoneId: r.strategy_milestone_id,
};
if (!includeId) {
delete strategy.id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,18 @@ exports.up = function (db, callback) {
feature_strategies.title as strategy_title,
feature_strategies.disabled as strategy_disabled,
feature_strategies.variants as strategy_variants,
feature_strategies.milestone_id as strategy_milestone_id,
users.id as user_id,
users.name as user_name,
users.username as user_username,
users.email as user_email
FROM
features
LEFT JOIN feature_environments ON feature_environments.feature_name = features.name
LEFT JOIN feature_strategies ON feature_strategies.feature_name = feature_environments.feature_name
LEFT JOIN (
SELECT *
FROM feature_strategies
WHERE milestone_id IS NULL
) AS feature_strategies ON feature_strategies.feature_name = feature_environments.feature_name
and feature_strategies.environment = feature_environments.environment
LEFT JOIN environments ON feature_environments.environment = environments.name
LEFT JOIN feature_strategy_segment as fss ON fss.feature_strategy_id = feature_strategies.id
Expand Down

0 comments on commit 3b6789d

Please sign in to comment.