View Single Post
Old 05-16-2021, 04:12 PM   #5928
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 11,156
Karma: 77304081
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Quote:
Originally Posted by aleyx View Post
Additionally, you can try to use a custom column to calculate the approximate lateness of an update:

Spoiler:
Code:
program:
# Days since the last update
days_since_last=days_between(today(), raw_field('#updated'));

# The first chapter doesn't count in the average; nor do books with no chapters (since they generate a divide by zero error)
chapters=cmp(raw_field('#chapters'), 2, 1, subtract(raw_field('#chapters'), 1), subtract(raw_field('#chapters'), 1));

# Days between chapters, in average.  If the average is less than one day, we up to one day.  This is so incomplete multi-chapters uploaded in one go don't get crazy values.
pub_length=days_between(raw_field('#updated'), raw_field('pubdate'));
avg=divide(cmp(pub_length, 0, 1, 1, pub_length), chapters);
avg=cmp(avg, 1, 1, 1, avg);
# Number of days an update should have come up, based on average
days_delayed=subtract(days_since_last, avg);

# Number of 'deadlines' missed.
deadlines=divide(days_since_last, avg);

# We only display a value for books with a Last Updated value. Among those, we dismiss completed books.
# You'd think a date column with an undefined value would be considered empty by ifempty(), but nope.  It's a column with a 'None' value.
contains( raw_field('#updated'), 'None', '',
	str_in_list(field('tags'), ",", "Completed", "",
		cmp( deadlines, 2,
		"", "", finish_formatting( deadlines, "0.0f", "x" , finish_formatting(days_delayed, "0.0f", " (", finish_formatting(avg, "0.0f", ", avg ", ")")))
		)
	)
)


The more it's late, the more likely it's been dropped anyways.

(I know Calibre introduced new functions since I wrote that code; I haven't had time to rewrite it yet)

N.
You do realize the user can set a "last checked" datetime column with fff? Might make things easier.

Personall I use Action Chains' single-field edit to change the status column to Abandoned if there's either a non-transient error or it's old enough.

Note my template specifically will only work on the last few versions of Calibre due to heavy use of field references.

Code:
program:
d1 = format_date(today(),'iso');
d2 = $$#fanficupdated;
status = $#fanficstatus;

	if
		and(
			status=='In-Progress',
			days_between(d1, d2) ># 730,
			)
	then
		"Abandoned"
		elif
			and(
				status=='In-Progress',
				$#fanficerror,
				)
		then
			"Abandoned"

	else
		status
	fi
ownedbycats is offline   Reply With Quote