1
0
mirror of synced 2024-09-23 19:08:21 +02:00

Skip scheduled work for games when music DB for that game was not imported.

This commit is contained in:
Jennifer Taylor 2021-09-06 19:06:34 +00:00
parent 6d258f1027
commit c27bac1cf5
13 changed files with 316 additions and 302 deletions

View File

@ -99,27 +99,28 @@ class IIDXCannonBallers(IIDXCourse, IIDXBase):
# Generate a new list of three dailies.
start_time, end_time = data.local.network.get_schedule_duration('daily')
all_songs = list(set([song.id for song in data.local.music.get_all_songs(cls.game, cls.version)]))
daily_songs = random.sample(all_songs, 3)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'dailies',
{
'start_time': start_time,
'end_time': end_time,
'music': daily_songs,
},
)
events.append((
'iidx_daily_charts',
{
'version': cls.version,
'music': daily_songs,
},
))
if len(all_songs) >= 3:
daily_songs = random.sample(all_songs, 3)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'dailies',
{
'start_time': start_time,
'end_time': end_time,
'music': daily_songs,
},
)
events.append((
'iidx_daily_charts',
{
'version': cls.version,
'music': daily_songs,
},
))
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'daily_charts', 'daily')
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'daily_charts', 'daily')
return events
@classmethod

View File

@ -99,27 +99,28 @@ class IIDXCopula(IIDXCourse, IIDXBase):
# Generate a new list of three dailies.
start_time, end_time = data.local.network.get_schedule_duration('daily')
all_songs = list(set([song.id for song in data.local.music.get_all_songs(cls.game, cls.version)]))
daily_songs = random.sample(all_songs, 3)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'dailies',
{
'start_time': start_time,
'end_time': end_time,
'music': daily_songs,
},
)
events.append((
'iidx_daily_charts',
{
'version': cls.version,
'music': daily_songs,
},
))
if len(all_songs) >= 3:
daily_songs = random.sample(all_songs, 3)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'dailies',
{
'start_time': start_time,
'end_time': end_time,
'music': daily_songs,
},
)
events.append((
'iidx_daily_charts',
{
'version': cls.version,
'music': daily_songs,
},
))
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'daily_charts', 'daily')
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'daily_charts', 'daily')
return events
@classmethod

View File

@ -96,27 +96,28 @@ class IIDXPendual(IIDXCourse, IIDXBase):
# Generate a new list of three dailies.
start_time, end_time = data.local.network.get_schedule_duration('daily')
all_songs = list(set([song.id for song in data.local.music.get_all_songs(cls.game, cls.version)]))
daily_songs = random.sample(all_songs, 3)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'dailies',
{
'start_time': start_time,
'end_time': end_time,
'music': daily_songs,
},
)
events.append((
'iidx_daily_charts',
{
'version': cls.version,
'music': daily_songs,
},
))
if len(all_songs) >= 3:
daily_songs = random.sample(all_songs, 3)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'dailies',
{
'start_time': start_time,
'end_time': end_time,
'music': daily_songs,
},
)
events.append((
'iidx_daily_charts',
{
'version': cls.version,
'music': daily_songs,
},
))
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'daily_charts', 'daily')
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'daily_charts', 'daily')
return events
@classmethod

View File

@ -99,27 +99,28 @@ class IIDXRootage(IIDXCourse, IIDXBase):
# Generate a new list of three dailies.
start_time, end_time = data.local.network.get_schedule_duration('daily')
all_songs = list(set([song.id for song in data.local.music.get_all_songs(cls.game, cls.version)]))
daily_songs = random.sample(all_songs, 3)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'dailies',
{
'start_time': start_time,
'end_time': end_time,
'music': daily_songs,
},
)
events.append((
'iidx_daily_charts',
{
'version': cls.version,
'music': daily_songs,
},
))
if len(all_songs) >= 3:
daily_songs = random.sample(all_songs, 3)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'dailies',
{
'start_time': start_time,
'end_time': end_time,
'music': daily_songs,
},
)
events.append((
'iidx_daily_charts',
{
'version': cls.version,
'music': daily_songs,
},
))
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'daily_charts', 'daily')
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'daily_charts', 'daily')
return events
@classmethod

