Skip to content

Commit

Permalink
Merge branch 'main' into new-events-dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas-Sander authored Feb 5, 2024
2 parents 84ba582 + 13a4718 commit fcc2207
Show file tree
Hide file tree
Showing 22 changed files with 34 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/actions_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
changesFound: ${{ steps.filter.outputs.changesFound }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: AurorNZ/paths-filter@7c547bdd24124b0d69e07c96b62fd7fec5ced19a
- uses: AurorNZ/paths-filter@3b1f3abc3371cca888d8eb03dfa70bc8a9867629
id: filter
with:
filters: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cli_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
changesFound: ${{ steps.filter.outputs.changesFound }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: AurorNZ/paths-filter@7c547bdd24124b0d69e07c96b62fd7fec5ced19a
- uses: AurorNZ/paths-filter@3b1f3abc3371cca888d8eb03dfa70bc8a9867629
id: filter
with:
filters: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration_tests_app_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
changesFound: ${{ steps.filter.outputs.changesFound }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: AurorNZ/paths-filter@7c547bdd24124b0d69e07c96b62fd7fec5ced19a
- uses: AurorNZ/paths-filter@3b1f3abc3371cca888d8eb03dfa70bc8a9867629
id: filter
with:
filters: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/safe_app_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
changesFound: ${{ steps.filter.outputs.changesFound }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: AurorNZ/paths-filter@7c547bdd24124b0d69e07c96b62fd7fec5ced19a
- uses: AurorNZ/paths-filter@3b1f3abc3371cca888d8eb03dfa70bc8a9867629
id: filter
with:
filters: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/safe_website_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
changesFound: ${{ steps.filter.outputs.changesFound }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: AurorNZ/paths-filter@7c547bdd24124b0d69e07c96b62fd7fec5ced19a
- uses: AurorNZ/paths-filter@3b1f3abc3371cca888d8eb03dfa70bc8a9867629
id: filter
with:
filters: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/unsafe_app_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
pull-requests: write
steps:
- name: Remove "safe to test" label, if PR is from a fork
uses: SharezoneApp/remove-safe-to-test-label@228977e0ec39c61eef543d130927065940d56907
uses: SharezoneApp/remove-safe-to-test-label@91b378205db41bb08dde8e4c4f2685847eb3d168

# We can't use the official "paths" filter because it has no support for merge
# groups and we would need some kind of fallback CI when a check is required
Expand All @@ -83,7 +83,7 @@ jobs:
# Because we are using the "pull_request_target" event, we need to
# checkout the PR head commit instead of the merge commit.
ref: ${{ github.event.pull_request.head.sha }}
- uses: AurorNZ/paths-filter@7c547bdd24124b0d69e07c96b62fd7fec5ced19a
- uses: AurorNZ/paths-filter@3b1f3abc3371cca888d8eb03dfa70bc8a9867629
id: filter
with:
filters: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/unsafe_website_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
pull-requests: write
steps:
- name: Remove "safe to test" label, if PR is from a fork
uses: SharezoneApp/remove-safe-to-test-label@228977e0ec39c61eef543d130927065940d56907
uses: SharezoneApp/remove-safe-to-test-label@91b378205db41bb08dde8e4c4f2685847eb3d168

# We can't use the official "paths" filter because it has no support for merge
# groups and we would need some kind of fallback CI when a check is required
Expand All @@ -83,7 +83,7 @@ jobs:
# Because we are using the "pull_request_target" event, we need to
# checkout the PR head commit instead of the merge commit.
ref: ${{ github.event.pull_request.head.sha }}
- uses: AurorNZ/paths-filter@7c547bdd24124b0d69e07c96b62fd7fec5ced19a
- uses: AurorNZ/paths-filter@3b1f3abc3371cca888d8eb03dfa70bc8a9867629
id: filter
with:
filters: |
Expand Down
5 changes: 4 additions & 1 deletion app/lib/homework/homework_dialog/homework_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,10 @@ class _SubmissionsSwitchBase extends StatelessWidget {
},
trailing: Padding(
padding: const EdgeInsets.only(right: 8),
child: Text(time.toString()),
child: Text(
time.toString(),
style: const TextStyle(fontSize: 14),
),
),
)
: Container(),
Expand Down
3 changes: 3 additions & 0 deletions app/lib/timetable/src/bloc/timetable_selection_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ class TimetableSelectionBloc extends BlocBase {
Course course,
) {
final lesson = Lesson(
// The 'createdOn' field will be added in the gateway because we use
// serverTimestamp().
createdOn: null,
weekday: emptyPeriodSelection.date.weekDayEnum,
weektype: emptyPeriodSelection.weekType,
startTime: emptyPeriodSelection.period.startTime,
Expand Down
12 changes: 12 additions & 0 deletions app/lib/timetable/src/models/lesson.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//
// SPDX-License-Identifier: EUPL-1.2

import 'package:cloud_firestore_helper/cloud_firestore_helper.dart';
import 'package:date/date.dart';
import 'package:date/weekday.dart';
import 'package:date/weektype.dart';
Expand All @@ -14,6 +15,13 @@ import 'package:sharezone/timetable/src/models/lesson_length/lesson_length.dart'
import 'package:time/time.dart';

class Lesson {
/// The date and time when the event was created.
///
/// Clients with a lower version than 1.7.9 will not have this field.
/// Therefore, we will always have events without a [createdOn] field in the
/// database.
final DateTime? createdOn;

final String? lessonID;
final String groupID;
final GroupType groupType;
Expand All @@ -26,6 +34,7 @@ class Lesson {
LessonLength get length => calculateLessonLength(startTime, endTime);

Lesson({
required this.createdOn,
required this.lessonID,
required this.groupID,
required this.groupType,
Expand All @@ -42,6 +51,7 @@ class Lesson {

factory Lesson.fromData(Map<String, dynamic> data, {required String id}) {
return Lesson(
createdOn: dateTimeFromTimestampOrNull(data['createdOn']),
lessonID: id,
groupID: data['groupID'] as String,
groupType: GroupType.values.byName(data['groupType'] as String),
Expand Down Expand Up @@ -74,6 +84,7 @@ class Lesson {
}

Lesson copyWith({
DateTime? createdOn,
String? lessonID,
String? groupID,
GroupType? groupType,
Expand All @@ -88,6 +99,7 @@ class Lesson {
String? place,
}) {
return Lesson(
createdOn: createdOn ?? this.createdOn,
groupType: groupType ?? this.groupType,
lessonID: lessonID ?? this.lessonID,
groupID: groupID ?? this.groupID,
Expand Down
3 changes: 3 additions & 0 deletions app/lib/timetable/timetable_add/bloc/timetable_add_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ class TimetableAddBloc extends BlocBase {
log("isValid: true; ${course.toString()}; $startTime; $endTime; $room $weekDay $period");

final lesson = Lesson(
// The 'createdOn' field will be added in the gateway because we use
// serverTimestamp().
createdOn: null,
groupID: course.id,
groupType: GroupType.course,
startDate: null,
Expand Down
1 change: 1 addition & 0 deletions app/lib/util/api/timetable_gateway.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class TimetableGateway {
String lessonID = references.lessons.doc().id;
Map<String, dynamic> data = lesson.copyWith(lessonID: lessonID).toJson();
data['users'] = [memberID];
data['createdOn'] = FieldValue.serverTimestamp();
return references.lessons
.doc(lessonID)
.set(data, SetOptions(merge: true))
Expand Down
1 change: 1 addition & 0 deletions app/test/dashboard/current_lesson_index_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ void main() {
abbreviation: "D",
design: Design.standard(),
lesson: Lesson(
createdOn: DateTime(2024, 1, 1),
lessonID: "1",
groupID: "1",
groupType: GroupType.course,
Expand Down
1 change: 1 addition & 0 deletions app/test/timetable/timetable_bloc_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ void main() {

Lesson createLesson(String groupId) {
return Lesson(
createdOn: DateTime(2024, 1, 1),
startTime: Time(hour: 9, minute: 0),
endTime: Time(hour: 10, minute: 0),
groupID: groupId,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fcc2207

Please sign in to comment.