Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions yaki_backend/src/db/create_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ ALTER SEQUENCE public.entity_log_id_seq
-- CREATE TABLE FOR LOGS
CREATE TABLE IF NOT EXISTS public.entity_log(
entity_log_id integer NOT NULL DEFAULT nextval('entity_log_id_seq'::regclass),
entity_log_creation_date timestamp with time zone,
entity_log_inactivation_date timestamp with time zone,
entity_log_creation_date timestamp without time zone,
entity_log_inactivation_date timestamp without time zone,
CONSTRAINT "ENTITY_LOG_pkey" PRIMARY KEY (entity_log_id)
)
TABLESPACE pg_default;
Expand Down Expand Up @@ -314,9 +314,9 @@ CREATE TABLE IF NOT EXISTS public.declaration
(
declaration_id integer NOT NULL DEFAULT nextval('declaration_id_seq'::regclass),
declaration_user_id integer NOT NULL,
declaration_date timestamp with time zone,
declaration_date_start timestamp with time zone,
declaration_date_end timestamp with time zone,
declaration_date timestamp without time zone,
declaration_date_start timestamp without time zone,
declaration_date_end timestamp without time zone,
declaration_status character varying(30),
declaration_team_id integer NOT NULL,
declaration_is_latest boolean NOT NULL,
Expand Down
14 changes: 13 additions & 1 deletion yaki_mobile/assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,17 @@

"unavailable": "Unavailable",

"imageSize": "Picture size :"
"imageSize": "Picture size :",

"hour": {
"zero": "Just now",
"one": "Since {} hour",
"other": "Since {} hours ago"
},

"minute": {
"zero": "Just now",
"one": "Since {} minute",
"other": "Since {} minutes ago"
}
}
14 changes: 13 additions & 1 deletion yaki_mobile/assets/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,17 @@

"unavailable": "Non disponible",

"imageSize": "Taille de l'image :"
"imageSize": "Taille de l'image :",

"hour": {
"zero": "À l'instant",
"one": "Depuis {} heure",
"other": "Depuis {} heures"
},

