1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-12 06:54:19 +01:00

(feat) feature the first event

This commit is contained in:
Sylvain 2022-06-14 17:50:04 +02:00
parent 103bf80e81
commit 61080a5188
4 changed files with 13 additions and 8 deletions

View File

@ -1,3 +1,3 @@
#web: bundle exec rails server puma -p $PORT web: bundle exec rails server puma -p $PORT
worker: bundle exec sidekiq -C ./config/sidekiq.yml worker: bundle exec sidekiq -C ./config/sidekiq.yml
webpack: bin/webpacker-dev-server webpack: bin/webpacker-dev-server

View File

@ -72,6 +72,7 @@ Application.Controllers.controller('EventsController', ['$scope', '$state', 'Eve
// reinitialize results datasets // reinitialize results datasets
$scope.page = 1; $scope.page = 1;
$scope.eventsGroupByMonth = {}; $scope.eventsGroupByMonth = {};
$scope.featuredEevent = null;
$scope.events = []; $scope.events = [];
$scope.monthOrder = []; $scope.monthOrder = [];
$scope.noMoreResults = false; $scope.noMoreResults = false;
@ -111,13 +112,14 @@ Application.Controllers.controller('EventsController', ['$scope', '$state', 'Eve
*/ */
const groupEvents = function (events) { const groupEvents = function (events) {
if (events.length > 0) { if (events.length > 0) {
const eventsGroupedByMonth = _.groupBy(events, function (obj) { const eventsGroupedByMonth = _.groupBy(events.slice(1), function (obj) {
return _.map(['month_id', 'year'], function (key) { return _.map(['month_id', 'year'], function (key) {
return obj[key]; return obj[key];
}); });
}); });
$scope.eventsGroupByMonth = Object.assign($scope.eventsGroupByMonth, eventsGroupedByMonth); $scope.eventsGroupByMonth = Object.assign($scope.eventsGroupByMonth, eventsGroupedByMonth);
return $scope.monthOrder = Object.keys($scope.eventsGroupByMonth); $scope.monthOrder = Object.keys($scope.eventsGroupByMonth);
$scope.featuredEevent = events[0];
} }
}; };

View File

@ -40,9 +40,12 @@
</div> </div>
</div> </div>
<div class="event-focus"> <div class="event-focus" ng-if="featuredEevent">
<!-- TODO: get focus event --> <event-card style="display: contents"
<!--<event-card style="display: contents" event="" card-type="'lg'" />--> event="featuredEevent"
card-type="'lg'"
ui-sref="app.public.events_show({id: featuredEevent.id})">
</event-card>
</div> </div>
<div ng-repeat="month in monthOrder"> <div ng-repeat="month in monthOrder">

View File

@ -37,8 +37,8 @@ class EventService
start_at = DateTime.new(start_date.year, start_date.month, start_date.day, 0, 0, 0, start_date.zone) start_at = DateTime.new(start_date.year, start_date.month, start_date.day, 0, 0, 0, start_date.zone)
end_at = DateTime.new(end_date.year, end_date.month, end_date.day, 23, 59, 59, end_date.zone) end_at = DateTime.new(end_date.year, end_date.month, end_date.day, 23, 59, 59, end_date.zone)
else else
start_at = DateTime.new(start_date.year, start_date.month, start_date.day, start_time.hour, start_time.min, start_time.sec, start_date.zone) start_at = DateTime.new(start_date.year, start_date.month, start_date.day, start_time&.hour, start_time&.min, start_time&.sec, start_date.zone)
end_at = DateTime.new(end_date.year, end_date.month, end_date.day, end_time.hour, end_time.min, end_time.sec, end_date.zone) end_at = DateTime.new(end_date.year, end_date.month, end_date.day, end_time&.hour, end_time&.min, end_time&.sec, end_date.zone)
end end
{ start_at: start_at, end_at: end_at } { start_at: start_at, end_at: end_at }
end end