Skip to content

Commit b730a04

Browse files
authored
fix(long_absence_summary): Add suport of long absence declaration in mobile app declaration list (#1417)
1 parent 30f9d68 commit b730a04

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

yaki_backend/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ To create a new declaration, send a POST request to the /declarations endpoint w
117117

118118
- declaration_team_mate_id: The ID of the teammate making the declaration.
119119

120-
- declaration_status: The status of the declaration (Remote, On site, Vacation, Other).
120+
- declaration_status: The status of the declaration (Remote, On site, Absence).
121121

122122
#### Response:
123123

yaki_backend/src/features/declaration/declaration.repository.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export class DeclarationRepository {
122122

123123
/**
124124
* Get the latest declaration for a team mate
125-
* Select current day declaration, OR declaration ending after the current day (vacation or "other" situation)
125+
* Select current day declaration, OR declaration ending after the current day (absence situation)
126126
* @param {number} teammateId - number
127127
* @returns An array of Declaration objects.
128128
*/
@@ -145,12 +145,8 @@ export class DeclarationRepository {
145145
OR (
146146
declaration_date_start::date <= now()::date
147147
AND declaration_date_end::date > now()::date
148-
AND (
149-
declaration_status = 'vacation'
150-
OR
151-
declaration_status = 'other'
152-
)
153-
)
148+
AND declaration_status = 'absence'
149+
)
154150
ORDER BY declaration_date DESC LIMIT 10`,
155151
[teammateId]
156152
);

yaki_backend/src/features/declaration/declaration.service.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export class DeclarationService {
180180
const dayEnd = declarationList[0].declarationDateEnd.toDateString();
181181

182182
// check for same day declaration
183-
// if not can be vacation or "other" that could requier for more than on day.
183+
// if not can be absence that could requier for more than on day.
184184
if (dayStart == dayEnd) {
185185
// check if first declaration for the day is daily declaration.
186186
// if not necessary halfDay declaration.
@@ -200,8 +200,9 @@ export class DeclarationService {
200200
throw new TypeError("Missing a half day declaration");
201201
}
202202
}
203-
} // can add else to retreive vacations or other having longer duration than just a day
204-
203+
} else {
204+
listToReturn.push(declarationList[0]);
205+
}
205206
return listToReturn;
206207
};
207208
}

yaki_mobile/lib/presentation/features/teams_declarations_summary/view/teammates_list_async.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import 'package:yaki/presentation/features/shared/something_went_wrong.dart';
1111
import 'package:yaki/presentation/features/teams_declarations_summary/view/cell_card.dart';
1212
import 'package:yaki/presentation/state/providers/teammate_future_provider.dart';
1313
import 'package:yaki/presentation/styles/text_style.dart';
14+
import 'package:yaki_ui/yaki_ui.dart';
1415

1516
class TeammateListAsync extends ConsumerWidget {
1617
const TeammateListAsync({super.key});
@@ -33,6 +34,7 @@ class TeammateListAsync extends ConsumerWidget {
3334
},
3435
),
3536
child: RefreshIndicator(
37+
color: kPrimaryColor,
3638
onRefresh: () async {
3739
groupedUsersWithDeclaration =
3840
await ref.refresh(teammateFutureProvider);

0 commit comments

Comments
 (0)