正規化していない
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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