Feature enable export reports to csv file#326
Conversation
|
@dybi Yes, it is intended, as it is not technically possible for CSV file to have more than 1 sheet, so I have assumed that we want to export only single user report. If we want to export multi-sheet project report too, I would need a sample of output file structure. @Karrp do we want that and could you provide that sample? |
|
@rwrzesien I think that @Karrp is now unreachable so I think that structure of this output may be as follows: where N is a invisible number and is used only for example purposes. I think that this may looks like this. What do you think guys @rwrzesien @dybi ? |
|
@kbeker Nice idea, I like it! Will require some extra work but definitely doable. |
692027d to
1a9e205
Compare
kbeker
left a comment
There was a problem hiding this comment.
In my opinion everything is OK, but please fix this in comments :)
employees/common/exports.py
Outdated
| next_row = [] | ||
| for cell_number, cell in enumerate(row, start=1): | ||
| if isinstance(cell.value, str) and cell.value.lower().startswith("=timevalue"): | ||
| hours_as_string = cell.value[len('=timevalue("') : -len('")')] |
There was a problem hiding this comment.
Please fix:
=============================== LINT ===============================
[FLAKE8: sheetstorm]
./employees/common/exports.py:245:65: E203 whitespace before ':'
There was a problem hiding this comment.
This is being set by black, so we can either disable it black config, or disable it in pylint config, or disable it only for this single line, what do you think would be best in this case?
Btw. where is black config file in our repo? I couldn't find it.
There was a problem hiding this comment.
@rwrzesien Actually we don't have black config. We give parameters explicitly to black command. Can we by black config disable only one line in whole file?
employees/common/exports.py
Outdated
|
|
||
|
|
||
| def save_work_book_as_csv(writer: csv.DictWriter, work_book: Workbook) -> None: | ||
| sheet = work_book.get_active_sheet() |
There was a problem hiding this comment.
Please change it into:
sheet = work_book.active
This does the same thing, but get_active_sheet() method will be deleted in future versions and because of it we get warnings at the end of full_check
employees/common/exports.py
Outdated
| writer.writerow(next_row) | ||
|
|
||
|
|
||
| def save_work_book_as_zip_of_csv(work_book: Workbook) -> zipfile.ZipFile: |
There was a problem hiding this comment.
Don't you return here BytesIO object?
There was a problem hiding this comment.
Right, ZIP was returned in previous version of the code. 👍 done
| {% with date=path|extract_year_and_month_from_url %} | ||
| <a href="{% url 'export-project-data-xlsx' pk=object.pk year=date.0 month=date.1 %}" class="btn btn-info"> | ||
| Export Reports | ||
| Export Reports |
There was a problem hiding this comment.
Please add here that this button gives XLSX export
| @@ -100,6 +100,9 @@ <h4><font color="red">{{ error }}</font></h4> | |||
| <a href="{% url 'export-data-xlsx' pk=user.pk year=date.0 month=date.1 %}" class="btn btn-info"> | |||
| Export {{ date.1 | convert_to_month_name }} {{ date.0 }} Reports | |||
There was a problem hiding this comment.
Please add here that this gives XLSX export :)
1a9e205 to
6c709d9
Compare
6c709d9 to
16f8f76
Compare
Resolves #311