"minute": {
"zero": "À l'instant",
"one": "Depuis {} minute",
"other": "Depuis {} minutes"
}
}
4 changes: 2 additions & 2 deletions yaki_mobile/lib/domain/entities/declaration_status.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class DeclarationStatus {
late HalfDayWorkflow halfDayWorkflow = HalfDayWorkflow();
late DeclarationsHalfDaySelections declarationsHalfDaySelections =
defaultHalfDay;
late DateTime? dateAbsenceStart = DateTime.now();
late DateTime? dateAbsenceEnd = DateTime.now();
late DateTime? dateAbsenceStart = DateTime.now().toUtc();
late DateTime? dateAbsenceEnd = DateTime.now().toUtc();

DeclarationStatus();

Expand Down
4 changes: 2 additions & 2 deletions yaki_mobile/lib/presentation/features/absence/absence.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class _AbsenceState extends ConsumerState<Absence> {
DatePickerCard(
title: tr('absenceStart'),
initialButtonLabel: tr('absenceDatePickerInitialLabel'),
earliestSelectableDate: DateTime.now(),
earliestSelectableDate: DateTime.now().toUtc(),
onDateSelection: (selectedDate) {
setState(() {
_selectedDateStart = selectedDate;
Expand All @@ -105,7 +105,7 @@ class _AbsenceState extends ConsumerState<Absence> {
DatePickerCard(
title: tr('absenceEnd'),
initialButtonLabel: tr('absenceDatePickerInitialLabel'),
earliestSelectableDate: DateTime.now(),
earliestSelectableDate: DateTime.now().toUtc(),
onDateSelection: (selectedDate) {
setState(() {
_selectedDateEnd = selectedDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AppBarWithDate extends ConsumerWidget implements PreferredSizeWidget {

@override
Widget build(BuildContext context, WidgetRef ref) {
final toDayDate = DateFormat('d MMMM y').format(DateTime.now());
final toDayDate = DateFormat('d MMMM y').format(DateTime.now().toUtc());
final currentRoute = ModalRoute.of(context)?.settings.name;
final showBackButton = currentRoute == 'team-selection';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:typed_data';

import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
Expand Down Expand Up @@ -86,18 +87,19 @@ bool isSubtitleDisplayed({
: true;

String timeSinceDeclaration(DateTime declarationDate) {
DateTime a = declarationDate;
DateTime b = DateTime.now();
DateTime declaration = declarationDate;
DateTime now = DateTime.now();

Duration difference = b.difference(a);
Duration difference = now.difference(declaration);

int hours = difference.inHours % 24;
int minutes = difference.inMinutes % 60;
int totalMinutes = difference.inMinutes;
int hours = totalMinutes ~/ 60;
int minutes = totalMinutes % 60;

if (hours > 0) {
return '$hours hours ago';
return 'hour'.plural(hours);
} else if (minutes > 0) {
return '$minutes minutes ago';
return 'minute'.plural(minutes);
} else {
return 'Just now';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ class UserDeclarationSummaryAbsence extends ConsumerWidget {
flex: 1,
child: Center(
child: SummaryAbsence(
dateStart:
declarationStatus.dateAbsenceStart ?? DateTime.now(),
dateEnd:
declarationStatus.dateAbsenceEnd ?? DateTime.now(),
dateStart: declarationStatus.dateAbsenceStart ??
DateTime.now().toUtc(),
dateEnd: declarationStatus.dateAbsenceEnd ??
DateTime.now().toUtc(),
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class DeclarationNotifier extends StateNotifier<DeclarationStatus> {
required int teamId,
required int userId,
}) async {
final todayDate = DateTime.now();
final todayDate = DateTime.now().toUtc();

// CREATE DECLARATION
DeclarationModel newDeclaration = DeclarationModel(
Expand Down Expand Up @@ -184,7 +184,7 @@ class DeclarationNotifier extends StateNotifier<DeclarationStatus> {
required int afternoonTeamId,
required int userId,
}) async {
final todayDate = DateTime.now();
final todayDate = DateTime.now().toUtc();
// FIRST DECLARATION
DeclarationModel newDeclarationMorning = DeclarationModel(
declarationUserId: userId,
Expand Down Expand Up @@ -230,7 +230,7 @@ class DeclarationNotifier extends StateNotifier<DeclarationStatus> {
required DateTime dateStart,
required DateTime dateEnd,
}) async {
final todayDate = DateTime.now();
final todayDate = DateTime.now().toUtc();

SharedPreferences prefs = await SharedPreferences.getInstance();
final int? userId = prefs.getInt("userId");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ class VacationStatusNotifier extends StateNotifier<StateVacationPage> {
/// set state declaration for the morning
void setStateVacation(DateTime? dateStart, DateTime? dateEnd) {
String dateStartString =
DateFormat.yMd('fr').format(dateStart ?? DateTime.now());
DateFormat.yMd('fr').format(dateStart ?? DateTime.now().toUtc());
String dateEndString =
DateFormat.yMd('fr').format(dateEnd ?? DateTime.now());
DateFormat.yMd('fr').format(dateEnd ?? DateTime.now().toUtc());
state = StateVacationPage(
image: 'assets/images/absent.svg',
dateStart: dateStartString,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ void main() {
{
"declarationId": 2,
"declarationUserId": 3,
"declarationDate": DateTime.now().toIso8601String(),
"declarationDateStart": DateTime.now().toIso8601String(),
"declarationDateEnd": DateTime.now().toIso8601String(),
"declarationDate": DateTime.now().toUtc().toIso8601String(),
"declarationDateStart": DateTime.now().toUtc().toIso8601String(),
"declarationDateEnd": DateTime.now().toUtc().toIso8601String(),
"declarationStatus": "REMOTE",
"declarationTeamId": 2,
},
Expand All @@ -28,18 +28,18 @@ void main() {
{
"declarationId": 2,
"declarationUserId": 3,
"declarationDate": DateTime.now().toIso8601String(),
"declarationDateStart": DateTime.now().toIso8601String(),
"declarationDateEnd": DateTime.now().toIso8601String(),
"declarationDate": DateTime.now().toUtc().toIso8601String(),
"declarationDateStart": DateTime.now().toUtc().toIso8601String(),
"declarationDateEnd": DateTime.now().toUtc().toIso8601String(),
"declarationStatus": "REMOTE",
"declarationTeamId": 2,
},
{
"declarationId": 2,
"declarationUserId": 3,
"declarationDate": DateTime.now().toIso8601String(),
"declarationDateStart": DateTime.now().toIso8601String(),
"declarationDateEnd": DateTime.now().toIso8601String(),
"declarationDate": DateTime.now().toUtc().toIso8601String(),
"declarationDateStart": DateTime.now().toUtc().toIso8601String(),
"declarationDateEnd": DateTime.now().toUtc().toIso8601String(),
"declarationStatus": "OTHER",
"declarationTeamId": 2,
},
Expand Down Expand Up @@ -107,7 +107,7 @@ void main() {
() {
DeclarationModel createdDeclaration = DeclarationModel(
declarationUserId: 1,
declarationDate: DateTime.now(),
declarationDate: DateTime.now().toUtc(),
declarationDateStart: DateTime.parse('2023-03-20T00:00:00.000Z'),
declarationDateEnd: DateTime.parse('2023-03-20T23:59:59.950Z'),
declarationStatus: "REMOTE",
Expand Down