View File

@ -99,27 +99,28 @@ class IIDXSinobuz(IIDXCourse, IIDXBase):
# Generate a new list of three dailies.
start_time, end_time = data.local.network.get_schedule_duration('daily')
all_songs = list(set([song.id for song in data.local.music.get_all_songs(cls.game, cls.version)]))
daily_songs = random.sample(all_songs, 3)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'dailies',
{
'start_time': start_time,
'end_time': end_time,
'music': daily_songs,
},
)
events.append((
'iidx_daily_charts',
{
'version': cls.version,
'music': daily_songs,
},
))
if len(all_songs) >= 3:
daily_songs = random.sample(all_songs, 3)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'dailies',
{
'start_time': start_time,
'end_time': end_time,
'music': daily_songs,
},
)
events.append((
'iidx_daily_charts',
{
'version': cls.version,
'music': daily_songs,
},
))
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'daily_charts', 'daily')
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'daily_charts', 'daily')
return events
@classmethod

View File

@ -95,27 +95,28 @@ class IIDXSpada(IIDXBase):
# Generate a new list of three dailies.
start_time, end_time = data.local.network.get_schedule_duration('daily')
all_songs = list(set([song.id for song in data.local.music.get_all_songs(cls.game, cls.version)]))
daily_songs = random.sample(all_songs, 3)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'dailies',
{
'start_time': start_time,
'end_time': end_time,
'music': daily_songs,
},
)
events.append((
'iidx_daily_charts',
{
'version': cls.version,
'music': daily_songs,
},
))
if len(all_songs) >= 3:
daily_songs = random.sample(all_songs, 3)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'dailies',
{
'start_time': start_time,
'end_time': end_time,
'music': daily_songs,
},
)
events.append((
'iidx_daily_charts',
{
'version': cls.version,
'music': daily_songs,
},
))
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'daily_charts', 'daily')
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'daily_charts', 'daily')
return events
@classmethod

View File

@ -94,27 +94,28 @@ class IIDXTricoro(IIDXBase):
# Generate a new list of three dailies.
start_time, end_time = data.local.network.get_schedule_duration('daily')
all_songs = list(set([song.id for song in data.local.music.get_all_songs(cls.game, cls.version)]))
daily_songs = random.sample(all_songs, 3)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'dailies',
{
'start_time': start_time,
'end_time': end_time,
'music': daily_songs,
},
)
events.append((
'iidx_daily_charts',
{
'version': cls.version,
'music': daily_songs,
},
))
if len(all_songs) >= 3:
daily_songs = random.sample(all_songs, 3)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'dailies',
{
'start_time': start_time,
'end_time': end_time,
'music': daily_songs,
},
)
events.append((
'iidx_daily_charts',
{
'version': cls.version,
'music': daily_songs,
},
))
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'daily_charts', 'daily')
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'daily_charts', 'daily')
return events
@classmethod

View File

@ -97,29 +97,30 @@ class JubeatClan(
# these song IDs, so we explicitly exclude them.
start_time, end_time = data.local.network.get_schedule_duration('daily')
all_songs = set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version) if song.id not in cls.FIVE_PLAYS_UNLOCK_EVENT_SONG_IDS)
daily_songs = random.sample(all_songs, 2)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'fc_challenge',
{
'start_time': start_time,
'end_time': end_time,
'today': daily_songs[0],
'whim': daily_songs[1],
},
)
events.append((
'jubeat_fc_challenge_charts',
{
'version': cls.version,
'today': daily_songs[0],
'whim': daily_songs[1],
},
))
if len(all_songs) >= 2:
daily_songs = random.sample(all_songs, 2)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'fc_challenge',
{
'start_time': start_time,
'end_time': end_time,
'today': daily_songs[0],
'whim': daily_songs[1],
},
)
events.append((
'jubeat_fc_challenge_charts',
{
'version': cls.version,
'today': daily_songs[0],
'whim': daily_songs[1],
},
))
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'fc_challenge', 'daily')
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'fc_challenge', 'daily')
return events
def __get_course_list(self) -> List[Dict[str, Any]]:

View File

@ -319,73 +319,75 @@ class JubeatProp(
# Generate a new league course list, save it to the DB.
start_time, end_time = data.local.network.get_schedule_duration('weekly')
all_songs = set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version))
league_songs = random.sample(all_songs, 3)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'league',
{
'start_time': start_time,
'end_time': end_time,
'music': league_songs,
},
)
events.append((
'jubeat_league_course',
{
'version': cls.version,
'songs': league_songs,
},
))
if len(all_songs) >= 3:
league_songs = random.sample(all_songs, 3)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'league',
{
'start_time': start_time,
'end_time': end_time,
'music': league_songs,
},
)
events.append((
'jubeat_league_course',
{
'version': cls.version,
'songs': league_songs,
},
))
# League ID for the current league we just added.
leagueid = int(start_time / 604800)
# League ID for the current league we just added.
leagueid = int(start_time / 604800)
# Evaluate player scores on previous courses and find players
# that didn't play last week.
all_profiles = data.local.user.get_all_profiles(cls.game, cls.version)
scores, absentees = cls._get_league_scores(data, leagueid, all_profiles)
# Evaluate player scores on previous courses and find players
# that didn't play last week.
all_profiles = data.local.user.get_all_profiles(cls.game, cls.version)
scores, absentees = cls._get_league_scores(data, leagueid, all_profiles)
# Get user IDs to promote, demote and ignore based on scores.
promote, ignore, demote = cls._get_league_buckets(scores)
demote.extend(cls._get_league_absentees(data, leagueid, absentees))
# Get user IDs to promote, demote and ignore based on scores.
promote, ignore, demote = cls._get_league_buckets(scores)
demote.extend(cls._get_league_absentees(data, leagueid, absentees))
# Actually modify the profiles so the game knows to tell the user.
for userid in promote:
cls._modify_profile(data, userid, 'promote')
for userid in demote:
cls._modify_profile(data, userid, 'demote')
# Actually modify the profiles so the game knows to tell the user.
for userid in promote:
cls._modify_profile(data, userid, 'promote')
for userid in demote:
cls._modify_profile(data, userid, 'demote')
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'league_course', 'weekly')
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'league_course', 'weekly')
if data.local.network.should_schedule(cls.game, cls.version, 'fc_challenge', 'daily'):
# Generate a new list of two FC challenge songs.
start_time, end_time = data.local.network.get_schedule_duration('daily')
all_songs = set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version))
daily_songs = random.sample(all_songs, 2)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'fc_challenge',
{
'start_time': start_time,
'end_time': end_time,
'today': daily_songs[0],
'whim': daily_songs[1],
},
)
events.append((
'jubeat_fc_challenge_charts',
{
'version': cls.version,
'today': daily_songs[0],
'whim': daily_songs[1],
},
))
if len(all_songs) >= 2:
daily_songs = random.sample(all_songs, 2)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'fc_challenge',
{
'start_time': start_time,
'end_time': end_time,
'today': daily_songs[0],
'whim': daily_songs[1],
},
)
events.append((
'jubeat_fc_challenge_charts',
{
'version': cls.version,
'today': daily_songs[0],
'whim': daily_songs[1],
},
))
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'fc_challenge', 'daily')
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'fc_challenge', 'daily')
return events

View File

