Skip to content
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

remove expenses explantion and just show links #1175

Merged
merged 1 commit into from Sep 15, 2016
Merged

Conversation

struan
Copy link
Member

@struan struan commented Sep 14, 2016

Instead of explaining why we don't have expenses for an MP just link to
the information. Also fix it so we only link to the relevant
information.

Fixes #313

Copy link
Member

@dracos dracos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I think it can be simplified with a change to has_expenses.

// Set the expenses URL if we know it
if (isset($MEMBER->extra_info['expenses_url'])) {
$data['expenses_url_2004'] = $MEMBER->extra_info['expenses_url'];
if (strtotime($data['entry_date']) > strtotime('2010-05-05')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need the strtotimes here, string comparison will be fine.

@@ -335,11 +336,24 @@
# XXX This is current behaviour, but should probably now just be any recent MP
$data['has_expenses'] = isset($MEMBER->extra_info['expenses2004_col1']) || isset($MEMBER->extra_info['expenses2006_col1']) || isset($MEMBER->extra_info['expenses2007_col1']) || isset($MEMBER->extra_info['expenses2008_col1']);
Copy link
Member

@dracos dracos Sep 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has_expenses is presumably out of date in that all new MPs it'll be false? As per comment, should probably be any MP with a leave date since 2004 sometime. That'll then simplify the new code as well I think.

$data['pre_2010_expenses'] = True;
$data['expenses_url_2004'] = 'http://mpsallowances.parliament.uk/mpslordsandoffices/hocallowances/allowances%2Dby%2Dmp/';
}
if (strtotime($data['leave_date']) > strtotime('2010-05-05')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto strtotime.

$data['pre_2010_expenses'] = True;
$data['expenses_url_2004'] = $MEMBER->extra_info['expenses_url'];
} else {
$data['pre_2010_expenses'] = True;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So pre is always set to True :)

@@ -333,13 +334,19 @@
# Everyone who is currently somewhere has email alert signup, apart from current Sinn Fein MPs who are not MLAs
$data['has_email_alerts'] = ($MEMBER->current_member_anywhere() && !($MEMBER->current_member(HOUSE_TYPE_COMMONS) && $MEMBER->party() == 'SF' && !$MEMBER->current_member(HOUSE_TYPE_NI)));
# XXX This is current behaviour, but should probably now just be any recent MP
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can remove the XXX comment now :)

Instead of explaining why we don't have expenses for an MP just link to
the information. Also fix it so we only link to the relevant
information.

Fixes #313
@struan struan merged commit f8ffbfb into master Sep 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Design of MP's expenses
2 participants