Skip to content

Commit

Permalink
Remove courseId parameter HomeworkDialogApi.loadCloudFiles.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonas-Sander committed Oct 12, 2023
1 parent 00ab30d commit f4d263f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
9 changes: 4 additions & 5 deletions app/lib/blocs/homework/homework_dialog_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,7 @@ class HomeworkDialogBloc extends BlocBase {

Future<void> _loadInitialCloudFiles(
String courseID, String homeworkID) async {
final cloudFiles =
await api.loadCloudFiles(courseId: courseID, homeworkId: homeworkID);
final cloudFiles = await api.loadCloudFiles(homeworkId: homeworkID);
_cloudFilesSubject.sink.add(cloudFiles);
initialCloudFiles.addAll(cloudFiles);
}
Expand Down Expand Up @@ -385,10 +384,10 @@ class HomeworkDialogApi {
return _api.homework.singleHomework(homeworkId.id, source: Source.cache);
}

Future<List<CloudFile>> loadCloudFiles(
{required String courseId, required String homeworkId}) {
Future<List<CloudFile>> loadCloudFiles({required String homeworkId}) async {
final homework = await _api.homework.singleHomeworkStream(homeworkId).first;
return _api.fileSharing.cloudFilesGateway
.filesStreamAttachment(courseId, homeworkId)
.filesStreamAttachment(homework.courseID, homeworkId)
.first;
}

Expand Down
1 change: 0 additions & 1 deletion app/lib/blocs/homework/new_homework_dialog_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@ class NewHomeworkDialogBloc
Future<void> _loadExistingData(HomeworkId homeworkId) async {
_initialHomework = await api.loadHomework(homeworkId);
_initialAttachments = await api.loadCloudFiles(
courseId: _initialHomework.courseID,
homeworkId: _initialHomework.id,
);
add(_LoadedHomeworkData());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,12 @@ class _EditIcon extends StatelessWidget {
final successful = await Navigator.push<bool>(
context,
MaterialPageRoute(
builder: (context) => NewHomeworkDialog(
builder: (context) => HomeworkDialog(
id: homework?.id != null ? HomeworkId(homework!.id) : null,
),
// builder: (context) => NewHomeworkDialog(
// id: homework?.id != null ? HomeworkId(homework!.id) : null,
// ),
settings: const RouteSettings(name: HomeworkDialog.tag),
),
);
Expand Down
3 changes: 1 addition & 2 deletions app/test/homework/homework_dialog_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ class MockHomeworkDialogApi implements HomeworkDialogApi {
final loadCloudFilesResult = <CloudFile>[];

@override
Future<List<CloudFile>> loadCloudFiles(
{required String courseId, required String homeworkId}) async {
Future<List<CloudFile>> loadCloudFiles({required String homeworkId}) async {
return loadCloudFilesResult;
}

Expand Down

0 comments on commit f4d263f

Please sign in to comment.