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

Fix issue where row_number starts from 3 on a job report download #1077

Merged
merged 2 commits into from
Jan 20, 2017

Conversation

imdadahad
Copy link
Contributor

This fixes an issue where a job report download starts with a row_number of 3.

Issue

We were originally checking to see if a row_number existed with if dict.get('row_number').... This however evaluated to False if a row_number was 0. We were also incrementing the row number by 2 in the format, so the minimum number we could ever format to was 3.

Fix

Changed the format to explicitly check for 0 and ensure we only increment by 1. The ensures if a row number is:

None -> ''
0 -> 1
1 -> 2
...

if row_num is not None and row_num >= 0:
row_num += 1
else:
row_num = ''
Copy link
Contributor

Choose a reason for hiding this comment

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

pretty sure this can be simplified, because row_num will never be not None but not >= 0 (ie: a negative number)

row_num = '' if row_num is None else row_num + 1

or alternatively if you prefer the full layout

if row_num is None:
    row_num = ''
else:
    row_num += 1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@imdadahad imdadahad merged commit 18b2936 into master Jan 20, 2017
@imdadahad imdadahad deleted the fix-row-number-issue-on-report-download branch January 20, 2017 12:38
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.

None yet

2 participants