Skip to content

Commit

Permalink
Merge branch 'dev' for release 2.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvainbx committed Nov 21, 2016
2 parents 8ab2df1 + 1747157 commit e365034
Show file tree
Hide file tree
Showing 15 changed files with 92 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .fabmanager-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.2
2.4.3
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog Fab Manager

## v2.4.3 2016 November 21

- Export user's invoicing status in members' excel export
- Fix a bug: Next events descriptions, shown on the home page, display raw html
- Fix a bug: number of reserved seats for an event is always of 1 in the excel export of reservations
- Fix a bug: conflict between similar translations around "reservations"
- Fix a bug: later occurrences of recurrent events does not have the initially configured theme and age range
- Fix a bug: some graphs do not display: events, users, trainings and machine hours
- [TODO DEPLOY] delete the `exports/users/reservations` folder to prevent the usage of old invalid exports

## v2.4.2 2016 November 8

- Image max size is configurable, default size is 2 megabytes
Expand Down
2 changes: 2 additions & 0 deletions app/assets/javascripts/controllers/admin/graphs.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,8 @@ Application.Controllers.controller "GraphsController", ["$scope", "$state", "$ro
"type": esType
"searchType": "count"
"stat-type": statType
"start-date": moment($scope.datePickerStart.selected).format()
"end-date": moment($scope.datePickerEnd.selected).format()
"body": buildElasticAggregationsQuery(statType, $scope.display.interval, moment($scope.datePickerStart.selected), moment($scope.datePickerEnd.selected))
, (error, response) ->
if (error)
Expand Down
2 changes: 1 addition & 1 deletion app/assets/templates/admin/events/reservations.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</div>
<div class="col-xs-10 col-sm-10 col-md-8 b-l">
<section class="heading-title">
<h1>{{ 'reservations' | translate }} {{event.title}}</h1>
<h1>{{ 'the_reservations' | translate }} {{event.title}}</h1>
</section>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/assets/templates/home.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<span class="v-middle badge text-xs" ng-class="'bg-{{event.category.name | lowercase}}'">{{event.category.name}}</span>
</div>
</div>
<p>{{event.description | humanize : 500 }}</p>
<p ng-bind-html="event.description | simpleText | humanize : 500 | breakFilter"></p>

<hr/>
<div class="row">
Expand Down
6 changes: 5 additions & 1 deletion app/controllers/api/exports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ class API::ExportsController < API::ApiController
def download
authorize @export

send_file File.join(Rails.root, @export.file), :type => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', :disposition => 'attachment'
if FileTest.exist?(@export.file)
send_file File.join(Rails.root, @export.file), :type => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', :disposition => 'attachment'
else
render text: I18n.t('errors.messages.export_not_found'), status: :not_found
end
end

def status
Expand Down
15 changes: 8 additions & 7 deletions app/controllers/api/statistics_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,20 @@ def #{path}
statistic_type = request.query_parameters.delete('stat-type')
start_date = request.query_parameters.delete('start-date')
end_date = request.query_parameters.delete('end-date')
puts start_date, end_date
# run main query in elasticSearch
query = MultiJson.load(request.body.read)
results = Stats::#{path.classify}.search(query, request.query_parameters.symbolize_keys).response
# run additional custom aggregations, if any
stat_index = StatisticIndex.find_by_es_type_key("#{path}")
stat_type = StatisticType.where(statistic_index_id: stat_index.id, key: statistic_type).first
client = Elasticsearch::Model.client
stat_type.statistic_custom_aggregations.each do |custom|
c_res = client.search index: custom.es_index, type:custom.es_type, body:sprintf(custom.query, {aggs_name: custom.field, start_date: start_date, end_date: end_date})
results['aggregations'][custom.field] = c_res['aggregations'][custom.field]
if statistic_type and start_date and end_date
stat_index = StatisticIndex.find_by_es_type_key("#{path}")
stat_type = StatisticType.where(statistic_index_id: stat_index.id, key: statistic_type).first
client = Elasticsearch::Model.client
stat_type.statistic_custom_aggregations.each do |custom|
c_res = client.search index: custom.es_index, type:custom.es_type, body:sprintf(custom.query, {aggs_name: custom.field, start_date: start_date, end_date: end_date})
results['aggregations'][custom.field] = c_res['aggregations'][custom.field]
end
end
# return result
Expand Down
2 changes: 2 additions & 0 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ def event_recurrence
availability: Availability.new(start_at: start_at, end_at: end_at, available_type: 'event'),
availability_id: nil,
category_id: category_id,
age_range_id: age_range_id,
event_themes: event_themes,
amount: amount,
event_price_categories: event_price_cats,
nb_total_places: nb_total_places,
Expand Down
89 changes: 53 additions & 36 deletions app/views/exports/users_members.xlsx.axlsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,51 +7,68 @@ wb.add_worksheet(name: t('export_members.members')) do |sheet|

## data table
# heading labels
columns = [t('export_members.id'), t('export_members.surname'), t('export_members.first_name'), t('export_members.email'),
t('export_members.newsletter'), t('export_members.gender'), t('export_members.age'), t('export_members.address'), t('export_members.phone'),
t('export_members.website'), t('export_members.job'), t('export_members.interests'),
t('export_members.cad_software_mastered'), t('export_members.group'), t('export_members.subscription'),
t('export_members.subscription_end_date'), t('export_members.validated_trainings'), t('export_members.tags'),
t('export_members.number_of_invoices'), t('export_members.projects'), t('export_members.facebook'),
t('export_members.twitter'), t('export_members.echo_sciences'),
t('export_members.organization'), t('export_members.organization_address')]
columns = [t('export_members.id'),
t('export_members.surname'),
t('export_members.first_name'),
t('export_members.email'),
t('export_members.newsletter'),
t('export_members.gender'),
t('export_members.age'),
t('export_members.address'),
t('export_members.phone'),
t('export_members.website'),
t('export_members.job'),
t('export_members.interests'),
t('export_members.cad_software_mastered'),
t('export_members.group'),
t('export_members.subscription'),
t('export_members.subscription_end_date'),
t('export_members.validated_trainings'),
t('export_members.tags'),
t('export_members.number_of_invoices'),
t('export_members.invoicing_disabled'),
t('export_members.projects'),
t('export_members.facebook'),
t('export_members.twitter'),
t('export_members.echo_sciences'),
t('export_members.organization'),
t('export_members.organization_address')]
sheet.add_row columns, :style => header

# data rows
@members.each do |member|
data = [
member.id, member.profile.last_name, member.profile.first_name,
member.email, member.is_allow_newsletter, member.profile.gender ? t('export_members.man') : t('export_members.woman'), member.profile.age,
member.profile.address ? member.profile.address.address : '', member.profile.phone, member.profile.website,
member.profile.job, member.profile.interest, member.profile.software_mastered, member.group.name,
member.id,
member.profile.last_name,
member.profile.first_name,
member.email,
member.is_allow_newsletter,
member.profile.gender ? t('export_members.man') : t('export_members.woman'),
member.profile.age,
member.profile.address ? member.profile.address.address : '',
member.profile.phone,
member.profile.website,
member.profile.job,
member.profile.interest,
member.profile.software_mastered,
member.group.name,
(member.subscription and member.subscription.expired_at > Time.now) ? member.subscription.plan.name : t('export_members.without_subscriptions'),
(member.subscription and member.subscription.expired_at > Time.now) ? member.subscription.expired_at.to_date : nil,
member.trainings.map(&:name).join("\n"), member.tags.map(&:name).join("\n"), member.invoices.size,
member.projects.map(&:name).join("\n"), member.profile.facebook || '', member.profile.twitter || '',
member.trainings.map(&:name).join("\n"),
member.tags.map(&:name).join("\n"),
member.invoices.size,
member.invoicing_disabled,
member.projects.map(&:name).join("\n"),
member.profile.facebook || '',
member.profile.twitter || '',
member.profile.echosciences || '',
member.profile.organization ? member.profile.organization.name : '', member.profile.organization ? member.profile.organization.address.address : ''
member.profile.organization ? member.profile.organization.name : '',
member.profile.organization ? member.profile.organization.address.address : ''
]
styles = [nil, nil, nil,
nil, nil, nil, nil,
nil, nil, nil,
nil, nil, nil, nil,
nil,
date,
nil, nil, nil,
nil, nil, nil,
nil,
nil, nil
]
types = [:integer, :string, :string,
:string, :boolean, :string, :integer,
:string, :string, :string,
:string, :string, :string, :string,
:string,
:date,
:string, :string, :integer,
:string, :string, :string,
:string,
:string, :string]
styles = [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, date, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil]

types = [:integer, :string, :string, :string, :boolean, :string, :integer, :string, :string, :string, :string, :string,
:string, :string, :string, :date, :string, :string, :integer, :boolean, :string, :string, :string, :string, :string, :string]

sheet.add_row data, :style => styles, :types => types
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/exports/users_reservations.xlsx.axlsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ wb.add_worksheet(name: t('export_reservations.reservations')) do |sheet|
resrv.created_at.to_date,
resrv.reservable_type,
(resrv.reservable.nil? ? '' : resrv.reservable.name),
resrv.slots.count,
(resrv.reservable_type == 'Event') ? resrv.total_booked_seats: resrv.slots.count,
(resrv.stp_invoice_id.nil?)? t('export_reservations.local_payment') : t('export_reservations.online_payment')
]
styles = [nil, nil, nil, date, nil, nil, nil, nil]
Expand Down
4 changes: 2 additions & 2 deletions config/application.yml.default
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ DEFAULT_HOST: fab-manager.com
DEFAULT_PROTOCOL: https
DELIVERY_METHOD: smtp
SMTP_ADDRESS:
SMTP_PORT: 587
SMTP_PORT: '587'
SMTP_USER_NAME:
SMTP_PASSWORD:
GA_ID: ''
Expand Down Expand Up @@ -61,4 +61,4 @@ ALLOWED_EXTENSIONS: pdf ai eps cad math svg stl dxf dwg obj step iges igs 3dm 3d
ALLOWED_MIME_TYPES: application/pdf application/postscript application/illustrator image/x-eps image/svg+xml application/sla application/dxf application/acad application/dwg application/octet-stream application/step application/iges model/iges x-world/x-3dmf application/ application/vnd.openxmlformats-officedocument.wordprocessingml.document image/png text/x-arduino text/plain application/scad application/vnd.sketchup.skp application/x-koan application/vnd-koan koan/x-skm application/vnd.koan application/x-tex application/x-latex

