Skip to content

controller: remove stories suffix. #118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
16 changes: 10 additions & 6 deletions controller/lib/data/stories.dart
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
import 'package:flutter/foundation.dart';
import 'package:monarch_definitions/monarch_definitions.dart';

final storiesSuffix = RegExp(r'_stories$');

class StoryGroup {
final String groupName;
final String _groupName;
final List<StoryId> stories;
final String groupKey;

String get groupName => _groupName.replaceFirst(storiesSuffix, '');

StoryGroup({
required this.groupName,
required String groupName,
required this.stories,
required this.groupKey,
});
}) : _groupName = groupName;

@override
bool operator ==(Object other) =>
identical(this, other) ||
other is StoryGroup &&
groupName == other.groupName &&
_groupName == other._groupName &&
listEquals(stories, other.stories);

@override
int get hashCode => groupName.hashCode ^ stories.hashCode;
int get hashCode => _groupName.hashCode ^ stories.hashCode;

StoryGroup copyWith({List<StoryId>? stories}) {
return StoryGroup(
groupName: groupName,
groupName: _groupName,
stories: stories ?? this.stories,
groupKey: groupKey,
);
Expand Down