Skip to content

Instantly share code, notes, and snippets.

@rikuTanide
Created October 14, 2017 13:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rikuTanide/2dbc91996bc07829fe8b2b8e77aa595f to your computer and use it in GitHub Desktop.
Save rikuTanide/2dbc91996bc07829fe8b2b8e77aa595f to your computer and use it in GitHub Desktop.
正規化していない
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