@@ -290,19 +290,20 @@ export const toggleBannerStatus = asyncHandler(async (req: Request, res: Respons
290290 if ( StartDate !== undefined && StartDate !== null ) {
291291 updateData . StartDate = new Date ( StartDate ) ;
292292 updateData . ShowDates = true ;
293- } else if ( updateData . IsActive && ! existingBanner . StartDate ) {
293+ } else if ( updateData . IsActive && ! StartDate ) {
294294 // If activating immediately without dates, set StartDate to now
295295 updateData . StartDate = new Date ( ) ;
296- updateData . ShowDates = true ;
296+ updateData . EndDate = null ;
297+ updateData . ShowDates = false ;
297298 }
298299
299300 if ( EndDate !== undefined && EndDate !== null ) {
300301 updateData . EndDate = new Date ( EndDate ) ;
301- updateData . ShowDates = true ;
302302 } else if ( ! updateData . IsActive && ! EndDate ) {
303303 // If deactivating without explicit date, set EndDate to now
304+ updateData . StartDate = null ;
304305 updateData . EndDate = new Date ( ) ;
305- updateData . ShowDates = true ;
306+ updateData . ShowDates = false ;
306307 }
307308
308309 // Update banner
@@ -315,6 +316,7 @@ export const toggleBannerStatus = asyncHandler(async (req: Request, res: Respons
315316 return sendSuccess ( res , updatedBanner , `Banner ${ updatedBanner ?. IsActive ? 'activated' : 'deactivated' } successfully` ) ;
316317} ) ;
317318
319+ // TODO: Remove it if we are going to get "Downloads" from GA4
318320// Increment download count for resource banners
319321export const incrementDownloadCount = asyncHandler ( async ( req : Request , res : Response ) => {
320322 const { id } = req . params ;
0 commit comments