Skip to content

Conversation

@shoe913
Copy link
Contributor

@shoe913 shoe913 commented Apr 24, 2025

Expressions that are used to generate an HTML calendar in a pop up.

Some or all of the expressions can be used to generate the calendar.

@shoe913
Copy link
Contributor Author

shoe913 commented Apr 24, 2025

#94

Copy link
Member

@MikeMillerGIS MikeMillerGIS left a comment

Choose a reason for hiding this comment

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

A standalone JS file would make a code review a lot easier
also, wonder if some of the longer code blocks can be moved to functions for easier read-ability

return("Event List Required")
}

iif(IsEmpty(showCalendar),showCalendar=True,showCalendar)
Copy link
Member

Choose a reason for hiding this comment

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

You can remove all these and just use DefaultValue later, would be a lot cleaner

var temp = events
var eventColors = {}
events = {}
for (var y in temp){
Copy link
Member

Choose a reason for hiding this comment

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

can you leverage the new for (var foo OF array)? it is a lot cleaner

Copy link
Member

Choose a reason for hiding this comment

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

if so, lots of places could benefit

var eventColors = {}
events = {}
for (var y in temp){
eventColors[temp[y]["Name"]]=temp[y]["Color"]
Copy link
Member

Choose a reason for hiding this comment

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

temp[y].Name (Dot Notation) is more readable



var m_days={"January":31,"February":28,"March":31,"April":30,"May":31,"June":30, "July":31,"August":31,"September":30,"October":31,"November":30,"December":31}
var m_number={"January":0,"February":1,"March":2,"April":3,"May":4,"June":5, "July":6,"August":7,"September":8,"October":9,"November":10,"December":11}
Copy link
Member

Choose a reason for hiding this comment

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

could just use a list and ask for the index, instead of a dict.


var m_days={"January":31,"February":28,"March":31,"April":30,"May":31,"June":30, "July":31,"August":31,"September":30,"October":31,"November":30,"December":31}
var m_number={"January":0,"February":1,"March":2,"April":3,"May":4,"June":5, "July":6,"August":7,"September":8,"October":9,"November":10,"December":11}
var m_name ={"0":"January","1":"February","2":"March","3":"April","4":"May","5":"June","6":"July","7":"August","8":"September","9":"October","10":"November","11":"December"}
Copy link
Member

Choose a reason for hiding this comment

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

if you used a list, it would combine this and the above

months[m_name[text(month(EventDays[key_list[e]][d]))]][e_day]['colors'] = tempColor +eventColors[key_list[e]] + ","
}
}
months[m_name[text(month(today()))]][day(today())-1]['Border'] = "3px solid "+ todayColor
Copy link
Member

Choose a reason for hiding this comment

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

formated string literal
3px solid ${todayColor}

Copy link
Member

Choose a reason for hiding this comment

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

backticks did not come through, but needs a back tick at start and end


var tempList = eventList
eventList=[]
for(var x in tempList){
Copy link
Member

Choose a reason for hiding this comment

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

for/of


push(bumplist,h_date)
}else{
tempYear = Year(today())
Copy link
Member

Choose a reason for hiding this comment

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

calling year(today()) a few times, store as a variable?

return("schedule required")
}

iif(IsEmpty(weekInterval),weekInterval=1,weekInterval)
Copy link
Member

Choose a reason for hiding this comment

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

DefaultValue would remove this

iif(IsEmpty(eventSeason),eventSeason=[[1,1],[12,31]],eventSeason)


var weekdays_ = {"Sunday":0,"Monday":1,"Tuesday":2,"Wednesday":3,"Thursday":4,"Friday":5,"Saturday":6}
Copy link
Member

Choose a reason for hiding this comment

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

use a list and index as number

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