- bug: error if dataset table is empty
This commit is contained in:
parent
c0022e3c1c
commit
0fd0f02537
|
@ -149,7 +149,7 @@ class RequestController extends Controller
|
|||
$repositoryName = "Tethys RDR";
|
||||
$repIdentifier = "tethys.geologie.ac.at";
|
||||
$sampleIdentifier = "oai:" . $repIdentifier . ":27";//$this->_configuration->getSampleIdentifier();
|
||||
$earliestDateFromDb = optional(Dataset::earliestPublicationDate())->server_date_published;
|
||||
$earliestDateFromDb = Dataset::earliestPublicationDate() != null ? Dataset::earliestPublicationDate()->server_date_published: null;
|
||||
|
||||
// set parameters for oai-pmh.xslt
|
||||
$this->_proc->setParameter('', 'email', $email);
|
||||
|
|
|
@ -258,17 +258,18 @@ class Dataset extends Model
|
|||
*
|
||||
* @return \Carbon\Carbon\Date
|
||||
*/
|
||||
public function scopeEarliestPublicationDate($query, string $column = null)
|
||||
public static function earliestPublicationDate(string $column = null)
|
||||
{
|
||||
if (!$column) {
|
||||
$column = self::PUBLISHED_AT;
|
||||
}
|
||||
return $query->select('server_date_published')
|
||||
$result = Dataset::select('server_date_published')
|
||||
->where('server_date_published', '<>', null)
|
||||
->where('server_state', 'published')
|
||||
->orderBy('server_date_published', 'asc')
|
||||
->first();
|
||||
//->server_date_published;
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function setServerState($targetType)
|
||||
|
|
Loading…
Reference in New Issue
Block a user