# Copyright (c) 2015, JINGROW and Contributors
# License: MIT. See LICENSE

import json

import jingrow


@jingrow.whitelist()
def update_task(args, field_map):
	"""Updates Pg (called via gantt) based on passed `field_map`"""
	args = jingrow._dict(json.loads(args))
	field_map = jingrow._dict(json.loads(field_map))
	d = jingrow.get_pg(args.pagetype, args.name)
	d.set(field_map.start, args.start)
	d.set(field_map.end, args.end)
	d.save()
