Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: components/variations/study_filtering.cc

Issue 2614443002: Supporting study definitions without default groups and end_date filtering. (Closed)
Patch Set: rkaplow's comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/variations/study_filtering.cc
diff --git a/components/variations/study_filtering.cc b/components/variations/study_filtering.cc
index 159b544f4e7d388e0fc3c49d251a82e8381af48a..510925132e1b1be266624727f4d7e9572862b89f 100644
--- a/components/variations/study_filtering.cc
+++ b/components/variations/study_filtering.cc
@@ -143,6 +143,16 @@ bool CheckStudyStartDate(const Study_Filter& filter,
return true;
}
+bool CheckStudyEndDate(const Study_Filter& filter,
+ const base::Time& date_time) {
+ if (filter.has_end_date()) {
+ const base::Time end_date = ConvertStudyDateToBaseTime(filter.end_date());
+ return end_date >= date_time;
+ }
+
+ return true;
+}
+
bool CheckStudyVersion(const Study_Filter& filter,
const base::Version& version) {
if (filter.has_min_version()) {
@@ -225,6 +235,11 @@ bool ShouldAddStudy(
return false;
}
+ if (!CheckStudyEndDate(study.filter(), reference_date)) {
+ DVLOG(1) << "Filtered out study " << study.name() << " due to end date.";
+ return false;
+ }
+
if (!CheckStudyHardwareClass(study.filter(), hardware_class)) {
DVLOG(1) << "Filtered out study " << study.name() <<
" due to hardware_class.";

Powered by Google App Engine
This is Rietveld 408576698