@@ -58,6 +58,7 @@ bool Bundle::UpdateFromCatalog(
58
58
DeleteCampaigns ();
59
59
DeleteCategories ();
60
60
DeleteCreativeAds ();
61
+ DeleteDayparts ();
61
62
DeleteGeoTargets ();
62
63
63
64
SaveCreativeAdNotifications (bundle_state->creative_ad_notifications );
@@ -106,6 +107,11 @@ void Bundle::DeleteCreativeAds() {
106
107
database_table.Delete (std::bind (&Bundle::OnCreativeAdsDeleted, this , _1));
107
108
}
108
109
110
+ void Bundle::DeleteDayparts () {
111
+ database::table::Dayparts database_table (ads_);
112
+ database_table.Delete (std::bind (&Bundle::OnDaypartsDeleted, this , _1));
113
+ }
114
+
109
115
void Bundle::DeleteGeoTargets () {
110
116
database::table::GeoTargets database_table (ads_);
111
117
database_table.Delete (std::bind (&Bundle::OnGeoTargetsDeleted, this , _1));
@@ -183,6 +189,16 @@ std::unique_ptr<BundleState> Bundle::GenerateFromCatalog(
183
189
geo_targets.push_back (code);
184
190
}
185
191
192
+ std::vector<CreativeDaypartInfo> creative_dayparts;
193
+ for (const auto & daypart : campaign.dayparts ) {
194
+ CreativeDaypartInfo creative_daypart_info;
195
+ creative_daypart_info.dow = daypart.dow ;
196
+ creative_daypart_info.start_minute = daypart.start_minute ;
197
+ creative_daypart_info.end_minute = daypart.end_minute ;
198
+
199
+ creative_dayparts.push_back (creative_daypart_info);
200
+ }
201
+
186
202
// Creative Sets
187
203
for (const auto & creative_set : campaign.creative_sets ) {
188
204
uint64_t entries = 0 ;
@@ -236,6 +252,7 @@ std::unique_ptr<BundleState> Bundle::GenerateFromCatalog(
236
252
creative_set.ad_conversions .size () != 0 ? true : false ;
237
253
info.per_day = creative_set.per_day ;
238
254
info.total_max = creative_set.total_max ;
255
+ info.dayparts = creative_dayparts;
239
256
info.geo_targets = geo_targets;
240
257
info.title = creative.payload .title ;
241
258
info.body = creative.payload .body ;
@@ -318,6 +335,7 @@ std::unique_ptr<BundleState> Bundle::GenerateFromCatalog(
318
335
creative_set.ad_conversions .size () != 0 ? true : false ;
319
336
info.per_day = creative_set.per_day ;
320
337
info.total_max = creative_set.total_max ;
338
+ info.dayparts = creative_dayparts;
321
339
info.geo_targets = geo_targets;
322
340
info.company_name = creative.payload .company_name ;
323
341
info.alt = creative.payload .alt ;
@@ -446,6 +464,16 @@ void Bundle::OnCreativeAdsDeleted(
446
464
BLOG (3 , " Successfully deleted creative ads" );
447
465
}
448
466
467
+ void Bundle::OnDaypartsDeleted (
468
+ const Result result) {
469
+ if (result != SUCCESS) {
470
+ BLOG (0 , " Failed to delete dayparts" );
471
+ return ;
472
+ }
473
+
474
+ BLOG (3 , " Successfully deleted dayparts" );
475
+ }
476
+
449
477
void Bundle::OnGeoTargetsDeleted (
450
478
const Result result) {
451
479
if (result != SUCCESS) {
0 commit comments