fullcalendar 3.10.0中是否有一个触发器,该触发器给了我一些价值,然后我将事件从小时移动到全天,又将事件从一天移动到几小时?

时间:2019-01-23 13:49:08

标签: javascript fullcalendar

我正在使用全日历3.10.0。我需要从数据库背面的全日历保存数据。要以小时为单位保存活动,您需要以以下格式设置日期和时间“ 2019-01-08T05:00”,并指示该活动不是全天。

我的json:

scala> val df = Seq((196,242,3,881250949),(186,302,3,891717742),(22,377,1,878887116),(244,51,2,880606923),(166,346,1,886397596)).toDF("userid","movieid","rating","unixtimestamp")
df: org.apache.spark.sql.DataFrame = [userid: int, movieid: int ... 2 more fields]

scala> df.show(false)
+------+-------+------+-------------+
|userid|movieid|rating|unixtimestamp|
+------+-------+------+-------------+
|196   |242    |3     |881250949    |
|186   |302    |3     |891717742    |
|22    |377    |1     |878887116    |
|244   |51     |2     |880606923    |
|166   |346    |1     |886397596    |
+------+-------+------+-------------+


scala> import org.apache.spark.sql.expressions._
import org.apache.spark.sql.expressions._

scala> val df2 = df.withColumn("total_rating",sum('rating).over())
df2: org.apache.spark.sql.DataFrame = [userid: int, movieid: int ... 3 more fields]

scala> df2.show(false)
19/01/23 08:38:46 WARN window.WindowExec: No Partition Defined for Window operation! Moving all data to a single partition, this can cause serious performance degradation.
+------+-------+------+-------------+------------+
|userid|movieid|rating|unixtimestamp|total_rating|
+------+-------+------+-------------+------------+
|22    |377    |1     |878887116    |10          |
|244   |51     |2     |880606923    |10          |
|166   |346    |1     |886397596    |10          |
|196   |242    |3     |881250949    |10          |
|186   |302    |3     |891717742    |10          |
+------+-------+------+-------------+------------+


scala> df2.withColumn("wa_rating",coalesce( when('rating >= 3,'rating),lit(0))/'total_rating).show(false)
19/01/23 08:47:49 WARN window.WindowExec: No Partition Defined for Window operation! Moving all data to a single partition, this can cause serious performance degradation.
+------+-------+------+-------------+------------+---------+
|userid|movieid|rating|unixtimestamp|total_rating|wa_rating|
+------+-------+------+-------------+------------+---------+
|22    |377    |1     |878887116    |10          |0.0      |
|244   |51     |2     |880606923    |10          |0.0      |
|166   |346    |1     |886397596    |10          |0.0      |
|196   |242    |3     |881250949    |10          |0.3      |
|186   |302    |3     |891717742    |10          |0.3      |
+------+-------+------+-------------+------------+---------+


scala>

要仅在几天内保存事件,您需要带日期且没有时间且allDay为true的json:

[ { "eventId" : 63, 
    "title" : "test 1", 
    "eventType" : 5, 
    "start" : "2019-01-08T02:00", 
    "end" : "2019-01-08T06:00", 
    "color" : null, 
    "allDay" : false } ]

我尝试找到一些诸如eventDragStart或eventDrop之类的操作,它们提供有关事件的信息,然后将其拖动,但没有找到。

在我看来,最可能的决定是,当您将事件从几个小时重新安排到一天并返回到“周”选项卡时,应该出现某种触发。我可以使用此触发器在数据库中进行更正。

0 个答案:

没有答案