-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #436 from chrisbenincasa/make-dynamic-lists
Create dynamic lists from Explore page
- Loading branch information
Showing
75 changed files
with
2,944 additions
and
641 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
ARG BASE_IMAGE=launcher.gcr.io/google/openjdk8 | ||
FROM ${BASE_IMAGE} | ||
|
||
ARG SBT_VERSION=1.2.8 | ||
ARG SHA=f4b9fde91482705a772384c9ba6cdbb84d1c4f7a278fd2bfb34961cd9ed8e1d7 | ||
ARG BASE_URL=https://github.com/sbt/sbt/releases/download | ||
|
||
ENV SBT_OPTS="\ | ||
-Djava.net.preferIPv4Stack=true \ | ||
-XX:+AggressiveOpts \ | ||
-XX:+UseParNewGC \ | ||
-XX:+UseConcMarkSweepGC \ | ||
-XX:+CMSParallelRemarkEnabled \ | ||
-XX:+CMSClassUnloadingEnabled \ | ||
-XX:ReservedCodeCacheSize=128m \ | ||
-XX:SurvivorRatio=128 \ | ||
-XX:MaxTenuringThreshold=0 \ | ||
-Xss8M \ | ||
-Xms512M \ | ||
-Xmx2G \ | ||
-server \ | ||
" | ||
|
||
RUN apt-get update -qqy \ | ||
&& apt-get install -qqy curl bc \ | ||
&& mkdir -p /usr/share \ | ||
&& curl -fsSL -o "sbt-${SBT_VERSION}.zip" "${BASE_URL}/v${SBT_VERSION}/sbt-${SBT_VERSION}.zip" \ | ||
&& echo "${SHA} sbt-${SBT_VERSION}.zip" | sha256sum -c - \ | ||
&& unzip -qq "sbt-${SBT_VERSION}.zip" \ | ||
&& rm -f "sbt-${SBT_VERSION}.zip" \ | ||
&& mv sbt "/usr/share/sbt-${SBT_VERSION}" \ | ||
&& ln -s "/usr/share/sbt-${SBT_VERSION}/bin/sbt" /usr/bin/sbt \ | ||
&& apt-get remove -qqy --purge curl \ | ||
&& rm /var/lib/apt/lists/*_* | ||
|
||
ENTRYPOINT ["/usr/bin/sbt"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
87 changes: 87 additions & 0 deletions
87
scala-server/common/src/main/scala/com/teletracker/common/db/model/DynamicListRules.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
package com.teletracker.common.db.model | ||
|
||
import com.teletracker.common.db.SortMode | ||
import org.checkerframework.checker.units.qual.min | ||
import java.util.UUID | ||
|
||
sealed trait DynamicListRule { | ||
def negated: Option[Boolean] | ||
} | ||
|
||
object DynamicListTagRule { | ||
def ifPresent(tagType: UserThingTagType): DynamicListTagRule = | ||
DynamicListTagRule(tagType, None, Some(true)) | ||
|
||
def watched = ifPresent(UserThingTagType.Watched) | ||
def notWatched = watched.negate | ||
} | ||
|
||
case class DynamicListTagRule( | ||
tagType: UserThingTagType, | ||
value: Option[Double], | ||
isPresent: Option[Boolean], | ||
negated: Option[Boolean] = None) | ||
extends DynamicListRule { | ||
def withValue(value: Double): DynamicListTagRule = | ||
this.copy(value = Some(value)) | ||
|
||
def negate: DynamicListTagRule = this.copy(negated = Some(true)) | ||
} | ||
|
||
case class DynamicListPersonRule( | ||
personId: UUID, | ||
associationType: Option[PersonAssociationType], | ||
negated: Option[Boolean] = None) | ||
extends DynamicListRule | ||
|
||
case class DynamicListGenreRule( | ||
genreId: Int, | ||
negated: Option[Boolean] = None) | ||
extends DynamicListRule | ||
|
||
case class DynamicListItemTypeRule( | ||
itemType: ThingType, | ||
negated: Option[Boolean] = None) | ||
extends DynamicListRule | ||
|
||
case class DynamicListNetworkRule( | ||
networkId: Int, | ||
negated: Option[Boolean] = None) | ||
extends DynamicListRule | ||
|
||
sealed trait DynamicListRangeRule[T] extends DynamicListRule { | ||
def minimum: Option[T] | ||
def maximum: Option[T] | ||
def inclusive: Boolean = true | ||
} | ||
|
||
case class DynamicListReleaseYearRule( | ||
minimum: Option[Int], | ||
maximum: Option[Int], | ||
negated: Option[Boolean] = None) | ||
extends DynamicListRangeRule[Int] | ||
|
||
case class DynamicListDefaultSort(sort: String) | ||
|
||
case class DynamicListRules( | ||
rules: List[DynamicListRule], | ||
sort: Option[DynamicListDefaultSort]) { | ||
require(rules.nonEmpty) | ||
} | ||
|
||
object DynamicListRules { | ||
def watched = | ||
DynamicListRules( | ||
rules = DynamicListTagRule.ifPresent(UserThingTagType.Watched) :: Nil, | ||
sort = None | ||
) | ||
|
||
def person( | ||
id: UUID, | ||
associationType: Option[PersonAssociationType] = None | ||
) = | ||
DynamicListRules( | ||
rules = DynamicListPersonRule(id, associationType) :: Nil, | ||
sort = None | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.