Skip to content

Commit

Permalink
Webtrees 2.1.0-beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
06Games committed Mar 19, 2022
1 parent 2670e6e commit 25af31d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions RequestHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use Fisharebest\Webtrees\NoReplyUser;

// getChanges
use Fisharebest\Webtrees\Carbon;
use Fisharebest\Webtrees\Registry;
use Fisharebest\Webtrees\Tree;
use Illuminate\Database\Capsule\Manager as DB;
Expand Down Expand Up @@ -86,7 +85,7 @@ function api(object $args): array
foreach($this->trees->all() as $tree)
$changes[$tree->name()] = $this->getChanges($tree, $args->days)
->filter(static function (stdClass $row) use ($args):bool { return in_array($row->record["tag"] , $args->tags); })
->groupBy(static function (stdClass $row) { return $row->time->format('Y-m-d'); })
->groupBy(static function (stdClass $row) { return Registry::timestampFactory()->fromString($row->time)->format('Y-m-d'); })
->sortKeys();
return $changes;
}
Expand Down Expand Up @@ -120,7 +119,7 @@ function getChanges(Tree $tree, int $days): Collection // From getRecentChangesF
->where('gedcom_id', '=', $tree->id())
->where('status', '=', 'accepted')
->where('new_gedcom', '<>', '')
->where('change_time', '>', Carbon::now()->subDays($days))
->where('change_time', '>', Registry::timestampFactory()->now()->subtractDays($days)->toDateTimeString())
->groupBy(['xref'])
->select(new Expression('MAX(change_id) AS recent_change_id'));

Expand All @@ -134,7 +133,7 @@ function getChanges(Tree $tree, int $days): Collection // From getRecentChangesF
$record = Registry::gedcomRecordFactory()->make($row->xref, $tree, $row->new_gedcom);
return (object) [
'record' => $record == null ? null : [ 'canShow' => $record->canShow(), 'tag' => $record->tag(), 'xref' => $record->xref(), 'fullName' => $record->fullName(), 'url' => $record->url() ],
'time' => Carbon::create($row->change_time)->local(),
'time' => $row->change_time,
'user' => $this->users->find((int) $row->user_id)->userName(),
];
})
Expand Down

0 comments on commit 25af31d

Please sign in to comment.