# 10485760 = 10 megabytes
MAX_IMAGE_SIZE: 10485760
MAX_IMAGE_SIZE: '10485760'
2 changes: 1 addition & 1 deletion config/locales/app.admin.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ en:

event_reservations:
# event reservations list
reservations: "Reservations :"
the_reservations: "Reservations :"
payment_date: "Payment date"
reserved_tickets: "Reserved tickets"
show_the_event: "Show the event"
Expand Down
2 changes: 1 addition & 1 deletion config/locales/app.admin.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ fr:

event_reservations:
# liste des réservations sur un évènement
reservations: "Les réservations :"
the_reservations: "Les réservations :"
payment_date: "Date de paiement"
reserved_tickets: "Places réservées"
show_the_event: "Afficher l'évènement"
Expand Down
2 changes: 2 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ en:
wrong_size: "is the wrong size (should be %{file_size})"
size_too_small: "is too small (should be at least %{file_size})"
size_too_big: "is too big (should be at most %{file_size})"
export_not_found: "Requested export was not found. It was probably deleted, please generate a new export."

activemodel:
errors:
Expand Down Expand Up @@ -137,6 +138,7 @@ en:
validated_trainings: "Validated trainings"
tags: "Tags"
number_of_invoices: "Number of invoices"
invoicing_disabled: "Invoicing disabled"
projects: "Projects"
facebook: "Facebook"
twitter: "Twitter"
Expand Down
2 changes: 2 additions & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ fr:
wrong_size: "ne fait pas la taille du fichier (doit comporter %{file_size})"
size_too_small: "est trop petite (au moins %{file_size})"
size_too_big: "est trop grande (pas plus de %{file_size})"
export_not_found: "L'export demandé n'a pas été trouvé. Il a probablement été supprimé, veuillez lancer la génération d'un nouvel export."

activemodel:
errors:
Expand Down Expand Up @@ -137,6 +138,7 @@ fr:
validated_trainings: "Formations validées"
tags: "Étiquettes"
number_of_invoices: "Nombre de factures"
invoicing_disabled: "Facturation désactivée"
projects: "Projets"
facebook: "Facebook"
twitter: "Twitter"
Expand Down

0 comments on commit e365034

Please sign in to comment.