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

Calendar colors & code #157

Merged
merged 3 commits into from
Nov 21, 2016
Merged

Calendar colors & code #157

merged 3 commits into from
Nov 21, 2016

Conversation

techgique
Copy link
Member

Closes #105

Alternate single-day entries with blue colors
Alternate multi-day entries with orange and red-orange

Compress JSON output by using HEREDOC with squish
I saw this in some Rails source code and noted for future use :-)

Add some whitespace and alphabetize some things
Use constants for output file and Solr URL
Use easier syntax for fields array

Add preliminary Solr request to retrieve # of rows query matches,
so not relying on hard-coded rows number
Use shorter Solr query syntax

Print output so there is some feedback in the terminal
Catch case that Solr index has no entries or failed, exit, and inform user
Calendar element would empty temporarily while redrawing new year's data
and the footer would jump up and back down quickly

Set min-height on #calendar so the footer remains below the display area
if SOLR_URL
$solr = RSolrCdrh::Query.new(SOLR_URL, fields)

# Retrieve # of rows first so not relying on hard-coded limit
Copy link
Member Author

Choose a reason for hiding this comment

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

Using "rows" => 0 crashes, thus using 1. Using smallest field list minimizes data transfer of the prelim query.

Importance of not using really high Solr rows value, which links to a JIRA issue whose comments inspired this approach: http://stackoverflow.com/questions/10039778/how-to-get-all-results-from-solr-query#comment67310298_10080733

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know why rows => 0 was crashing? I wonder if it's one of the gem layers, it seems like that shouldn't bother solr itself at all.

Copy link
Contributor

@jduss4 jduss4 left a comment

Choose a reason for hiding this comment

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

Looks good! I haven't tested it out locally, so I can do that if you want, but otherwise I think it's ready to merge

if SOLR_URL
$solr = RSolrCdrh::Query.new(SOLR_URL, fields)

# Retrieve # of rows first so not relying on hard-coded limit
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know why rows => 0 was crashing? I wonder if it's one of the gem layers, it seems like that shouldn't bother solr itself at all.

y1, m1, d1 = date1.split("-")
y2, m2, d2 = date2.split("-")
# javascript sucks at dates, so help it out

# javascript uses zero-indexed months
Copy link
Contributor

Choose a reason for hiding this comment

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

I stand by my comment

Copy link
Member Author

Choose a reason for hiding this comment

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

;-)
It would be nicer if everything worked the same so one didn't have to remember this, or be reminded by a later bug / inaccuracy. I'm used to Perl and JS being zero-indexed so the chore has been normalized for me.

@techgique techgique merged commit d3f91cf into master Nov 21, 2016
@techgique techgique deleted the calendar_colors branch November 21, 2016 15:53
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