View Single Post
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: 11,110
Karma: 77213681
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 offline   Reply With Quote