From: Jérôme <rom...@ya...> - 2008-12-30 14:57:38
|
> Jérôme, if this is a patch for a bug, can you put it in the bugtracker? Yes (when available), but there is something strange ... As resume, when I try to test date if person.get_marriage_date() == person.get_birth_date(): this returns all "possible" values (like dates with sidebar filter on PersonView) ex: birth date = 1900 and marriage date = after 1870 test will match ! Exact, but seems more semantic (lexical) than algebra (syntax) ! What is the used grammar for rules on Verify.py ? If so, patch is not correct : def broken(self): + marr_date = get_marriage_date(self.db, self.obj) + birth_date = get_birth_date(self.db, self.obj) + if birth_date == marr_date: + return True and I do not exactly know why ! (self.obj = person) and I ignored estimated dates > In trunk or 3.0.x? I'm actively working on dates.py in trunk, but it isn't stable yet. trunk = not stable ... but currently dates.py works better on trunk than branch ! Using additionnal Records.py on 3.0.4 displays negative ages and trunk seems to ignore/hide them. I tried records.py present on SVN trunk and additionnal (./gramps/plugins) on 3.0.4. Also with _Date_fr.py, slash date and "julian" calendar sounds better on trunk ! > I did fix an issue recently in trunk: in 3.0.x the date subtraction > routine always produced a positive number. It would always give the > distance between two events. This caused problems when comparing the > differences, so I made the difference keep the negative. That helped to > find problems, for example, when a marriage occurred before a birth. If so, my problem is not fixed, just hidden (like testing patch): + if birth_date != Date.CAL_GREGORIAN: + birth_date == today_date I should try to use convert_calendar() function. PS: some months ago, I tried to add an other rule on Verify.py for families with marriage event but "unknown" relation type. (is on bugtracker) Jérôme Douglas S. Blank a écrit : >> It is a bug in date.py. I have been working on it off and on but hope >> to finish up soon. > > Is this in the bugtracker? In trunk or 3.0.x? I'm actively working on > dates.py in trunk, but it isn't stable yet. > > I did fix an issue recently in trunk: in 3.0.x the date subtraction > routine always produced a positive number. It would always give the > distance between two events. This caused problems when comparing the > differences, so I made the difference keep the negative. That helped to > find problems, for example, when a marriage occurred before a birth. > > Jérôme, if this is a patch for a bug, can you put it in the bugtracker? > > Thanks! > > -Doug > >> On 12/30/08, Jérôme <rom...@ya...> wrote: >>> Hi, >>> >>> >>> I tested 'trunk' and this only occurs with 3.0.4 ... >>> I guess Doug made changes on trunk (date.py) which ignore negative >>> values ! >>> >>> To reproduce it on stable branch, maybe: >>> 1. to add a birth date : 1794 month day >>> 2. set French Republican/Revolutionar calendar on Date Editor for birth >>> (year should be something like 1/2 or 3) >>> 2. add a death date : 1850 month day >>> >>> 2-1850 = -1848 ! >>> >>> >>> Note: seems that your plugin 'enlighted' few errors (seizure issue) on >>> my data, thanks ! It will be great if we could add it on Verify.py >>> plugin (tool). >>> >>> *Person married at youngest age* >>> Seems I used the same date for birth and marriage, the 'Verify data' >>> tool was not able to find this mistake on my data ... >>> >>> I tried to add rules, but I do not understand why there is too much >>> values :( Maybe related to type attribute on date (about, before, after) >>> like sidebar filter on dates ? >>> >>> >>> Index: Verify.py >>> =================================================================== >>> --- Verify.py (révision 11533) >>> +++ Verify.py (copie de travail) >>> @@ -409,6 +409,8 @@ >>> UnknownGender(self.db,person), >>> MultipleParents(self.db,person), >>> MarriedOften(self.db,person,wedder), >>> + MarriageAtBirth(self.db, person), >>> + MarriageAtDeath(self.db, person), >>> OldUnmarried(self.db,person, oldunm,estimate_age), >>> TooManyChildren(self.db,person,mxchilddad,mxchildmom), >>> Disconnected(self.db,person), >>> >>> @@ -1567,7 +1572,37 @@ >>> >>> def get_message(self): >>> return _("Invalid death date") >>> + >>> +class MarriageAtBirth(PersonRule): >>> + ID = 31 >>> + SEVERITY = Rule.ERROR >>> + def __init__(self, db, obj,): >>> + PersonRule.__init__(self, db, obj) >>> >>> + def broken(self): >>> + marr_date = get_marriage_date(self.db, self.obj) >>> + birth_date = get_birth_date(self.db, self.obj) >>> + if birth_date == marr_date: >>> + return True >>> + >>> + def get_message(self): >>> + return _("Marriage at birth") >>> + >>> +class MarriageAtDeath(PersonRule): >>> + ID = 32 >>> + SEVERITY = Rule.ERROR >>> + def __init__(self, db, obj,): >>> + PersonRule.__init__(self, db, obj) >>> + >>> + def broken(self): >>> + marr_date = get_marriage_date(self.db, self.obj) >>> + death_date = get_death_date(self.db, self.obj) >>> + if death_date == marr_date: >>> + return True >>> + >>> + def get_message(self): >>> + return _("Marriage at death") >>> + >>> >>> >>> Reinhard Müller a écrit : >>>> Hi, >>>> >>>> Am Montag, den 29.12.2008, 19:06 +0100 schrieb Jérôme: >>>>> I just need to add a test because dates could use "non-default" >>>>> calendars. A diff between two dates using differents calendars returns >>>>> a wrong value. :( >>>> Hm. I just subtract the date objects - I would have expected the >>>> subtraction routine to handle this. Is this a bug in date.py? >>>> >>>> Thanks, >>>> Reinhard >> -- >> Sent from my mobile device >> >> ------------------------------------------------------------------------------ >> _______________________________________________ >> Gramps-devel mailing list >> Gra...@li... >> https://lists.sourceforge.net/lists/listinfo/gramps-devel >> > > |