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

Refactors lottery and lottery results #10

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

creativecoder
Copy link
Contributor

@creativecoder creativecoder commented Oct 5, 2017

This PR represents 2 conceptual changes that 1) simplify and reduce duplication in the API and 2) meet the needs of new features for the web app.

Change 1:
/Listing/LotteryResult/{listingID} -> /Listing/{listingID}/Lottery

Lottery is a resource that related to a listing and holds information about the context of a lottery. This includes

  • date/place/location for when the lottery will happen
  • the preferences associated with the lottery
  • information about the general pool for the lottery

Web app can use the lotteryResults : boolean property to determine whether or not there are results

Change 2:
/Listing/LotteryResult/{listingID}/{lotteryNumber} -> /Listing/{listingID}/LotteryResult/{lotteryNumber}

Lottery Result is a resource within a listing that returns the information about a lottery number in a lottery. This includes

  • application ID
  • overall rank in the lottery
  • rank in general pool, if available
  • what preferences that lottery number qualified for and ranking, if available

Web app can use this to look up both what preferences the applicant qualified for before the lottery and their ranking after the lottery.

@creativecoder
Copy link
Contributor Author

It also seems like these fields may be okay to remove from Lottery (previously LotteryResult) since they are blank for recent listings that have had their lotteries run.

  • URL
  • lotteryEndTime
  • lotteryPreferences
  • officeHours

@creativecoder
Copy link
Contributor Author

Another idea... lottery information might fit better included as part of the ListingDetails endpoint. Then we wouldn't need to duplication the preferences information there.

@creativecoder
Copy link
Contributor Author

creativecoder commented Nov 10, 2017

This API design has now been refactored:

  1. Lottery information for a listing

Most of this information is already available on the ListingDetails/{listingID} endpoint. To complete the information there, we need to add Lottery_General_Pool which includes unitsAvailable and totalSubmittedApps information for the general pool.

Lottery_Preferences__c and Lottery_Winners__c are removed from ListingDetails because they appear to be unused fields.

This also means that we can deprecate /Listing/LotteryResult/{listingID}, which currently returns all lottery results for a listing. The dataset returned is large and this endpoint has performance issues, so should not continue to be used in its current form.

  1. Lottery information for preferences

/Listing/Preferences/{listingID}

appTotal is removed (always null in the current API) and replaced with totalSubmittedApps for each listing preference. The other preference information we need is unitsAvailable, which is already available in the API.

  1. Lottery results for a lottery number

This is the same as previously described.

/Listing/LotteryResult/{listingID}/{lotteryNumber}

Lottery Result is a resource within a listing that returns the information about a lottery number in a lottery. This includes

  • application ID
  • overall rank in the lottery
  • rank in general pool, if available
  • what preferences that lottery number claimed, qualified for, and their ranking after the lottery is run

Web app can use this to look up both what preferences the applicant qualified for before the lottery and their preference rankings after the lottery.

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.

1 participant