2GEG6ZQ27IJCPN5ZJIVTQT7EB3ML2X3SGIFUM2EWWEKU5Q5HRRJAC QHC5AM3DSLRYPRDCQEP4UAGQKRASBKRHJM6FOGNZWNTTO6RYMTNAC CKULEF2ZEI7U6GBA5JZQ6AMDP77G4X5RGNQO3TML6LJLA6UDL54QC IT55ASWSZHHHW7MZ6MWVFZFZZNA3WKFBXQLNAFY7PYGHYQUJOZIAC B7W4Q522DLB6DKH2TFDOCTSZFZLFTOLCT6CCZEOC3V3UUMSAOOFAC N7TZV5WJKLYKSG6SIVAID4ZCC76YHZU5U5WWQGG6TFKAV6CE3Y6AC B6QIBRKFDFZKHHHT6F6M2NST2CYXNK4FCCYL3JOIAYDZYX3FQLRAC AJKCAY3ODMTFBO6GXWXWQSWNFIH3H7JNBRFVW5H6ZSWA7SZGY3FAC 7QS7R2ORWCZMTCE3SD5PJ5ZL27N3RS7YCWBHXH3JDPTHDQ3KBAMQC BZWC6XMOUXEPOI7P65MREJZ45TSQRFMMR2SQ7LML7RMCKUL57VHAC Q4BYGYNX3UZXX47EMX2GWX6M6ICSMIMCLQ7HVOYS4HB4RHYI4NEQC GGREOYIRZE2GH62X7YXQA7IUSSB25ENLQ5OKVJYWPNI462DP37FAC fn daytime_interval(dur: Duration, interval: u32) -> NaiveTime {let hour = (dur.num_hours() - 24 * dur.num_days()) as u32;let min = (dur.num_minutes() - 60 * dur.num_hours()) as u32;let min = if min % interval >= interval / 2 {min + (interval - min % interval)} else {min - (min % interval)};
trait RoundTo {fn round_to(&self, minutes: u32) -> Self;}
NaiveTime::from_hms(hour, min, sec)
impl RoundTo for Duration {fn round_to(&self, minutes: u32) -> Self {let min = self.num_minutes();let sec = self.num_seconds() - self.num_minutes() * 60;self.clone() + round_offset(min as u32, minutes) - Duration::seconds(sec)}
fn into_raid_night(data: &mut Vec<RNData>) -> (u32, NaiveTime, NaiveTime, usize) {data.sort_by_key(|d| d.end_time);let med_end_time = data[data.len() / 2].end_time.clone();data.sort_by_key(|d| d.start_time);let med_start = &data[data.len() / 2];
fn into_raid_night(data: &mut Vec<RNData>) -> (DateTime<Utc>, Duration, usize) {data.sort_by_key(|d| d.duration);let p10 = (data.len() as f32 * 0.3).ceil() as usize - 1;let p90 = (data.len() as f32 * 0.7).ceil() as usize - 1;let end_time = data[p90].duration.clone();data.sort_by_key(|d| weekpoint(d.start_time));let med_start = &data[p10];debug!("times {} {} {:?}", p10, p90, data);
let start_time = weekpoint(log_start_time + Duration::milliseconds(fight_start as i64));let end_time = weekpoint(log_start_time + Duration::milliseconds(fight_end as i64));
let start_time = log_start_time + Duration::milliseconds(fight_start as i64);let duration = Duration::milliseconds(fight_end as i64);
day_of_week integer not null,start_time time not null,end_time time not null,
-- we store the start time with date here because trying to store the time of-- day just causes headaches with TZ conversions and raid times that go past-- the 23:59 markstart_time timestamp with time zone not null,duration integer not null,
if (start_date.ok && end_date.ok) {const day = new Intl.DateTimeFormat('en-US', { weekday: 'short' }).format(start_date.val);const start = new Intl.DateTimeFormat('en-US', { hour: 'numeric', minute: 'numeric' }).format(start_date.val);const end = new Intl.DateTimeFormat('en-US', { hour: 'numeric', minute: 'numeric', timeZoneName: 'short' }).format(end_date.val);
if (start_date && end_date) {const day = new Intl.DateTimeFormat('en-US', { weekday: 'short' }).format(start_date);const start = new Intl.DateTimeFormat('en-US', { hour: 'numeric', minute: 'numeric' }).format(start_date);const end = new Intl.DateTimeFormat('en-US', { hour: 'numeric', minute: 'numeric', timeZoneName: 'short' }).format(end_date);
import { ZONE_ENCOUNTERS, toRegion, ENCOUNTER_NAMES, DIFFICULTY_NAMES } from './model';import { formatRaidTime, formatShortDate, formatDuration, time_date } from './format';
import { ZONE_ENCOUNTERS, toRegion, Region, regionReset, ENCOUNTER_NAMES, DIFFICULTY_NAMES } from './model';import { formatRaidTime, formatShortDate, formatDuration } from './format';
const nights = data.teamStats.raidNights.filter((rn: RaidNight) => rn.observedInstances >= threshold);const mins = nights.reduce((sum: number, rn: RaidNight) => {const start = time_date(rn.startTime, rn.dayOfWeek).unwrap();let end = time_date(rn.endTime, rn.dayOfWeek).unwrap();// if end is e.g. 1am while start is 10pm, this can occur with// the above construction. fix it by incrementing the dateif(end.valueOf() < start.valueOf()) {end = time_date(rn.endTime, rn.dayOfWeek + 1).unwrap();}
const reset = regionReset(props.region);const nights = data.teamStats.raidNights.filter((rn: RaidNight) => rn.observedInstances >= threshold).map((rn: RaidNight) => ({ ...rn, startTime: new Date(rn.startTime) })).sort((a: RaidNight, b: RaidNight) => ((7 + a.startTime.getDay() - reset) % 7) - ((7 + b.startTime.getDay() - reset) % 7));