/**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $this->writeOutput('Hashing pid data');
     $this->getContainer()->get('transformcore.phe.exporter.datahashing')->obfuscatePersonalData($this->getQuestionnaireService()->findQuestionnairesToHash(), $this->getQuestionnaireService());
     $this->writeOutput('Done');
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $date = \DateTime::createFromFormat('d-m-Y', $input->getOption('date'))->modify('-1 day');
     $startDate = clone $date->setTime(0, 0, 0);
     $endDate = clone $date->setTime(23, 59, 59);
     $this->extractAnalyticRollup($startDate, $endDate);
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $cutoffDate = \DateTime::createFromFormat('d-m-Y', $input->getOption('date'))->modify('-1 day');
     $startDate = clone $cutoffDate->setTime(0, 0, 0);
     $endDate = clone $cutoffDate->setTime(23, 59, 59);
     $questionnaires = $this->getContainer()->get('transformcore.phe.analytics.extractor')->extractQuestionnairesForExport($startDate, $endDate);
     if (0 !== count($questionnaires)) {
         $this->exportRecords($questionnaires->toArray());
         $this->compressFiles();
     } else {
         $this->writeOutput('No records present for output');
     }
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $offsetMinutes = $input->getOption('offset') ?: self::DEFAULT_OFFSET;
     $timeOffset = (new \DateTime())->modify("- {$offsetMinutes} minutes");
     $questionnaires = $this->getQuestionnaireService()->getQuestionnairesForCSVExport($timeOffset);
     if (0 !== count($questionnaires)) {
         $document = $this->exportRecords($questionnaires);
         $this->encryptFileForTransfer($this->getContainer()->getParameter('export_path') . DIRECTORY_SEPARATOR . $document->getFileName());
         $this->compressFiles();
     } else {
         $this->writeOutput('No records present for output');
     }
 }
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $expiredQuizzes = 0;
     $offsetHours = $input->getOption('offset') ?: self::EXPIRY_OFFSET;
     $expiry = new \DateTime();
     $timeOffset = $expiry->modify("- {$offsetHours} hours");
     $this->writeOutput('Expiring quizzes started before ' . $timeOffset->format('d-m-Y h:i:s'));
     foreach ($this->getQuestionnaireService()->getQuestionnairesForExpiry($timeOffset) as $questionnaire) {
         $questionnaire->expire()->setCompletedDate($expiry);
         $this->getQuestionnaireService()->updateQuestionnaire($questionnaire);
         $expiredQuizzes += 1;
     }
     $this->writeOutput("Found and expired {$expiredQuizzes} quizzes.");
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $sTime = microtime(true);
     $cutoffDate = \DateTime::createFromFormat('d-m-Y', $input->getOption('date'))->modify('-1 day');
     $startDate = clone $cutoffDate->setTime(0, 0, 0);
     $endDate = clone $cutoffDate->setTime(23, 59, 59);
     if (self::OUTPUT_WEEKLY === $input->getOption('period')) {
         $startDate->modify('-6 days');
     }
     $this->writeOutput('Importing ' . $input->getOption('period') . ' analytics for period ' . $startDate->format(\DateTime::ISO8601) . ' to ' . $endDate->format(\DateTime::ISO8601));
     $result = $this->getContainer()->get('transformcore.phe.analytics.extractor')->prepareAnalyticsForPeriod($startDate, $endDate);
     $eTime = microtime(true);
     $this->writeOutput('Extracted information on ' . $result->getStarts() . ' quiz starts');
     $this->writeOutput(sprintf('Done in %0.2f seconds', $eTime - $sTime));
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     /** @var FileUploadService $uploadService */
     $uploadService = $this->getContainer()->get('transformcore.phe.exporter.upload');
     try {
         $uploadService->openConnection();
         $this->writeOutput('Connection opened to ' . $uploadService->getUploadPath());
         foreach ($this->findFilesToTransfer() as $file) {
             $this->doUpload($uploadService, $file);
         }
         $uploadService->closeConnection();
     } catch (\Exception $e) {
         $this->writeOutput('Failed to open connection: ' . $e->getMessage(), LogLevel::CRITICAL);
     }
 }