-
Notifications
You must be signed in to change notification settings - Fork 27
Melanin Nikita #28
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
base: dev
Are you sure you want to change the base?
Melanin Nikita #28
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,15 @@ | |
*/ | ||
|
||
function Vacation(vacationStartDate, vacationEndDate) { | ||
if (!(vacationEndDate instanceof Date && vacationStartDate instanceof Date) || (vacationStartDate >= vacationEndDate)){ | ||
throw new UserException ("Invalid date vacation"); | ||
}; | ||
this.vacationStartDate = vacationStartDate; | ||
this.vacationEndDate = vacationEndDate; | ||
}; | ||
Vacation.prototype.isDateInVacation = function(date){ | ||
return date >= this.vacationStartDate && date <= this.vacationEndDate; | ||
|
||
} | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2 балла |
||
|
||
module.exports.Vacation = Vacation; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,16 @@ | |
@param {Array<Vacation>} vacations - Массив отпусков | ||
*/ | ||
|
||
function Organaizer(meetings = [], vacations = []) { | ||
const { Meeting } = require("../task-2"); | ||
const { Vacation } = require("../task-3"); | ||
|
||
function Organaizer(meetings = [], vacations = []){ | ||
if(!Array.isArray(meetings) || !Array.isArray(vacations) | ||
||meetings.some(x => !(x instanceof Meeting)) || meetings.some(x => !(x instanceof Vacation))){ | ||
throw new UserException("Invalid Array"); | ||
}; | ||
this.meetings = meetings; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Проверка на входные данные? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. У нас же указано, что поступает: "массив данных", зачем делать проверку? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Затем, что мне ничего не запрещает прокинуть туда что-то иное. |
||
this.vacations = vacations; | ||
}; | ||
|
||
module.exports.Organaizer = Organaizer; |
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.
Не все возможные случаи