Skip to content

Commit

Permalink
fix: naming
Browse files Browse the repository at this point in the history
(cherry picked from commit 981a017)
  • Loading branch information
ruchamahabal authored and mergify[bot] committed Jan 9, 2024
1 parent fd2e419 commit 2fd540d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion hrms/hr/doctype/goal/goal.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def update_progress(progress: float, goal: str) -> None:

@frappe.whitelist()
def update_status(status: str, goals: str | list) -> None:
if type(goals) is not list:
if isinstance(goals, str):
import json

goals = json.loads(goals)
Expand Down
13 changes: 7 additions & 6 deletions hrms/hr/doctype/goal/goal_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ frappe.listview_settings["Goal"] = {
.filter(
(item) =>
!item.is_group &&
applicable_current_statuses(status).includes(item.status)
get_applicable_current_statuses(status).includes(item.status)
)
.map((item) => item.name);
if (!items_to_be_updated.length)
Expand All @@ -70,25 +70,26 @@ frappe.listview_settings["Goal"] = {
__("{0} {1} {2}?", [
simple_present_tense[status],
items_to_be_updated.length.toString(),
items_to_be_updated.length === 1 ? "item" : "items",
items_to_be_updated.length === 1 ? __("goal") : __("goals"),
]),
() => {
this.update_status("", items_to_be_updated, listview);
this.trigger_error_dialogs(checked_items, status);
}
);
} else
} else {
frappe.confirm(
__("Mark {0} {1} as {2}?", [
items_to_be_updated.length.toString(),
items_to_be_updated.length === 1 ? "item" : "items",
items_to_be_updated.length === 1 ? __("goal") : __("goals"),
status,
]),
() => {
this.update_status(status, items_to_be_updated, listview);
this.trigger_error_dialogs(checked_items, status);
}
);
}
},

trigger_error_dialogs: function (checked_items, status) {
Expand All @@ -104,7 +105,7 @@ frappe.listview_settings["Goal"] = {
indicator: "orange",
});

const applicable_statuses = applicable_current_statuses(status);
const applicable_statuses = get_applicable_current_statuses(status);
if (
checked_items.some((item) => !applicable_statuses.includes(item.status))
)
Expand Down Expand Up @@ -143,7 +144,7 @@ frappe.listview_settings["Goal"] = {
};

// Returns all possible current statuses that can be changed to the new one
const applicable_current_statuses = (new_status) => {
const get_applicable_current_statuses = (new_status) => {
switch (new_status) {
case "Completed":
return ["Pending", "In Progress"];
Expand Down

0 comments on commit 2fd540d

Please sign in to comment.