-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #88 from Salesforce-org-Impact-Labs/housing-status
Housing status
- Loading branch information
Showing
24 changed files
with
578 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
force-app/main/default/classes/getRecommendationsServiceQuery.cls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
public with sharing class getRecommendationsServiceQuery { | ||
|
||
// list of services with any hard filters | ||
// hard filters are currently Age | ||
public static list<Service__c> primaryQuery(Client_Profile__c client) { | ||
decimal age = calculateAge(client.Date_Of_Birth__c); | ||
decimal defaultMaxDistance = [ | ||
SELECT Default_Max_Distance__c | ||
FROM RefRecSettings__mdt | ||
] | ||
.Default_Max_Distance__c; | ||
return [ | ||
SELECT | ||
id, | ||
Name, | ||
Account__c, | ||
Account__r.Name, | ||
Description__c, | ||
City__c, | ||
Phone__c, | ||
Street__c, | ||
Type__c, | ||
Website__c, | ||
Zip_Code__c, | ||
Preferred__c, | ||
Near_Homeless__c, | ||
Homeless__c, | ||
Runaway__c, | ||
Home_Owner__c, | ||
Home_Renter__c, | ||
DISTANCE( | ||
Location__c, | ||
GEOLOCATION(:client.Location__Latitude__s, | ||
:client.Location__Longitude__s | ||
), | ||
'mi' | ||
) dist | ||
FROM Service__c | ||
WHERE | ||
(Minimum_Age__c = null | ||
OR Minimum_Age__c < :age) | ||
AND (Maximum_Age__c = null | ||
OR Maximum_Age__c > :age) | ||
AND DISTANCE( | ||
Location__c, | ||
GEOLOCATION(:client.Location__Latitude__s, | ||
:client.Location__Longitude__s | ||
), | ||
'mi' | ||
) < :defaultMaxDistance | ||
]; | ||
} | ||
|
||
public static decimal calculateAge(Date DOB) { | ||
return DOB.daysBetween(system.today()) / 365; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
force-app/main/default/classes/getRecommendationsServiceQuery.cls-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>48.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
45 changes: 45 additions & 0 deletions
45
force-app/main/default/customMetadata/Scoring_Metric.Homeless.md-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<CustomMetadata xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
<label>Homeless</label> | ||
<protected>false</protected> | ||
<values> | ||
<field>Based_on_Service_Field__c</field> | ||
<value xsi:type="xsd:boolean">false</value> | ||
</values> | ||
<values> | ||
<field>Calculate_User_Level__c</field> | ||
<value xsi:type="xsd:boolean">false</value> | ||
</values> | ||
<values> | ||
<field>Description__c</field> | ||
<value xsi:type="xsd:string">weighting factor for matches on housing status</value> | ||
</values> | ||
<values> | ||
<field>Org_Level__c</field> | ||
<value xsi:type="xsd:boolean">true</value> | ||
</values> | ||
<values> | ||
<field>Org_Maximum__c</field> | ||
<value xsi:type="xsd:double">1.0</value> | ||
</values> | ||
<values> | ||
<field>Org_Minimum__c</field> | ||
<value xsi:type="xsd:double">0.0</value> | ||
</values> | ||
<values> | ||
<field>Org_SOQL_Query__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>Service_Level_SOQL_Query__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>User_ID__c</field> | ||
<value xsi:nil="true"/> | ||
</values> | ||
<values> | ||
<field>Weighting__c</field> | ||
<value xsi:type="xsd:double">5.0</value> | ||
</values> | ||
</CustomMetadata> |
Oops, something went wrong.