Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
正規化していない
class Video {
String videoID;
List<String> playedUsers;
}
class User {
String userID;
List<String> playedVideos;
}
List<Video> videos = [];
List<User> users = [];
// ユーザーが閲覧したvideoインスタンスの視聴ユーザーリストにユーザーを追加
void play(String userID, String videoID) {
for (var video in videos) {
if (video.videoID != videoID) {
continue;
}
video.playedUsers.add(userID);
return;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.