Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

WIP: get expected date of next pkg-update #156

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stefina
Copy link
Member

@stefina stefina commented Aug 22, 2017

No description provided.

@stefina stefina self-assigned this Aug 22, 2017
@stefina stefina requested a review from metaodi August 22, 2017 15:30
@stefina stefina force-pushed the OGD-640_expected-update branch 2 times, most recently from 408c798 to 7e859c5 Compare August 22, 2017 15:37
@stefina stefina changed the title get expected date of next pkg-update WIP: get expected date of next pkg-update Aug 22, 2017
@stefina stefina removed the request for review from metaodi August 22, 2017 16:01
@stefina
Copy link
Member Author

stefina commented Aug 22, 2017

TODO:

  • Translations (and CSS to fit translations)
  • read datetime-pattern from config

'http://purl.org/cld/freq/annual': timedelta(days=365), # noqa
'http://purl.org/cld/freq/biennial': timedelta(days=730), # noqa
'http://purl.org/cld/freq/triennial': timedelta(days=1095), # noqa
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't need this, get rid of it ;)

self.assertEquals(None, helpers.get_expected_update(modified_set, period_irregular)) #noqa
self.assertEquals(None, helpers.get_expected_update(modified_set, period_continuous)) #noqa
self.assertEquals(None, helpers.get_expected_update(modified_set, period_empty)) #noqa
self.assertEquals(None, helpers.get_expected_update(modified_set, period_invalid)) #noqa
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you test for None, you should use assertIsNone

'http://purl.org/cld/freq/semiannual': timedelta(days=183), # noqa
'http://purl.org/cld/freq/annual': timedelta(days=365), # noqa
'http://purl.org/cld/freq/biennial': timedelta(days=730), # noqa
'http://purl.org/cld/freq/triennial': timedelta(days=1095), # noqa
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I quickly looked for alternatives to timedelta and found dateutil.relativedelta, which offers a more precise solution to our problem. E.g. the monthly delta is now set to 30 days, while we actually want 1 month (ranging from 28-31 days). Maybe check this example: https://stackoverflow.com/questions/546321/how-do-i-calculate-the-date-six-months-from-the-current-date-using-the-datetime/4406260#4406260

@stefina stefina force-pushed the OGD-640_expected-update branch 2 times, most recently from 91469db to bd9c830 Compare January 12, 2018 14:18
@stefina stefina force-pushed the OGD-640_expected-update branch from bd9c830 to 5b1376f Compare January 12, 2018 14:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants