Open-event-server: Deleted Tickets being listed in manage events

Created on 9 May 2019  路  21Comments  路  Source: fossasia/open-event-server

Describe the bug

In the manage-events/Tickets column, the tickets which have been deleted are also being listed.

image
image

Expected behaviour

The deleted tickets shouldn't be listed there.

Desktop (please complete the following information):

  • OS: [e.g. iOS] Ubuntu 16.04 LTS
  • Browser [e.g. chrome, safari] Chrome

Additional context

Working on it

bug codeheat

All 21 comments

@uds5501 I think a issue is opened regarding the Deleted Tickets 馃槙

@kushthedude issue number?

My bad ignore it , Go On

@CosmicCoder96 @iamareebjamal The problem here is that get_trashed=True works only on the source object. For example, in this context, our query object is :

let queryObject =  {
      include      : 'tickets,sessions,speakers,organizers,coorganizers,track-organizers,registrars,moderators',
      filter       : filterOptions,
      'page[size]' : 10
    };

The get_trashed=true won't work for the included models i.e. tickets.
We may add a hybrid property to the tickets model : is_deleted and add it into the schema and fetch from frontend.
If there is any other approach to tackle this issue, please share

You have to add nested filter options unfortunately. I wish/think Flask JSON RESTAPI provides a hook to override the default fetching logic of the related resources, but I'm not sure

But, this is a serious issue nevertheless. Deleted resources should never be sent out. So, even if it doesn't allow us to override the fetching logic, we need to patch the library

You have to add nested filter options unfortunately. I wish/think Flask JSON RESTAPI provides a hook to override the default fetching logic of the related resources, but I'm not sure

Tried reading their code for a while, apparently they only filter attributes and don't look out for relationships

@uds5501 I was not able to recreate this , Today i made some changes to the event

@kushthedude if you weren't able to then it's a good news, but I think we would appreciate a sample. A gif maybe, meanwhile I'll check on my local

@uds5501 I refreshed the page at that point and Ticket disappeared , I checked now and i needed to refresh again , A PR might be appreciated for the issue

@kushthedude for all we know as of right now this isn't due to our code specifically, i believe it's error in the dependency.

It is our code. We should be filtering out deleted_at != None items by default

@iamareebjamal @CosmicCoder96 Why is this problem is only present for Manage Events List ? There are many other places where query already filters out Deleted Tickets ?

@iamareebjamal On it.

@iamareebjamal I tested the API, it's not returning ticket under an event if deleted_at != None for that ticket.

Test all relationships

@iamareebjamal So I did find one issue, for now, say we want tickets under a ticket-tag, we use the endpoint /ticket-tags/{ticket_tag_id}/tickets, but if say that ticket_tag_id is deleted, flask-rest-jsonapi does not check for that, and returns the tickets (not deleted ones) under that ticket_tag_id.

Open other issue for this

@iamareebjamal I could not find an issue tracker in fossasia/flask-rest-jsonapi, so I will just make a PR.

Issue should be created here

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SaptakS picture SaptakS  路  3Comments

mariobehling picture mariobehling  路  4Comments

CosmicCoder96 picture CosmicCoder96  路  3Comments

mariobehling picture mariobehling  路  3Comments

schedutron picture schedutron  路  4Comments