View Single Post
Old Yesterday, 12:50 PM   #1542
mijkala
Member
mijkala began at the beginning.
 
Posts: 17
Karma: 10
Join Date: Dec 2024
Device: kobo clara bw
Quote:
Originally Posted by chaley View Post
Of note:
  • The only check that will succeed is "># 183". Both 500 and 1000 are larger than 183. You should reverse the two checks to look for "># 900" first.
  • today() returns an ISO formatted date. You don't need to format it again.
As for why the fic isn't updated, I suspect that #ao3_last_updated doesn't contain what you think or is formatted in some way where the conversion of the string to a date/time is failing. Without seeing the actual metadata in the library for the book we can't say any more. The book itself isn't relevant.
I got it to work after some testing! I'm not really sure what to change with ISO as when I tried taking that part out it kept giving me errors and I'm just fumbling my way through coding and not sure what to actually add/take away for that. But this is what worked in the end!

#ao3_last_updated is a custom column I made that pulls that date (formatted yyyy-MM-dd) specifically ONLY for the date the fic was last updated on the website, not anything to do with when I edited anything in Calibre. I think my issue was I was working on multiple single field edits (adding completed dates for completed stories) and I had the wrong column selected to update that and whatever was wrong with the code I guess?

Code:
 program:
now = format_date(today(),'iso');
updated = $$#ao3_last_updated;
status = $#status;

	if
		status=='In-Progress'
		&& days_between(now, updated) ># 900
	then 
		'Hiatus'
	elif
		status=='In-Progress'
		&& days_between(now, updated) ># 183
	then
		'Dormant'
	elif
		status=='Dormant'
		&& days_between(now, updated) ># 900
	then
		'Hiatus'
	else 
		status
	fi
mijkala is offline   Reply With Quote