Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1539 from ONSdigital/eq-1980-mwss-group-pay-break…
Browse files Browse the repository at this point in the history
…downs-validations

Added group breakdown validations
  • Loading branch information
shahi645 authored Apr 12, 2018
2 parents fe5d2bb + 232a158 commit 82deff6
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/validation/error_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
'NUMBER_TOO_LARGE_EXCLUSIVE': 'Enter an answer less than %(max)s.',
'TOTAL_SUM_NOT_EQUALS': 'Enter answers that add up to %(total)s',
'TOTAL_SUM_NOT_LESS_THAN_OR_EQUALS': 'Enter answers that add up to or are less than %(total)s',
'TOTAL_SUM_NOT_LESS_THAN': 'Enter answers that are less than %(total)s',
'TOTAL_SUM_NOT_GREATER_THAN': 'Enter answers that are greater than %(total)s',
'TOTAL_SUM_NOT_LESS_THAN': 'Enter answers that add up to less than %(total)s',
'TOTAL_SUM_NOT_GREATER_THAN': 'Enter answers that add up to greater than %(total)s',
'TOTAL_SUM_NOT_GREATER_THAN_OR_EQUALS': 'Enter answers that add up to or are greater than %(total)s',
'INVALID_NUMBER': 'Enter a number.',
'INVALID_INTEGER': 'Enter a whole number.',
Expand Down
69 changes: 64 additions & 5 deletions data/en/1_0005.json
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,20 @@
],
"id": "weekly-pay-breakdown-question",
"title": "Of the <em>{{answers.weekly_total_gross|format_currency}}</em> paid to <em>weekly</em> paid employees in the last week of {{exercise.period_str}}, what other amounts were paid? ",
"type": "General",
"type": "Calculated",
"calculations": [{
"calculation_type": "sum",
"answer_id": "weekly-pay-gross-pay-answer",
"answers_to_calculate": [
"weekly-pay-breakdown-holiday-answer",
"weekly-pay-breakdown-arrears-answer",
"weekly-pay-breakdown-prp-answer"
],
"conditions": [
"less than",
"equals"
]
}],
"guidance": {
"content": [{
"title": "Include:",
Expand Down Expand Up @@ -892,7 +905,20 @@
],
"id": "fortnightly-pay-breakdown-question",
"title": "Of the <em>{{answers.fortnightly_total_gross|format_currency}}</em> paid to <em>fortnightly</em> paid employees in the last week of {{exercise.period_str}}, what other amounts were paid?",
"type": "General",
"type": "Calculated",
"calculations": [{
"calculation_type": "sum",
"answer_id": "fortnightly-pay-gross-pay-answer",
"answers_to_calculate": [
"fortnightly-pay-breakdown-holiday-answer",
"fortnightly-pay-breakdown-arrears-answer",
"fortnightly-pay-breakdown-prp-answer"
],
"conditions": [
"less than",
"equals"
]
}],
"guidance": {
"content": [{
"title": "Include:",
Expand Down Expand Up @@ -1296,7 +1322,18 @@
],
"id": "calendar-monthly-pay-breakdown-question",
"title": "Of the <em>{{answers.monthly_total_gross|format_currency}}</em> paid to <em>calendar monthly</em> paid employees in {{exercise.period_str}}, what other amounts were paid?",
"type": "General",
"type": "Calculated",
"calculations": [{
"calculation_type": "sum",
"answer_id": "calendar-monthly-pay-gross-pay-answer",
"answers_to_calculate": [
"calendar-monthly-pay-breakdown-arrears-answer",
"calendar-monthly-pay-breakdown-prp-answer"
],
"conditions": [
"less than"
]
}],
"guidance": {
"content": [{
"title": "Include:",
Expand Down Expand Up @@ -1700,7 +1737,18 @@
],
"id": "four-weekly-pay-breakdown-question",
"title": "Of the <em>{{answers.four_weekly_total_gross|format_currency}}</em> paid to <em>four weekly</em> paid employees in {{exercise.period_str}}, what other amounts were paid?",
"type": "General",
"type": "Calculated",
"calculations": [{
"calculation_type": "sum",
"answer_id": "four-weekly-pay-gross-pay-answer",
"answers_to_calculate": [
"four-weekly-pay-breakdown-arrears-answer",
"four-weekly-pay-breakdown-prp-answer"
],
"conditions": [
"less than"
]
}],
"guidance": {
"content": [{
"title": "Include:",
Expand Down Expand Up @@ -2112,7 +2160,18 @@
],
"id": "five-weekly-pay-breakdown-question",
"title": "Of the <em>{{answers.five_weekly_total_gross|format_currency}}</em> paid to <em>five weekly paid employees</em> in {{exercise.period_str}}, what other amounts were paid?",
"type": "General",
"type": "Calculated",
"calculations": [{
"calculation_type": "sum",
"answer_id": "five-weekly-pay-gross-pay-answer",
"answers_to_calculate": [
"five-weekly-pay-breakdown-arrears-answer",
"five-weekly-pay-breakdown-prp-answer"
],
"conditions": [
"less than"
]
}],
"guidance": {
"content": [{
"title": "Include:",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe('Feature: Sum of grouped answers validation against total', function()
.setValue(BreakdownAnswerPage.breakdown3(), '3')
.setValue(BreakdownAnswerPage.breakdown4(), '3')
.click(BreakdownAnswerPage.submit())
.getText(BreakdownAnswerPage.errorNumber(1)).should.eventually.contain('Enter answers that are less than £12.00');
.getText(BreakdownAnswerPage.errorNumber(1)).should.eventually.contain('Enter answers that add up to less than £12.00');
});
});

Expand All @@ -114,7 +114,7 @@ describe('Feature: Sum of grouped answers validation against total', function()
.setValue(BreakdownAnswerPage.breakdown3(), '3')
.setValue(BreakdownAnswerPage.breakdown4(), '3')
.click(BreakdownAnswerPage.submit())
.getText(BreakdownAnswerPage.errorNumber(1)).should.eventually.contain('Enter answers that are less than £5.00');
.getText(BreakdownAnswerPage.errorNumber(1)).should.eventually.contain('Enter answers that add up to less than £5.00');
});
});
});
Expand Down

0 comments on commit 82deff6

Please sign in to comment.