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

wip: limit front page event display logic #5588

Closed
wants to merge 2 commits into from
Closed

wip: limit front page event display logic #5588

wants to merge 2 commits into from

Conversation

maze-runnar
Copy link
Contributor

Fixes #5110

  • some of the things are not clear from issue. Like please clarify between public event page and start page. And Only organizer can know the sales so we can't know how much tickets are available. Then how to restrict on basis of that. And wht it exactly means -

limits the number of tickets and therefore no longer has a ticket on the public page

Checklist

  • I have read the Contribution & Best practices Guide.
  • My branch is up-to-date with the Upstream development branch.
  • The acceptance, integration, unit tests and linter 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)

@vercel
Copy link

vercel bot commented Nov 12, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/eventyay/open-event-frontend/5k1g2p7ar
✅ Preview: https://open-event-frontend-git-front-page-limit.eventyay.vercel.app

@iamareebjamal
Copy link
Member

This needs to be done on server side in upcoming events route

@codecov
Copy link

codecov bot commented Nov 12, 2020

Codecov Report

Merging #5588 (2d3fb54) into development (7ecc1da) will increase coverage by 0.12%.
The diff coverage is 100.00%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #5588      +/-   ##
===============================================
+ Coverage        23.75%   23.88%   +0.12%     
===============================================
  Files              498      498              
  Lines             5257     5262       +5     
  Branches            44       44              
===============================================
+ Hits              1249     1257       +8     
+ Misses            4002     3999       -3     
  Partials             6        6              
Impacted Files Coverage Δ
app/controllers/index.js 48.14% <100.00%> (+11.78%) ⬆️
app/components/tabbed-navigation.js 33.33% <0.00%> (-20.00%) ⬇️
app/routes/index.js 78.57% <0.00%> (ø)
app/serializers/ticket.js 100.00% <0.00%> (+100.00%) ⬆️

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 7ecc1da...2d3fb54. Read the comment docs.

@maze-runnar
Copy link
Contributor Author

maze-runnar commented Nov 12, 2020

class UpcomingEventList(EventList):
    def query(self, view_kwargs):
        current_time = datetime.now(pytz.utc)
        query_ = (
            self.session.query(Event)
            .filter(
                Event.starts_at > current_time,
                Event.ends_at > current_time,
                Event.state == 'published',
                Event.privacy == 'public',
                or_(
                    Event.is_promoted,
                    and_(
                        Event.original_image_url != None,
                        Event.logo_url != None,
                        Event.event_type_id != None,
                        Event.event_topic_id != None,
                        Event.event_sub_topic_id != None,
                    ),
                ),
            )
            .order_by(Event.starts_at)
        )
        return query_

I have used Event.tickets, I want to use any(ticket.is_hidden ==false for ticket in (Event.tickets)) for filtering. How to achieve this?

@iamareebjamal
Copy link
Member

iamareebjamal commented Nov 12, 2020

Event.query.filter(Event.tickets.any(and_(Ticket.deleted_at == None, Ticket.price > 0)))

@maze-runnar maze-runnar deleted the front-page-limit branch November 12, 2020 13:17
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.

Frontpage: Limit display of events based on the public ticket availability
2 participants