@ -66,29 +66,30 @@ class JubeatQubell(
# Generate a new list of two FC challenge songs.
start_time, end_time = data.local.network.get_schedule_duration('daily')
all_songs = set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version))
daily_songs = random.sample(all_songs, 2)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'fc_challenge',
{
'start_time': start_time,
'end_time': end_time,
'today': daily_songs[0],
'whim': daily_songs[1],
},
)
events.append((
'jubeat_fc_challenge_charts',
{
'version': cls.version,
'today': daily_songs[0],
'whim': daily_songs[1],
},
))
if len(all_songs) >= 2:
daily_songs = random.sample(all_songs, 2)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'fc_challenge',
{
'start_time': start_time,
'end_time': end_time,
'today': daily_songs[0],
'whim': daily_songs[1],
},
)
events.append((
'jubeat_fc_challenge_charts',
{
'version': cls.version,
'today': daily_songs[0],
'whim': daily_songs[1],
},
))
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'fc_challenge', 'daily')
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'fc_challenge', 'daily')
return events
def __get_global_info(self) -> Node:

View File

@ -45,27 +45,28 @@ class JubeatSaucer(
# Generate a new list of two FC challenge songs.
start_time, end_time = data.local.network.get_schedule_duration('daily')
all_songs = set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version))
today_song = random.sample(all_songs, 1)[0]
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'fc_challenge',
{
'start_time': start_time,
'end_time': end_time,
'today': today_song,
},
)
events.append((
'jubeat_fc_challenge_charts',
{
'version': cls.version,
'today': today_song,
},
))
if all_songs:
today_song = random.sample(all_songs, 1)[0]
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'fc_challenge',
{
'start_time': start_time,
'end_time': end_time,
'today': today_song,
},
)
events.append((
'jubeat_fc_challenge_charts',
{
'version': cls.version,
'today': today_song,
},
))
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'fc_challenge', 'daily')
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'fc_challenge', 'daily')
return events
def handle_shopinfo_regist_request(self, request: Node) -> Node:

View File

@ -56,29 +56,30 @@ class JubeatSaucerFulfill(
# Generate a new list of two FC challenge songs.
start_time, end_time = data.local.network.get_schedule_duration('daily')
all_songs = set(song.id for song in data.local.music.get_all_songs(cls.game, cls.version))
daily_songs = random.sample(all_songs, 2)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'fc_challenge',
{
'start_time': start_time,
'end_time': end_time,
'today': daily_songs[0],
'whim': daily_songs[1],
},
)
events.append((
'jubeat_fc_challenge_charts',
{
'version': cls.version,
'today': daily_songs[0],
'whim': daily_songs[1],
},
))
if len(all_songs) >= 2:
daily_songs = random.sample(all_songs, 2)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'fc_challenge',
{
'start_time': start_time,
'end_time': end_time,
'today': daily_songs[0],
'whim': daily_songs[1],
},
)
events.append((
'jubeat_fc_challenge_charts',
{
'version': cls.version,
'today': daily_songs[0],
'whim': daily_songs[1],
},
))
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'fc_challenge', 'daily')
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'fc_challenge', 'daily')
return events
def handle_shopinfo_regist_request(self, request: Node) -> Node:

View File

@ -71,27 +71,28 @@ class PopnMusicUsaNeko(PopnMusicBase):
# Generate a new course list, save it to the DB.
start_time, end_time = data.local.network.get_schedule_duration('weekly')
all_songs = [song.id for song in data.local.music.get_all_songs(cls.game, cls.version)]
course_song = random.choice(all_songs)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'course',
{
'start_time': start_time,
'end_time': end_time,
'music': course_song,
},
)
events.append((
'pnm_course',
{
'version': cls.version,
'song': course_song,
},
))
if all_songs:
course_song = random.choice(all_songs)
data.local.game.put_time_sensitive_settings(
cls.game,
cls.version,
'course',
{
'start_time': start_time,
'end_time': end_time,
'music': course_song,
},
)
events.append((
'pnm_course',
{
'version': cls.version,
'song': course_song,
},
))
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'course', 'weekly')
# Mark that we did some actual work here.
data.local.network.mark_scheduled(cls.game, cls.version, 'course', 'weekly')
return events
def __score_to_rank(self, score: int) -> int: