Skip to content

Commit

Permalink
Merge branch 'main' into DAH-2865-DOB-field-translations-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jimlin-sfgov authored Jan 23, 2025
2 parents 64dbbe6 + f3905af commit 7ab0cc8
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 21 deletions.
12 changes: 9 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ _just one or two sentences_

https://sfgovdt.jira.com/browse/<JIRA TICKET NUMBER>

## Checklist before requesting review
## Before requesting eng review

### Version Control

Expand All @@ -20,16 +20,22 @@ https://sfgovdt.jira.com/browse/<JIRA TICKET NUMBER>
- [ ] all automated code checks pass (linting, tests, coverage, etc.)
- [ ] code irrelevant to the ticket is not modified e.g. changing indentation due to automated formatting
- [ ] if the code changes the UI, it matches the UI design exactly
- [ ] if the changes include human translations, follow the [human translations process](https://sfgovdt.jira.com/l/cp/XS1KpvE4)

### Review instructions

- [ ] instructions specify which environment(s) it applies to
- [ ] instructions work for PA testers
- [ ] instructions have already been performed at least once

### Request review
### Request eng review

- [ ] PR has `needs review` label
- [ ] Use `Housing Eng` group to automatically assign reviewers, and/or assign specific engineers
- [ ] If time sensitive, notify engineers in Slack

## Before merging

### Request product acceptance testing

- [ ] Code change is behind a feature flag
- [ ] If code change is not behind a feature flag, it has been PA tested in the review environment (use `needs product acceptance` label to indicate that the PR is waiting for PA testing)
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ div ng-if="::$ctrl.application.householdIncome.incomeTotal"
| {{::$ctrl.applicationIncomeAmount()}}

/ Preferences
div ng-if="::!$ctrl.atAutofillPreview"
div ng-if="::(!$ctrl.atAutofillPreview && !$ctrl.isDALPListing())"
review-summary-section header="{{'label.preferences' | translate}}" section-name="{{::$ctrl.getStartOfSection({name: 'Preferences'})}}" editable="::$ctrl.sectionsAreEditable" edit-description="{{'label.edit_preferences' | translate}}"
preferences-summary application="$ctrl.application" listing="$ctrl.listing" preferences="$ctrl.preferences"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ angular.module('dahlia.components')
preferences: '<'
showVeteransApplicationQuestion: '<'
controller: [
'$filter', '$state', '$translate', 'LendingInstitutionService', 'ShortFormHelperService', 'ShortFormNavigationService', 'ShortFormRaceEthnicityService',
($filter, $state, $translate, LendingInstitutionService, ShortFormHelperService, ShortFormNavigationService, ShortFormRaceEthnicityService) ->
'$filter', '$state', '$translate', 'LendingInstitutionService', 'ShortFormHelperService', 'ShortFormNavigationService', 'ShortFormRaceEthnicityService', 'ListingDataService',
($filter, $state, $translate, LendingInstitutionService, ShortFormHelperService, ShortFormNavigationService, ShortFormRaceEthnicityService, ListingDataService) ->
ctrl = @

ctrl.$onInit = ->
Expand Down Expand Up @@ -133,5 +133,8 @@ angular.module('dahlia.components')
ctrl.getIsNonPrimaryMemberVeteran = ->
ctrl.translatedYesNoNoAnswer(ctrl.application.isNonPrimaryMemberVeteran)

ctrl.isDALPListing = ->
ListingDataService.listing.Custom_Listing_Type == 'Downpayment Assistance Loan Program'

return ctrl
]
2 changes: 1 addition & 1 deletion app/javascript/authentication/SignInForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const SignInForm = () => {

const onSubmit = (data: { email: string; password: string }) => {
const { email, password } = data

setRequestError("")
signIn(email, password)
.then(() => {
window.location.href = getMyAccountPath()
Expand Down
25 changes: 17 additions & 8 deletions app/javascript/modules/listings/DirectoryHelpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,12 @@ export const getListingGroup = (
hasFiltersSet?: boolean,
subtitle?: string,
icon?: IconTypes,
isOpen?: boolean
isOpen?: boolean,
newDirectoryEnabled?: boolean
) => {
const showListingsGroup = section !== DIRECTORY_SECTION_ADDITIONAL_LISTINGS || listings.length > 0
const showListingsGroup =
(newDirectoryEnabled && section !== DIRECTORY_SECTION_ADDITIONAL_LISTINGS) ||
listings.length > 0
return (
showListingsGroup && (
<ListingsGroup
Expand Down Expand Up @@ -357,7 +360,8 @@ export const upcomingLotteriesView = (
directoryType,
stackedDataFxn: StackedDataFxnType,
observerRef: React.MutableRefObject<null | IntersectionObserver>,
isOpen: boolean
isOpen: boolean,
newDirectoryEnabled?: boolean
) => {
return getListingGroup(
listings,
Expand All @@ -372,7 +376,8 @@ export const upcomingLotteriesView = (
undefined,
t("listings.upcomingLotteries.subtitle"),
null,
isOpen
isOpen,
newDirectoryEnabled
)
}

Expand All @@ -381,7 +386,8 @@ export const lotteryResultsView = (
directoryType,
stackedDataFxn: StackedDataFxnType,
observerRef: React.MutableRefObject<null | IntersectionObserver>,
isOpen?: boolean
isOpen?: boolean,
newDirectoryEnabled?: boolean
) => {
return getListingGroup(
listings,
Expand All @@ -396,7 +402,8 @@ export const lotteryResultsView = (
undefined,
t("listings.lotteryResults.subtitle"),
"result",
isOpen
isOpen,
newDirectoryEnabled
)
}

Expand All @@ -406,7 +413,8 @@ export const additionalView = (
stackedDataFxn: StackedDataFxnType,
observerRef: React.MutableRefObject<null | IntersectionObserver>,
filtersSet?: boolean,
isOpen?: boolean
isOpen?: boolean,
newDirectoryEnabled?: boolean
) => {
return getListingGroup(
listings,
Expand All @@ -421,7 +429,8 @@ export const additionalView = (
filtersSet,
t("listings.additional.subtitle"),
"doubleHouse",
isOpen
isOpen,
newDirectoryEnabled
)
}

Expand Down
9 changes: 6 additions & 3 deletions app/javascript/modules/listings/GenericDirectory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,21 +193,24 @@ export const GenericDirectory = (props: RentalDirectoryProps) => {
props.getSummaryTable,
observerRef,
hasFiltersSet,
additionalIsOpen
additionalIsOpen,
newDirectoryEnabled
)}
{upcomingLotteriesView(
listings.upcoming,
props.directoryType,
props.getSummaryTable,
observerRef,
upcomingIsOpen
upcomingIsOpen,
newDirectoryEnabled
)}
{lotteryResultsView(
listings.results,
props.directoryType,
props.getSummaryTable,
observerRef,
resultsIsOpen
resultsIsOpen,
newDirectoryEnabled
)}
</div>
</>
Expand Down
6 changes: 4 additions & 2 deletions app/services/force/listing_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def self.listing(id, opts = {})
results = Request.new(parse_response: true).cached_get(endpoint, nil, force)
listing = process_listing_images(results)

translation_usage_by_trigger(listing, opts[:rake_task])
translation_usage_by_trigger(listing, opts[:rake_task]) if listing.present?

if Rails.configuration.unleash.is_enabled? 'GoogleCloudTranslate'
listing['translations'] = get_listing_translations(listing) || {}
Expand All @@ -50,7 +50,9 @@ def self.listing(id, opts = {})

def self.translation_usage_by_trigger(listing, rake_task = nil)
# only one of these feature flags should be turned on at a time
if Rails.configuration.unleash.is_enabled? 'LogGoogleCloudTranslateUsageForPageView'
if Rails.configuration.unleash.is_enabled?(
'LogGoogleCloudTranslateUsageForPageView',
) && rake_task.blank?
listing['translations'] = log_listing_translations(listing, 'page_view')
elsif Rails.configuration.unleash.is_enabled?(
'LogGoogleCloudTranslateUsageForPrefetch10Min',
Expand Down
2 changes: 1 addition & 1 deletion cypress/fixtures/openSaleListing.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
"Year_Built": 2018,
"LastModifiedDate": "2024-02-15T23:10:52.000+0000",
"Marketing_URL": "TEST-Sale-Listi-Jan19",
"Application_Due_Date": "2025-01-03T01:00:00.000+0000",
"Application_Due_Date": "2100-01-03T01:00:00.000+0000",
"Building_URL": "https://sfmohcd.org/sites/default/files/Documents/MOH/Housing%20Listing%20Photos/test-apologies.png",
"Legal_Disclaimers": "Some important program rules with bullets:\n<ul><li>Rule one</li><li>Rule two</li></ul>",
"Application_State": "CA",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ do ->
getStartOfSection: jasmine.createSpy()
fakeShortFormRaceEthnicityService =
salesforceToHumanReadable: jasmine.createSpy()
fakeListingDataService =
getListing: jasmine.createSpy()

beforeEach module('dahlia.components')
beforeEach module('customFilters', ($provide) ->)

Expand All @@ -55,6 +58,7 @@ do ->
ShortFormHelperService: fakeShortFormHelperService
ShortFormNavigationService: fakeShortFormNavigationService
ShortFormRaceEthnicityService: fakeShortFormRaceEthnicityService
ListingDataService: fakeListingDataService
)

beforeEach ->
Expand Down

0 comments on commit 7ab0cc8

Please sign in to comment.