]> git.wh0rd.org Git - tt-rss.git/commitdiff
modify sorting by date_entered: set date_entered per-batch; use updated as a secondar...
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 27 Mar 2013 09:34:04 +0000 (13:34 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 27 Mar 2013 09:34:04 +0000 (13:34 +0400)
classes/feeds.php
include/functions.php
include/rssfuncs.php

index 2c45da2ddb03585e8acaffa989f82e731381d201..2aa567fcd1e9e93a999e5f3c15e26c5b2bdc61b9 100644 (file)
@@ -351,7 +351,9 @@ class Feeds extends Handler_Protected {
 #                              $content_link = "<a href=\"javascript:viewContentUrl('".$line["link"]."');\">" .
 #                                      $line["title"] . "</a>";
 
-                               $updated_fmt = make_local_datetime($this->link, $line["updated_noms"], false);
+                               $updated_fmt = make_local_datetime($this->link, $line["updated"], false);
+                               $date_entered_fmt = T_sprintf("Imported at %s",
+                                       make_local_datetime($this->link, $line["date_entered"], false));
 
                                if (get_pref($this->link, 'SHOW_CONTENT_PREVIEW')) {
                                        $content_preview = truncate_string(strip_tags($line["content_preview"]),
@@ -459,7 +461,9 @@ class Feeds extends Handler_Protected {
                                                }
                                        }
 
-                                       $reply['content'] .= "$updated_fmt</span>";
+                                       $reply['content'] .= "<span title='$date_entered_fmt'>$updated_fmt</span>
+                                               </span>";
+
                                        $reply['content'] .= "<div class=\"hlRight\">";
 
                                        $reply['content'] .= $score_pic;
@@ -566,7 +570,8 @@ class Feeds extends Handler_Protected {
                                                }
                                        }
 
-                                       $reply['content'] .= "<span class='updated'>$updated_fmt</span>";
+                                       $reply['content'] .= "<span class='updated' title='$date_entered_fmt'>
+                                               $updated_fmt</span>";
 
                                        $reply['content'] .= "<div style=\"vertical-align : middle\">";
                                        $reply['content'] .= "$score_pic";
index 9125247b12a1f6edaea4f45a33bf6e0b6d09b39b..bbddd30bdc1b0cce81f11120cd9ea87375f9d97d 100644 (file)
 
                                if (!$override_order) {
                                        if (get_pref($link, 'REVERSE_HEADLINES', $owner_uid)) {
-                                               $override_order = "date_entered";
+                                               $override_order = "date_entered, updated";
                                        } else {
-                                               $override_order = "last_marked DESC, date_entered DESC";
+                                               $override_order = "last_marked DESC, date_entered DESC, updated DESC";
                                        }
                                }
 
 
                                        if (!$override_order) {
                                                if (get_pref($link, 'REVERSE_HEADLINES', $owner_uid)) {
-                                                       $override_order = "date_entered";
+                                                       $override_order = "date_entered, updated";
                                                } else {
-                                                       $override_order = "last_published DESC, date_entered DESC";
+                                                       $override_order = "last_published DESC, date_entered DESC, updated DESC";
                                                }
                                        }
 
                                $intl = get_pref($link, "FRESH_ARTICLE_MAX_AGE", $owner_uid);
 
                                if (DB_TYPE == "pgsql") {
-                                       $query_strategy_part .= " AND updated > NOW() - INTERVAL '$intl hour' ";
+                                       $query_strategy_part .= " AND date_entered > NOW() - INTERVAL '$intl hour' ";
                                } else {
-                                       $query_strategy_part .= " AND updated > DATE_SUB(NOW(), INTERVAL $intl HOUR) ";
+                                       $query_strategy_part .= " AND date_entered > DATE_SUB(NOW(), INTERVAL $intl HOUR) ";
                                }
 
                                $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
                        }
 
                        if (get_pref($link, 'REVERSE_HEADLINES', $owner_uid)) {
-                               $order_by = "$date_sort_field";
+                               $order_by = "$date_sort_field, updated";
                        } else {
-                               $order_by = "$date_sort_field DESC";
+                               $order_by = "$date_sort_field DESC, updated DESC";
                        }
 
                        if ($view_mode != "noscores") {
                                                hide_images,
                                                unread,feed_id,marked,published,link,last_read,orig_feed_id,
                                                last_marked, last_published,
-                                               ".SUBSTRING_FOR_DATE."(last_read,1,19) as last_read_noms,
                                                $vfeed_query_part
                                                $content_query_part
-                                               ".SUBSTRING_FOR_DATE."(updated,1,19) as updated_noms,
                                                author,score
                                        FROM
                                                $from_qpart
                                                                "last_read," .
                                                                "(SELECT hide_images FROM ttrss_feeds WHERE id = feed_id) AS hide_images," .
                                                                "last_marked, last_published, " .
-                                                               SUBSTRING_FOR_DATE . "(last_read,1,19) as last_read_noms," .
                                                                $since_id_part .
                                                                $vfeed_query_part .
                                                                $content_query_part .
-                                                               SUBSTRING_FOR_DATE . "(updated,1,19) as updated_noms," .
                                                                "score ";
 
                                $feed_kind = "Tags";
index 130f9142c916b68d8e76425d21993aa8b84a2e7e..73fe757c3dfac0d930d265de7a41ffe6b5c28c4f 100644 (file)
 
                $simplepie_cache_dir = CACHE_DIR . "/simplepie";
 
+               $date_feed_processed = date('Y-m-d H:i');
+
                if (!is_dir($simplepie_cache_dir)) {
                        mkdir($simplepie_cache_dir);
                }
                                                        '',
                                                        $no_orig_date,
                                                        NOW(),
-                                                       NOW(),
+                                                       '$date_feed_processed',
                                                        '$entry_comments',
                                                        '$num_comments',
                                                        '$entry_plugin_data',