1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

[feature] export last connection date to members.xlsx

This commit is contained in:
Sylvain 2019-10-29 11:09:17 +01:00
parent f94d8feba6
commit 1ed3eba129
7 changed files with 19 additions and 3 deletions

View File

@ -435,6 +435,8 @@ Developers may find information on how to implement their own authentication pro
- In some cases, the invoices won't be generated. This can be due to the image included in the invoice header not being supported.
To fix this issue, change the image in the administrator interface (manage the invoices / invoices settings).
See [this thread](https://forum.fab-manager.com/t/resolu-erreur-generation-facture/428) for more info.
- In the excel exports, if the cells expected to contain dates are showing strange numbers, check that you have correctly configured the [EXCEL_DATE_FORMAT](doc/environment.md#EXCEL_DATE_FORMAT) variable.
<a name="related-documentation"></a>
## Related Documentation

View File

@ -115,8 +115,16 @@ class API::MembersController < API::ApiController
def export_members
authorize :export
last_update = [
User.with_role(:member).maximum('updated_at'),
Profile.where(user_id: User.with_role(:member)).maximum('updated_at'),
InvoicingProfile.where(user_id: User.with_role(:member)).maximum('updated_at'),
StatisticProfile.where(user_id: User.with_role(:member)).maximum('updated_at'),
Subscription.maximum('updated_at')
].max
export = Export.where(category: 'users', export_type: 'members')
.where('created_at > ?', User.with_role(:member).maximum('updated_at'))
.where('created_at > ?', last_update)
.last
if export.nil? || !FileTest.exist?(export.file)
@export = Export.new(category: 'users', export_type: 'members', user: current_user)

View File

@ -14,6 +14,7 @@ wb.add_worksheet(name: t('export_members.members')) do |sheet|
t('export_members.first_name'),
t('export_members.email'),
t('export_members.newsletter'),
t('export_members.last_login'),
t('export_members.gender'),
t('export_members.age'),
t('export_members.address'),
@ -45,6 +46,7 @@ wb.add_worksheet(name: t('export_members.members')) do |sheet|
member.profile.first_name,
member.email,
member.is_allow_newsletter,
member.last_sign_in_at&.to_date,
member.statistic_profile.gender ? t('export_members.man') : t('export_members.woman'),
member.statistic_profile.age,
member.invoicing_profile&.address&.address || '',
@ -66,10 +68,10 @@ wb.add_worksheet(name: t('export_members.members')) do |sheet|
member.invoicing_profile&.organization&.name || '',
member.invoicing_profile&.organization&.address&.address || ''
]
styles = [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
styles = [nil, nil, nil, nil, nil, date, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, date, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil]
types = %i[integer string string string boolean string integer string string string string string
types = %i[integer string string string boolean date string integer string string string string string
string string string date string string integer string string string string string string string]
sheet.add_row data, style: styles, types: types

View File

@ -167,6 +167,7 @@ en:
first_name: "First name"
email: "E-mail"
newsletter: "Newsletter"
last_login: "Last login"
gender: "Gender"
age: "Age"
address: "Address"

View File

@ -167,6 +167,7 @@ es:
first_name: "Nombre"
email: "E-mail"
newsletter: "Hoja informativa"
last_login: "Último acceso"
gender: "Genero"
age: "Edad"
address: "Dirección"

View File

@ -167,6 +167,7 @@ fr:
first_name: "Prénom"
email: "Courriel"
newsletter: "Lettre d'informations"
last_login: "Dernière connexion"
gender: "Genre"
age: "Âge"
address: "Adresse"

View File

@ -167,6 +167,7 @@ pt:
first_name: "Primeiro nome"
email: "E-mail"
newsletter: "Newsletter"
last_login: "Último login"
gender: "Gênero"
age: "Idade"
address: "Endereço"