Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 03-28-2021, 07:59 PM   #1
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: 9,035
Karma: 62040591
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Template: Unexpected results with days_between

(split from another thread)

Hopefully I making what I am try to do clear here.

Another Action Chains single-field edit to set enumerated #fanficstatus to "abandoned" if the selected fic is no longer available (this is marked in text #fanficerror) or has not been updated in a long time (date #fanficupdated of longer than 730 days). Three testing books are:

Book #1 (control):
#fanficstatus: In-Progress | #fanficupdated: Mar 27 2021 | #fanficerror: false
Intended result: In-Progress

Book #2 (has #fanficerror):
#fanficstatus: In-Progress | #fanficupdated: Jun 23 2020 | #fanficerror: true
Intended result: Abandoned

Book #3 (#fanficupdated more than 730 days old):
#fanficstatus: In-Progress | #fanficupdated: May 13 2013 | #fanficerror: false
Intended result: Abandoned

Code:
program:
d1 = $$#fanficupdated;
d2 = format_date(today(),'iso');
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


With this code, #2 returns 'abandoned' but #3 returns the existing 'in-progress'. I have confirmed this with a few other fics too. Any mistake where the idea is?

a few other things if they are of importance:

#fanficupdated always exists at the same time as #fanficstatus so I do not need to separately check for its existence.

If I turn ># 730 to 0 I get the same results. But if I turn the pointy bracket in ># 730 the other way, it returns Abandoned on all three books, so something is working, just not the way I want.

Also, if it helps I reverse-engineered my code from the one posted here.


Last edited by ownedbycats; 03-28-2021 at 08:43 PM.
ownedbycats is online now   Reply With Quote
Old 03-28-2021, 08:42 PM   #2
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: 9,035
Karma: 62040591
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I figured it out. I put this code in:

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

days_between(d1, d2)
and noticed the numbers were all negative. So I tried switching d1 and d2:

Code:
d1 = format_date(today(),'iso');
d2 = $$#fanficupdated;
(days_between(d1, d2) <# -730, also works, but that's a little bit silly)

And now I am getting Abandoned for both #2 and #3. That was a silly mistake.

Last edited by ownedbycats; 03-28-2021 at 09:58 PM.
ownedbycats is online now   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Template: unexpected result with gpm ownedbycats Library Management 5 03-16-2021 05:17 AM
Express failing recipe rewrite produces unexpected results scissors Recipes 4 01-19-2014 10:33 AM
Custom Column - Days_Between rifka Library Management 2 04-23-2013 01:02 PM
Markdown / Blockquote conversion giving unexpected results Agama Conversion 23 02-23-2011 11:16 AM
Unutterably Silly Unexpected results of the pumpkin pie kennyc Lounge 7 11-24-2010 12:14 PM


All times are GMT -4. The time now is 06:54 PM.


MobileRead.com is a privately owned, operated and funded community.