Skip to content

Commit

Permalink
ALS-6375: Prevent statviz from returning continuous variable counts w…
Browse files Browse the repository at this point in the history
…hen total is > 10
  • Loading branch information
ramari16 committed May 2, 2024
1 parent 0dbf127 commit 5d863dd
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ protected String processContinuousCrossCounts(String continuousCrossCountRespons
int generatedVariance = this.generateVarianceWithCrossCounts(crossCounts);
boolean mustObfuscate = isCrossCountObfuscated(crossCounts, generatedVariance);

if (mustObfuscate) {
if (canShowContinuousCrossCounts(crossCounts)) {
return null;
}

Expand Down Expand Up @@ -713,6 +713,17 @@ private boolean isCrossCountObfuscated(Map<String, String> crossCounts, int gene
return mustObfuscate;
}


private boolean canShowContinuousCrossCounts(Map<String, String> crossCounts) {
String lessThanThresholdStr = "< " + this.threshold;

String v = crossCounts.get("\\_studies_consents\\");
if (v.contains(lessThanThresholdStr) || v.equals("0")) {
return true;
}
return false;
}

/**
* This method will generate a random variance for the request based on the passed entityString. The variance
* will be between -variance and +variance. The variance will be generated by adding a random salt to the
Expand Down

0 comments on commit 5d863dd

Please sign in to comment.