-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Web: add "Never" and "Mixed" values for "Last Activity" #1390
Conversation
9572e6c
to
4a4d2a2
Compare
Build (Sanity) failure seems unrelated to my PR:
|
latest = -1; | ||
if (torrents.length < 1) { | ||
str = none; | ||
} else { | ||
baseline = torrents[0].getLastActivity(); | ||
for (i = 0; t = torrents[i]; ++i) { | ||
d = t.getLastActivity(); | ||
if (latest < d) { | ||
if (baseline != d) { | ||
str = mixed; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure "mixed" should implemented here. If multiple torrents are selected displaying the latest activity looks reasonable. It provide some useful and meaningful information anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to make it more consistent with other fields that way. For example when you select multiple torrents the "Running Time" you get is a "mixed" instead of the one than run the longest, so I decided to do the same for "Last Activity". Wouldn't selecting a "never" active torrent with another one that was active some time ago and getting reported activity time be more misleading?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about next scenarios. Suppose I have a few douzens of stalled torrents. I can simply select all of them and see what is the latest time they were active.
Ok. It is just a two ways to look on the feature.
Just commented. Descision is yours. :)
Is any of this PR still valid after #1476? |
Only just noticed this, I wrote my own code to do this 2+ years ago. |
I think this is fixed by #1476. The current code reads like this: // last active at
if (torrents.length === 0) {
string = none;
} else {
const latest = torrents.reduce(
(accumulator, t) => Math.max(accumulator, t.getLastActivity()),
-1
);
const now_seconds = Math.floor(now / 1000);
if (0 < latest && latest <= now_seconds) {
const idle_secs = now_seconds - latest;
string =
idle_secs < 5 ? 'Active now' : `${fmt.timeInterval(idle_secs)} ago`;
} else {
string = none;
}
}
setTextContent(e.info.last_activity, string); |
So what does that "fix" do ? |
@pmarsden It displays the time delta (from now) of the latest active torrent in the selected group. It could be written in this way:
|
So it does not fix the issue then. |
In web interface when data for certain torrent was never received, it last activity shows the number of days since 01.01.1970, which is not really useful. This PR changes this to display text "Never" instead. Also last activity field did not show a "Mixed" value (like other fields) when selecting multiple torrents. This is now fixed too.
Fixes #658