Skip to content

Commit

Permalink
Issue#980
Browse files Browse the repository at this point in the history
  • Loading branch information
Thuyhaile committed Dec 4, 2023
1 parent eaa64d0 commit ac4c105
Show file tree
Hide file tree
Showing 3 changed files with 222 additions and 149 deletions.
18 changes: 18 additions & 0 deletions lib/blocs/weekplan_selector_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,24 @@ class WeekplansBloc extends BlocBase {
_api.week.getNames(_user.id!).listen(_weekNameModelsList.add);
}

/// List stores weekModels
final List<WeekModel> currentData = <WeekModel>[];

/// Method handles adding weekModels to _weekModel stream
void addWeekModels(List<WeekModel> weekModel) {
currentData.addAll(weekModel);
_weekModel.add(currentData);
}

/// List stores old weekModels
final List<WeekModel> oldCurrentData = <WeekModel>[];

/// Method handles adding weekModels to _oldWeekModel stream
void addOldWeekModels(List<WeekModel> weekModel) {
oldCurrentData.addAll(weekModel);
_oldWeekModel.add(oldCurrentData);
}

/// Gets all the information for a [Weekmodel].
/// [weekPlanNames] parameter contains all the information
/// needed for getting all [WeekModel]'s.
Expand Down
2 changes: 1 addition & 1 deletion test/blocs/edit_weekplan_bloc_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void main() {

when(() => api.week.getNames(any())).thenAnswer(
(_) {
return Stream<List<WeekNameModel>?>.value(<WeekNameModel>[
return Stream<List<WeekNameModel>>.value(<WeekNameModel>[
WeekNameModel(
name: mockWeek.name,
weekNumber: mockWeek.weekNumber,
Expand Down
Loading

0 comments on commit ac4c105

Please sign in to comment.