Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

As a user I want to have the Coming Up field active when I create a new story. [SDBELGA-466] #2298

Merged
merged 6 commits into from
Nov 24, 2021

Conversation

GyanP
Copy link
Contributor

@GyanP GyanP commented Nov 19, 2021

No description provided.

@petrjasek
Copy link
Member

imo it's not exactly clear what this does from template perspective:

{{ date|iso_datetime(5) }}

might be better something like:

{{ date|timedelta(minutes=5)|iso_datetime }}

@petrjasek petrjasek added this to the 2.4 milestone Nov 19, 2021
@GyanP
Copy link
Contributor Author

GyanP commented Nov 19, 2021

{{ date|timedelta(minutes=5)|iso_datetime }}

Doesn't this will mean that we are applying two filters?

  1. timedelta(min=5)
  2. iso_datetime

@petrjasek
Copy link
Member

yep that would be 2 filters

@GyanP GyanP requested a review from petrjasek November 19, 2021 14:27
@@ -63,10 +63,15 @@ def first_paragraph_filter(input_string):
return ""


def iso_datetime(date, initial_offset):
def add_timedelta(date, minutes):
Copy link
Member

Choose a reason for hiding this comment

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

it could be with **kwargs so it's not limited to use minutes

try:
return date + timedelta(minutes=minutes)
return date + timedelta(minutes=kwargs.get("minutes"))
Copy link
Member

Choose a reason for hiding this comment

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

it should be rather timedelta(**kwargs) here so there can be hours/seconds/whatever

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep, I will do the changes.

@GyanP GyanP requested a review from petrjasek November 22, 2021 10:20
@@ -736,7 +736,7 @@ Feature: Templates
"test": "{{ user.sign_off }}",
"test2": "{{ item.something.missing }}",
"test3": "{% if something %}",
"test4": "{{ now|iso_datetime }}"
"test4": "{{ now|add_timedelta(minutes=45)|iso_datetime }}"
Copy link
Member

Choose a reason for hiding this comment

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

what/how does it actually test it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we don't require it now before that test case is failing here on first commit, and later you suggested creating two filters so thought we should add another filter also there. is it ok if I remove that add_timedelta filter from here?

Copy link
Member

Choose a reason for hiding this comment

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

I think it would be good to test the filter, I'm just not sure what are we testing here exactly

@GyanP GyanP requested a review from petrjasek November 24, 2021 08:14
@GyanP GyanP merged commit e85390b into superdesk:develop Nov 24, 2021
@petrjasek petrjasek modified the milestones: 2.4, 2.3.5 Dec 20, 2021
petrjasek pushed a commit that referenced this pull request Dec 20, 2021
…ew story. [SDBELGA-466] (#2298)

* As a user I want to have the Coming Up field active when I create a new story. [SDBELGA-466]

* Address comments

* minor change

* use kwargs in timedelta

* Add test case

* minor change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants