1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-30 19:52:20 +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
webpack: bin/webpacker-dev-server

View File

@ -72,6 +72,7 @@ Application.Controllers.controller('EventsController', ['$scope', '$state', 'Eve
// reinitialize results datasets
$scope.page = 1;
$scope.eventsGroupByMonth = {};
$scope.featuredEevent = null;
$scope.events = [];
$scope.monthOrder = [];
$scope.noMoreResults = false;
@ -111,13 +112,14 @@ Application.Controllers.controller('EventsController', ['$scope', '$state', 'Eve
*/
const groupEvents = function (events) {
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 obj[key];
});
});
$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 class="event-focus">
<!-- TODO: get focus event -->
<!--<event-card style="display: contents" event="" card-type="'lg'" />-->
<div class="event-focus" ng-if="featuredEevent">
<event-card style="display: contents"
event="featuredEevent"
card-type="'lg'"
ui-sref="app.public.events_show({id: featuredEevent.id})">
</event-card>
</div>
<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)
end_at = DateTime.new(end_date.year, end_date.month, end_date.day, 23, 59, 59, end_date.zone)
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)
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)
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
{ start_at: start_at, end_at: end_at }
end