Add lastModifiedStory node to storygraph

Makes it easier to find the last modified story in the collection.
This commit is contained in:
Tetrakern 2023-02-18 13:53:35 +01:00
parent 268edbdd1a
commit 442434cd5f
2 changed files with 6 additions and 1 deletions

View File

@ -166,7 +166,7 @@ if ( ! defined( 'FICTIONEER_API_STORYGRAPH_CHAPTERS' ) ) {
// Boolean: Storygraph API Transients caching
if ( ! defined( 'FICTIONEER_API_STORYGRAPH_TRANSIENTS' ) ) {
define( 'FICTIONEER_API_STORYGRAPH_TRANSIENTS', true );
define( 'FICTIONEER_API_STORYGRAPH_TRANSIENTS', false );
}
// =============================================================================

View File

@ -382,6 +382,11 @@ if ( ! function_exists( 'fictioneer_api_request_stories' ) ) {
// Add to graph
$graph['stories'][ $story->ID ] = $node;
// Last modified story?
if ( $node['modified'] == $graph['lastModified'] ) {
$graph['lastModifiedStory'] = $story->ID;
}
}
}