Skip to content

Conversation

@shreyanshdwivedi
Copy link
Member

Fixes #6244

Short description of what this resolves:

User can publish past events.

Changes proposed in this pull request:

  • restoring deleted event will have draft status if the date is behind current date and time
  • while saving a draft, the date will not be checked
  • while updating the status from draft to published will trigger validate_date and change the state to draft if date is behind current date and time

Checklist

  • I have read the Contribution & Best practices Guide and my PR follows them.
  • My branch is up-to-date with the Upstream development branch.
  • The unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • All the functions created/modified in this PR contain relevant docstrings.

@auto-label auto-label bot added the fix label Jul 28, 2019
@codecov
Copy link

codecov bot commented Jul 28, 2019

Codecov Report

Merging #6246 into development will decrease coverage by 0.03%.
The diff coverage is 0%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #6246      +/-   ##
===============================================
- Coverage         65.6%   65.57%   -0.04%     
===============================================
  Files              286      286              
  Lines            14559    14567       +8     
===============================================
  Hits              9552     9552              
- Misses            5007     5015       +8
Impacted Files Coverage Δ
app/api/events.py 22.16% <0%> (-0.45%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 770d204...0ba351e. Read the comment docs.

kushthedude
kushthedude previously approved these changes Jul 28, 2019
Copy link
Member

@kushthedude kushthedude left a comment

Choose a reason for hiding this comment

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

LGTM

@shreyanshdwivedi
Copy link
Member Author

@iamareebjamal @uds5501 @mrsaicharan1 please review

uds5501
uds5501 previously approved these changes Jul 30, 2019
@iamareebjamal
Copy link
Member

Verify other changes in PATCH don't affect this

@shreyanshdwivedi
Copy link
Member Author

shreyanshdwivedi commented Jul 30, 2019

@iamareebjamal I think we need the previous code block I added to update_object -

    if data.get('starts_at') != event.starts_at or data.get('ends_at') != event.ends_at or \
                (event.state == "draft" and data.get('state') == "published") or \
                (event.deleted_at and not data.get('deleted_at')):
            validate_date(event, data)
  • 1st line to check if there is any date change
  • 2nd to check when we publish a drafted event
  • 3rd to check when we restore event, so that we can update the status (if necessary)

Currently, whole event data is passed even if a field is updated or not. So, the date will always be checked if we don't specifically enters when it is to be tested.

@iamareebjamal
Copy link
Member

OK, split into 3 separate booleans with comments so that it is understandanble

@shreyanshdwivedi
Copy link
Member Author

@iamareebjamal added comments for better understanding

@fossasia fossasia deleted a comment Jul 31, 2019
@iamareebjamal iamareebjamal merged commit ce62ff0 into fossasia:development Jul 31, 2019
mrsaicharan1 pushed a commit to mrsaicharan1/open-event-server that referenced this pull request Aug 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

User can publish past events

5 participants