Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不养闲人任务合并+优化ui路径+自定义副表名称+仅回满提前上班 #693

Merged
merged 16 commits into from
Sep 27, 2024

Conversation

Anyk00
Copy link
Contributor

@Anyk00 Anyk00 commented Sep 24, 2024

不养闲人任务将会自动合并至自定义间隔以内的下一个任务。
打包后需要在internal文件夹内新建ui文件夹,并将原本ui文件下编译生成的dist文件夹放入其中。
可以修改副表名称,方便查看每个副表的功能。
回满任务检测组内所有干员有无耗尽,若无耗尽则上班任务提前,删除了减少仅回满干员0.5心情上限的功能。

@@ -3339,6 +3385,9 @@ def maa_plan_solver(self, tasks="All", one_time=False):
):
self.MAA.stop()
hard_stop = True
elif config.stop_maa.is_set():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这是里是什么意思呀

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

就是立即停止上面有个停止maa按钮,点了那个可以中断maa的任务。

@@ -141,6 +141,7 @@ def __init__(
trigger: Optional[LogicExpression] = None,
task: Optional[dict[str, list[str]]] = None,
trigger_timing: Optional[str] = None,
name: Optional[str] = None,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我觉得标题在 plan.json存就好 了,没必要传到后端?

i, d = self.op_data.get_dorm_by_name(task.meta_data)
if i is None:
logger.info(f"检测到{task.meta_data}不在宿舍,移除相关任务")
return False
return True

self.tasks = [t for t in self.tasks if should_keep(t)]
merge_interval = config.conf.merge_interval
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/ArkMowers/arknights-mower/blob/2024.9.4/arknights_mower/utils/scheduler_task.py

有关改动能移到这里嘛,这边是对任务进行的改动。

except NotFound:
return "<h1>404 Not Found</h1>", 404
return send_from_directory("dist", "index.html")
return send_from_directory("ui/dist", "index.html")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ui 的 read me 可以更新一下嘛

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改好了

@@ -578,19 +586,33 @@ def plan_metadata(self):
logger.debug("检测到时间数据不存在")
self.op_data.reset_dorm_time()
self.error = True
self.tasks.sort(key=lambda task: task.time)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这行不需要了对吧?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

之前append的任务应该默认是在tasks的最后一个吧?我不是很清楚有没有排过序,就加了一行这个。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scheduling 方法每次任务开始的时候都自带排序的,所以不要刻意排序

i, d = self.op_data.get_dorm_by_name(task.meta_data)
if i is None:
logger.info(f"检测到{task.meta_data}不在宿舍,移除相关任务")
return False
return True

self.tasks = [t for t in self.tasks if should_keep(t)]
merge_interval = config.conf.merge_interval
merge_release_dorm(self.tasks, merge_interval)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这部分能移到任务开始的时候嘛。那里有个任务调度逻辑

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这样做问题就是生成不养闲人时候,假如不养闲人就是最近的任务怎么办

@@ -105,6 +105,7 @@ class BackupPlan(BaseModel):
task: Task = {}
trigger: Trigger = {}
trigger_timing: str = "AFTER_PLANNING"
name: str = "plan"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

名字可以不用传到后端,因为后端不需要名字对吧?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是的,只在前端的标题里面看

@Shawnsdaddy Shawnsdaddy merged commit dfe5a30 into ArkMowers:2024.9.4 Sep 27, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants