-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feedback #1
base: feedback
Are you sure you want to change the base?
Feedback #1
Conversation
// The body of the method | ||
//} | ||
public static List<Lead> getAllLeads () { | ||
List<Lead> allLeads = [SELECT Id, LastName, Company, Phone, Email FROM Lead]; |
Check warning
Code scanning / PMD
When working with very large amounts of data, unfiltered SOQL or SOSL queries can quickly cause [governor limit](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_gov_limits.htm) exceptions. Warning
// The body of the method | ||
//} | ||
public static Integer getAccountCount () { | ||
Integer count = [SELECT COUNT() FROM Account]; |
Check warning
Code scanning / PMD
When working with very large amounts of data, unfiltered SOQL or SOSL queries can quickly cause [governor limit](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_gov_limits.htm) exceptions. Warning
@@ -225,7 +225,7 @@ | |||
|
|||
// Assert that the number of cases returned is correct | |||
System.assertEquals(1, cases.size(), 'Number of cases returned is incorrect.'); | |||
|
|||
System.debug(cases); |
Check warning
Code scanning / PMD
Debug statements contribute to longer transactions and consume Apex CPU time even when debug logs are not being captured. When possible make use of other debugging techniques such as the Apex Replay Debugger and Checkpoints that could cover *most* use cases. For other valid use cases that the statement is in fact valid make use of the `@SuppressWarnings` annotation or the `//NOPMD` comment. Warning
@@ -225,7 +225,7 @@ | |||
|
|||
// Assert that the number of cases returned is correct | |||
System.assertEquals(1, cases.size(), 'Number of cases returned is incorrect.'); | |||
|
|||
System.debug(cases); |
Check warning
Code scanning / PMD
The first parameter of System.debug, when using the signature with two parameters, is a LoggingLevel enum. Having the Logging Level specified provides a cleaner log, and improves readability of it. Warning
@@ -142,16 +198,17 @@ | |||
* @return A list of Contact LastName. | |||
*/ | |||
public static List<String> getContactNamesByAccount(Id accountId) { | |||
// Create a list to hold the Contact LastNames | |||
List<String>ContactsLastNames = new List<String>(); |
Check failure
Code scanning / PMD
Configurable naming conventions for local variable declarations. This rule reports variable declarations which do not match the regex that applies to their specific kind (e.g. local variable, or final local variable). Each regex can be configured through properties. By default this rule uses the standard Apex naming convention (Camel case). Error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks really good, I have very little comments to make that would improve it. Beautifully formatted which makes it very easy to read. Good job.
Date today = Date.today(); | ||
Date nextWeek = today.addDays(7); | ||
List <Task> tasksDue = [ | ||
SELECT Id, Subject, ActivityDate | ||
FROM Task | ||
WHERE ActivityDate >= :today | ||
AND ActivityDate <= :nextWeek | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use Date variables and binds for this. There are also relative date formula you can use in queries. Similar to the ones you can use in reports.
WHERE Origin NOT IN ('Web', 'Email', '') | ||
AND Origin != null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In SOQL null and empty string evaluate to the same, so you shouldnt need the extra != NULL, but it is not hurting anything.
@@ -142,16 +198,17 @@ public with sharing class SOQL { | |||
* @return A list of Contact LastName. | |||
*/ | |||
public static List<String> getContactNamesByAccount(Id accountId) { | |||
// Create a list to hold the Contact LastNames | |||
List<String>ContactsLastNames = new List<String>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List<String>ContactsLastNames = new List<String>(); | |
List<String> contactsLastNames = new List<String>(); |
// Return the total revenue | ||
return null; // Replace null with the variable you used to store the result | ||
AggregateResult[] results = [SELECT SUM(Amount) totalAmount FROM Opportunity WHERE StageName = :stage OR Amount > 10000]; | ||
Decimal totalRevenue = (Decimal)results[0].get('totalAmount'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
List<Account> accounts = [ | ||
SELECT Id, BillingState | ||
FROM Account | ||
WHERE Id = :accountId | ||
]; | ||
|
||
String accountBillingState = accounts[0].BillingState; | ||
|
||
// Store the Account's BillingState | ||
List<Contact> contacts = [ | ||
SELECT Id, MailingState | ||
FROM Contact | ||
WHERE MailingState = :accountBillingState | ||
]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also do this as one query, see if you can figure out that syntax. HINT: you can use a query in the criteria
|
||
List<OpportunityLineItem> newLineItems = new List<OpportunityLineItem>(); | ||
|
||
Integer genNum = Integer.valueOf(Math.random() * 3 + 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably should be within in the for loop so it is a random quantity every time. The instructions are a little unclear here and ultimately doesnt really matter.
👋! GitHub Classroom created this pull request as a place for your teacher to leave feedback on your work. It will update automatically. Don’t close or merge this pull request, unless you’re instructed to do so by your teacher.
In this pull request, your teacher can leave comments and feedback on your code. Click the Subscribe button to be notified if that happens.
Click the Files changed or Commits tab to see all of the changes pushed to the default branch since the assignment started. Your teacher can see this too.
Notes for teachers
Use this PR to leave feedback. Here are some tips:
For more information about this pull request, read “Leaving assignment feedback in GitHub”.
Subscribed: @snomis79