Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
sten committed Sep 21, 2022
2 parents 15cb921 + c053f24 commit 366f8f4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Commands/SurveyheroResponseImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function handle(): int
foreach ($surveys as $survey) {
/* @var SurveyContract $survey */
try {
if($refreshResponses){
if ($refreshResponses) {
$survey->survey_last_imported = null;
$survey->save();
}
Expand Down
3 changes: 2 additions & 1 deletion src/Contracts/SurveyContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public function hasResponses(): bool;

/**
* Checks if the response timestamp is more recent than the last updated survey timestamp.
* @param string $responseLastUpdatedIsoTimestamp
*
* @param string $responseLastUpdatedIsoTimestamp
* @return bool
*/
public function doesResponseNeedsToBeUpdated(string $responseLastUpdatedIsoTimestamp): bool;
Expand Down
10 changes: 6 additions & 4 deletions src/Models/Survey.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ public function hasResponses(): bool
}

/**
* @inheritDoc
* {@inheritDoc}
*/
public function doesResponseNeedsToBeUpdated(string $responseLastUpdatedIsoTimestamp): bool {
if($this->survey_last_imported) {
public function doesResponseNeedsToBeUpdated(string $responseLastUpdatedIsoTimestamp): bool
{
if ($this->survey_last_imported) {
return Carbon::parse($responseLastUpdatedIsoTimestamp)->gt($this->survey_last_imported);
} else {
return true;
}
else return true;
}
}
1 change: 0 additions & 1 deletion src/Services/SurveyResponseImportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Statikbe\Surveyhero\Services;

use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
use Statikbe\Surveyhero\Contracts\SurveyContract;
use Statikbe\Surveyhero\Contracts\SurveyResponseContract;
Expand Down

0 comments on commit 366f8f4

Please sign in to comment.