Skip to content

Commit

Permalink
Use discardable return in func return to allow better tetsing
Browse files Browse the repository at this point in the history
  • Loading branch information
mazevedofs committed Oct 11, 2024
1 parent 5b213a7 commit b5b677b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ public class WMFYearInReviewDataController {
return true
}

public func createOrRetrieveYearInReview(for year: Int, countryCode: String, primaryAppLanguageProject: WMFProject?) async {
@discardableResult
public func createOrRetrieveYearInReview(for year: Int, countryCode: String, primaryAppLanguageProject: WMFProject?) async -> WMFYearInReviewReport? {

guard shouldCreateOrRetrieveYearInReview(countryCode: countryCode, primaryAppLanguageProject: primaryAppLanguageProject) else {
return
return nil
}

var report = try? await fetchYearInReviewReport(forYear: year)
Expand All @@ -58,6 +59,7 @@ public class WMFYearInReviewDataController {
report = try? await fetchYearInReviewReport(forYear: year)
}

return report
}

func getSlides() -> [WMFYearInReviewSlide] {
Expand Down

0 comments on commit b5b677b

Please sign in to comment.