This file contains hidden or 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
// averageScore: float | |
// numReviews: int | |
// weightDecelerationFactor: float (a higher weightDecelerationFactor represents lower marginal value per each additional review, a lower weightDecelerationFactor represents higher marginal value per each additional review) | |
function parseScoreWithNumReviewsTotalValue(averageScore, numReviews, weightDecelerationFactor) { | |
let nextReviewWeight = 1; | |
let totalNumReviewsWeightFactor = 1; | |
// Check to ensure weightDecelerationFactor is in bounds | |
if (weightDecelerationFactor <= 0.00 || weightDecelerationFactor >= 1.00) { | |
console.log("please provide a valid float value between 0 and 1 for the weightDecelerationFactor"); |
This file contains hidden or 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
class Chef < ApplicationRecord | |
has_many :recipes | |
has_many :meals, through: :recipes | |
end | |
class Recipe < ApplicationRecord | |
belongs_to :chef | |
belongs_to :meal | |
end |