Skip to content

Commit

Permalink
Make lottery venue fields optional [DAH-722] (#1435)
Browse files Browse the repository at this point in the history
* Make lottery venue fields optional [DAH-722]

Co-authored-by: Andrea Egan <[email protected]>
  • Loading branch information
james-wills-sf and akegan authored Mar 3, 2021
1 parent 3db55f5 commit e0507c0
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 14 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ prod_and_release_jobs: &prod_and_release_jobs
branches:
only:
- /^release.*$/
- /^hotfix.*$/
- production
aliases:
- &attach_workspace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ section.content-wrap
use xlink:href="#i-clock"
span translate="listings.applications_closed" translate-value-date="{{::$ctrl.parent.listing.Application_Due_Date | date : 'MMM d, yyyy \'at\' h:mm a'}}"

span ng-if="$ctrl.parent.lotteryDateVenueAvailable($ctrl.parent.listing) && !$ctrl.lotteryComplete()"
span ng-if="$ctrl.parent.lotteryDateAvailable($ctrl.parent.listing) && !$ctrl.lotteryComplete()"
ng-include src="'listings/templates/listing/_pre_lottery_info.html'"

.content-group ng-if='!$ctrl.lotteryComplete()'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@ accordion-heading

.content-group
h4.h-caps-lined translate="listings.process.public_lottery"
ul ng-if="::$ctrl.parent.lotteryDateVenueAvailable($ctrl.parent.listing)"
ul ng-if="::$ctrl.parent.lotteryDateAvailable($ctrl.parent.listing)"
li
p.content-group_date
span.content-group_day
| {{ ::$ctrl.parent.listing.Lottery_Date | date : 'longDate' }}
span.content-group_time
| {{ ::$ctrl.parent.listing.Lottery_Date | date : 'shortTime' | lowercase }}
div.margin-top ng-if="::$ctrl.parent.showCovidUpdate"
div.margin-top ng-if="$ctrl.parent.showCovidUpdate"
p.t-sans.margin-bottom--half translate="listings.apply.covid_update"
p.c-steel translate="listings.apply.covid_update_lotteries"
div ng-if="::!$ctrl.parent.showCovidUpdate"
div ng-if="!$ctrl.parent.showCovidUpdate && $ctrl.parent.lotteryVenueAvailable($ctrl.parent.listing)"
p.content-group_address.no-margin.skiptranslate
| {{ ::$ctrl.parent.listing.Lottery_Venue }}
p.content-group_address.c-steel.skiptranslate
| {{ ::$ctrl.parent.listing.Lottery_Street_Address }} {{ ::$ctrl.parent.listing.Lottery_City }}
p.t-small.c-steel ng-if="::!$ctrl.parent.lotteryDateVenueAvailable($ctrl.parent.listing)" translate="listings.process.lottery_date_time_and_venue_to_be_scheduled"
p.t-small.c-steel ng-if="::!$ctrl.parent.lotteryDateAvailable($ctrl.parent.listing)" translate="listings.process.lottery_date_time_and_venue_to_be_scheduled"

ng-include src="'listings/templates/listing/_additional_sidebar_info.html'"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ angular.module('dahlia.components')
@hasEligibilityFilters = ->
ListingEligibilityService.hasEligibilityFilters()

@lotteryDateVenueAvailable = (listing) ->
(listing.Lottery_Date != undefined &&
listing.Lottery_Venue != undefined && listing.Lottery_Street_Address != undefined)
@lotteryDateAvailable = (listing) ->
listing.Lottery_Date != undefined

@lotteryVenueAvailable = (listing) ->
(listing.Lottery_Venue != undefined && listing.Lottery_Street_Address != undefined)

@agentInfoAvailable = (listing) ->
listing.Leasing_Agent_Phone || listing.Leasing_Agent_Email || listing.Leasing_Agent_Street
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
| {{ $ctrl.parent.listing.Lottery_Date | date : 'longDate' }}
span.content-group_time
| {{ $ctrl.parent.listing.Lottery_Date | date : 'shortTime' | lowercase }}
p.content-group_address.c-steel.skiptranslate
div.margin-top ng-if="$ctrl.parent.showCovidUpdate"
p.t-sans.margin-bottom--half translate="listings.apply.covid_update"
p.c-steel translate="listings.apply.covid_update_lotteries"
p.content-group_address.c-steel.skiptranslate ng-if="!$ctrl.parent.showCovidUpdate && $ctrl.parent.lotteryVenueAvailable($ctrl.parent.listing)"
| {{ $ctrl.parent.listing.Lottery_Venue }}
br
| {{ $ctrl.parent.listing.Lottery_Street_Address }}
Expand Down
10 changes: 5 additions & 5 deletions spec/javascripts/components/listingContainer_spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ do ->
ctrl.listingApplicationClosed(fakeListing)
expect(fakeListingIdentityService.isOpen).toHaveBeenCalled()

describe '$ctrl.lotteryDateVenueAvailable', ->
describe '$ctrl.lotteryDateAvailable', ->
beforeEach ->
listing = fakeListing
listing.Lottery_Date = new Date()
Expand All @@ -238,22 +238,22 @@ do ->

describe 'listing lottery date, venue and lottery address all have values', ->
it 'returns true', ->
expect(ctrl.lotteryDateVenueAvailable(listing)).toEqual true
expect(ctrl.lotteryDateAvailable(listing)).toEqual true

describe 'listing lottery date missing', ->
it 'returns false', ->
listing.Lottery_Date = undefined
expect(ctrl.lotteryDateVenueAvailable(listing)).toEqual false
expect(ctrl.lotteryDateAvailable(listing)).toEqual false

describe 'listing venue missing', ->
it 'returns false', ->
listing.Lottery_Venue = undefined
expect(ctrl.lotteryDateVenueAvailable(listing)).toEqual false
expect(ctrl.lotteryDateAvailable(listing)).toEqual true

describe 'listing lottery address missing', ->
it 'returns false', ->
listing.Lottery_Street_Address = undefined
expect(ctrl.lotteryDateVenueAvailable(listing)).toEqual false
expect(ctrl.lotteryDateAvailable(listing)).toEqual true

describe '$ctrl.formattedBuildingAddress', ->
it 'expects ListingDataService.formattedAddress to be called', ->
Expand Down

0 comments on commit e0507c0

Please sign in to comment.