Skip to content

Commit

Permalink
恢复提前八分钟上班+修复上班时间计算低优干员 (#726)
Browse files Browse the repository at this point in the history
* 恢复提前八分钟上班+修复上班时间计算低优干员

1、如果组里有耗尽干员则不提前,如果没有耗尽则提前八分钟。
2、原本high_dorms计入了所有高效组,现在剔除了高效组当中的低优干员,如果全是低优,则不剔除。

* 格式化代码

* 优化提前8分钟代码

* 回退全部使用职介筛选

* prettier格式化
  • Loading branch information
Anyk00 authored Feb 13, 2025
1 parent 18abb9b commit 0fa754e
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 65 deletions.
4 changes: 2 additions & 2 deletions arknights_mower/solvers/base_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -2285,8 +2285,8 @@ def choose_agent(
right_swipe = 0
last_special_filter = profession
elif agent and agent[0] in agent_list:
if agent[0] != "阿米娅":
# 只要不是阿米娅就打开职介筛选
if is_dorm and agent[0] != "阿米娅":
# 在宿舍并且不是阿米娅则打开职介筛选
profession = agent_profession[agent[0]]
self.profession_filter(profession)
if last_special_filter != profession:
Expand Down
1 change: 1 addition & 0 deletions arknights_mower/utils/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,7 @@ def current_room(self, value):
Operators.current_room_changed_callback(self)

def is_high(self):
# 是否为高效组
return self.operator_type == "high"

def is_resting(self):
Expand Down
29 changes: 26 additions & 3 deletions arknights_mower/utils/scheduler_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,13 @@ def generate_plan_by_drom(tasks, op_data):
for time, (dorms, rest_in_full) in ordered:
logger.debug(f"{time},{dorms},{rest_in_full}")
plan = {}
exhaust_exist = False
for room in dorms:
if room.name in planned:
continue
op = op_data.operators[room.name]
if op.exhaust_require:
exhaust_exist = True
if not op.is_high():
# 释放宿舍类别
if op.current_room not in plan:
Expand All @@ -201,10 +204,14 @@ def generate_plan_by_drom(tasks, op_data):
plan[o.room][o.index] = agent
planned.add(o.name)
if rest_in_full:
if exhaust_exist:
time = max(time, current_time)
else:
time = max(time - timedelta(minutes=8), current_time)
result.append(
SchedulerTask(
task_plan=plan,
time=max(time, current_time),
time=time,
task_type=TaskTypes.SHIFT_ON,
)
)
Expand Down Expand Up @@ -241,7 +248,12 @@ def generate_plan_by_drom(tasks, op_data):
result.append(
SchedulerTask(
task_plan=plan,
time=max(time, current_time - timedelta(seconds=1)),
time=max(time, current_time - timedelta(seconds=1))
if rest_in_full is None
else max(
time - timedelta(minutes=8),
current_time - timedelta(seconds=1),
),
task_type=TaskTypes.RELEASE_DORM
if rest_in_full is None
else TaskTypes.SHIFT_ON,
Expand Down Expand Up @@ -301,7 +313,18 @@ def plan_metadata(op_data, tasks):
logger.debug(f"开始计算:{dorms}")
max_rest_in_full_time = None
task_time = datetime.max
high_dorms = [dorm for dorm in dorms if op_data.operators[dorm.name].is_high()]
_high_dorms = [
dorm
for dorm in dorms
if op_data.operators[dorm.name].is_high()
and op_data.operators[dorm.name].resting_priority == "high"
]
if len(_high_dorms) == 0:
high_dorms = [
dorm for dorm in dorms if op_data.operators[dorm.name].is_high()
]
else:
high_dorms = _high_dorms
rest_in_full_dorms = [
dorm for dorm in high_dorms if op_data.operators[dorm.name].rest_in_full
]
Expand Down
2 changes: 1 addition & 1 deletion ui/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
root: true,
'extends': [
extends: [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-prettier/skip-formatting'
Expand Down
126 changes: 69 additions & 57 deletions ui/auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,66 +5,78 @@
// Generated by unplugin-auto-import
export {}
declare global {
const EffectScope: typeof import('vue')['EffectScope']
const computed: typeof import('vue')['computed']
const createApp: typeof import('vue')['createApp']
const customRef: typeof import('vue')['customRef']
const defineAsyncComponent: typeof import('vue')['defineAsyncComponent']
const defineComponent: typeof import('vue')['defineComponent']
const effectScope: typeof import('vue')['effectScope']
const getCurrentInstance: typeof import('vue')['getCurrentInstance']
const getCurrentScope: typeof import('vue')['getCurrentScope']
const h: typeof import('vue')['h']
const inject: typeof import('vue')['inject']
const isProxy: typeof import('vue')['isProxy']
const isReactive: typeof import('vue')['isReactive']
const isReadonly: typeof import('vue')['isReadonly']
const isRef: typeof import('vue')['isRef']
const markRaw: typeof import('vue')['markRaw']
const nextTick: typeof import('vue')['nextTick']
const onActivated: typeof import('vue')['onActivated']
const onBeforeMount: typeof import('vue')['onBeforeMount']
const onBeforeUnmount: typeof import('vue')['onBeforeUnmount']
const onBeforeUpdate: typeof import('vue')['onBeforeUpdate']
const onDeactivated: typeof import('vue')['onDeactivated']
const onErrorCaptured: typeof import('vue')['onErrorCaptured']
const onMounted: typeof import('vue')['onMounted']
const onRenderTracked: typeof import('vue')['onRenderTracked']
const onRenderTriggered: typeof import('vue')['onRenderTriggered']
const onScopeDispose: typeof import('vue')['onScopeDispose']
const onServerPrefetch: typeof import('vue')['onServerPrefetch']
const onUnmounted: typeof import('vue')['onUnmounted']
const onUpdated: typeof import('vue')['onUpdated']
const provide: typeof import('vue')['provide']
const reactive: typeof import('vue')['reactive']
const readonly: typeof import('vue')['readonly']
const ref: typeof import('vue')['ref']
const resolveComponent: typeof import('vue')['resolveComponent']
const shallowReactive: typeof import('vue')['shallowReactive']
const shallowReadonly: typeof import('vue')['shallowReadonly']
const shallowRef: typeof import('vue')['shallowRef']
const toRaw: typeof import('vue')['toRaw']
const toRef: typeof import('vue')['toRef']
const toRefs: typeof import('vue')['toRefs']
const toValue: typeof import('vue')['toValue']
const triggerRef: typeof import('vue')['triggerRef']
const unref: typeof import('vue')['unref']
const useAttrs: typeof import('vue')['useAttrs']
const useCssModule: typeof import('vue')['useCssModule']
const useCssVars: typeof import('vue')['useCssVars']
const useDialog: typeof import('naive-ui')['useDialog']
const useLoadingBar: typeof import('naive-ui')['useLoadingBar']
const useMessage: typeof import('naive-ui')['useMessage']
const useNotification: typeof import('naive-ui')['useNotification']
const useSlots: typeof import('vue')['useSlots']
const watch: typeof import('vue')['watch']
const watchEffect: typeof import('vue')['watchEffect']
const watchPostEffect: typeof import('vue')['watchPostEffect']
const watchSyncEffect: typeof import('vue')['watchSyncEffect']
const EffectScope: (typeof import('vue'))['EffectScope']
const computed: (typeof import('vue'))['computed']
const createApp: (typeof import('vue'))['createApp']
const customRef: (typeof import('vue'))['customRef']
const defineAsyncComponent: (typeof import('vue'))['defineAsyncComponent']
const defineComponent: (typeof import('vue'))['defineComponent']
const effectScope: (typeof import('vue'))['effectScope']
const getCurrentInstance: (typeof import('vue'))['getCurrentInstance']
const getCurrentScope: (typeof import('vue'))['getCurrentScope']
const h: (typeof import('vue'))['h']
const inject: (typeof import('vue'))['inject']
const isProxy: (typeof import('vue'))['isProxy']
const isReactive: (typeof import('vue'))['isReactive']
const isReadonly: (typeof import('vue'))['isReadonly']
const isRef: (typeof import('vue'))['isRef']
const markRaw: (typeof import('vue'))['markRaw']
const nextTick: (typeof import('vue'))['nextTick']
const onActivated: (typeof import('vue'))['onActivated']
const onBeforeMount: (typeof import('vue'))['onBeforeMount']
const onBeforeUnmount: (typeof import('vue'))['onBeforeUnmount']
const onBeforeUpdate: (typeof import('vue'))['onBeforeUpdate']
const onDeactivated: (typeof import('vue'))['onDeactivated']
const onErrorCaptured: (typeof import('vue'))['onErrorCaptured']
const onMounted: (typeof import('vue'))['onMounted']
const onRenderTracked: (typeof import('vue'))['onRenderTracked']
const onRenderTriggered: (typeof import('vue'))['onRenderTriggered']
const onScopeDispose: (typeof import('vue'))['onScopeDispose']
const onServerPrefetch: (typeof import('vue'))['onServerPrefetch']
const onUnmounted: (typeof import('vue'))['onUnmounted']
const onUpdated: (typeof import('vue'))['onUpdated']
const provide: (typeof import('vue'))['provide']
const reactive: (typeof import('vue'))['reactive']
const readonly: (typeof import('vue'))['readonly']
const ref: (typeof import('vue'))['ref']
const resolveComponent: (typeof import('vue'))['resolveComponent']
const shallowReactive: (typeof import('vue'))['shallowReactive']
const shallowReadonly: (typeof import('vue'))['shallowReadonly']
const shallowRef: (typeof import('vue'))['shallowRef']
const toRaw: (typeof import('vue'))['toRaw']
const toRef: (typeof import('vue'))['toRef']
const toRefs: (typeof import('vue'))['toRefs']
const toValue: (typeof import('vue'))['toValue']
const triggerRef: (typeof import('vue'))['triggerRef']
const unref: (typeof import('vue'))['unref']
const useAttrs: (typeof import('vue'))['useAttrs']
const useCssModule: (typeof import('vue'))['useCssModule']
const useCssVars: (typeof import('vue'))['useCssVars']
const useDialog: (typeof import('naive-ui'))['useDialog']
const useLoadingBar: (typeof import('naive-ui'))['useLoadingBar']
const useMessage: (typeof import('naive-ui'))['useMessage']
const useNotification: (typeof import('naive-ui'))['useNotification']
const useSlots: (typeof import('vue'))['useSlots']
const watch: (typeof import('vue'))['watch']
const watchEffect: (typeof import('vue'))['watchEffect']
const watchPostEffect: (typeof import('vue'))['watchPostEffect']
const watchSyncEffect: (typeof import('vue'))['watchSyncEffect']
}
// for type re-export
declare global {
// @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
export type {
Component,
ComponentPublicInstance,
ComputedRef,
ExtractDefaultPropTypes,
ExtractPropTypes,
ExtractPublicPropTypes,
InjectionKey,
PropType,
Ref,
VNode,
WritableComputedRef
} from 'vue'
import('vue')
}
2 changes: 1 addition & 1 deletion ui/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
2 changes: 1 addition & 1 deletion ui/manager/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down

0 comments on commit 0fa754e

Please sign in to comment.