Skip to content

Commit

Permalink
Merge pull request #81 from data-science-ucsb/79-80-bug-fixes
Browse files Browse the repository at this point in the history
Bug fixes for release
  • Loading branch information
Ramon-W authored Nov 1, 2023
2 parents bff7414 + a24701c commit c299c63
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 60 deletions.
23 changes: 12 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,19 @@ jobs:
with:
drive: docker
install: true

- name: Log in to the Azure docker container registry
uses: azure/docker-login@v1
with:
login-server: ${{secrets.REGISTRY_SERVER}}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Build and push to Azure container registry
- name: Login to AWS ECR
run: |
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }}
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws configure set default.region us-east-1
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 380357184503.dkr.ecr.us-east-1.amazonaws.com
- name: Build and push to AWS ECR
run: |
docker build . -t ${{ secrets.REGISTRY_SERVER }}/myapp:${{ github.sha }}
docker push ${{ secrets.REGISTRY_SERVER }}/myapp:${{ github.sha }}
docker build -t gauchocourses-cr:${{ github.sha }} .
docker tag gauchocourses-cr:${{ github.sha }} 380357184503.dkr.ecr.us-east-1.amazonaws.com/gauchocourses-cr:${{ github.sha }}
docker push 380357184503.dkr.ecr.us-east-1.amazonaws.com/gauchocourses-cr:${{ github.sha }}
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
Expand All @@ -55,4 +56,4 @@ jobs:
push: true
tags: ghcr.io/${{github.repository}}:${{steps.repository.outputs.tag}}
# registry: docker.pkg.github.com
# repository: data-science-ucsb/gauchocourses/gauchocourses:${{ github.event.release.tag_name }}
# repository: data-science-ucsb/gauchocourses/gauchocourses:${{ github.event.release.tag_name }}
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Docker multi-stage build

FROM maven:3.6.3-openjdk-8
FROM --platform=linux/amd64 maven:3.6.3-openjdk-8
# FROM maven:3.6.3-openjdk-8

ADD . /project
WORKDIR /project
Expand All @@ -9,9 +10,10 @@ RUN mvn clean install -P prod -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.c

FROM openjdk:8-jdk

LABEL maintainer="Jason Freeberg"
LABEL maintainer="DS@UCSB"

COPY --from=0 /project/backend/target/*.jar /app.jar
# COPY /backend/target/*.jar /app.jar

ENV JAVA_OPTS=""

Expand Down
14 changes: 8 additions & 6 deletions backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
<version>1.18.30</version>
<optional>true</optional>
</dependency>
<dependency>
Expand All @@ -86,11 +86,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<version>2.2.0</version>
</dependency>

<!-- Test dependencies -->
<dependency>
Expand Down Expand Up @@ -187,6 +182,13 @@
<profiles>
<profile>
<id>dev</id>
<dependencies>
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<version>2.2.0</version>
</dependency>
</dependencies>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static ConfigureRedisAction configureRedisAction() {
}

// Required if embedded mongo does not work on local architecture
// static { System.setProperty("os.arch", "i686_64"); }
// static { System.setProperty("os.arch", "i686_64"); }

public static void main(String[] args) {
SpringApplication.run(GauchoCoursesApplication.class, args);
Expand Down
1 change: 0 additions & 1 deletion backend/src/main/resources/application-dev.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ server.port=8088
# Data source configs
spring.data.mongodb.host=localhost
spring.data.mongodb.port=27017
spring.data.mongodb.database=schedules

# Oauth client for local development
spring.security.oauth2.client.registration.google.client-id=${GOOGLE_OAUTH_CLIENT_ID_DEV}
Expand Down
26 changes: 14 additions & 12 deletions backend/src/main/resources/application-prod.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,26 @@
server.port=80

# Data source configs
spring.data.mongodb.database=${COSMOS_MONGODB_DATABASE_PROD}
spring.data.mongodb.uri=${COSMOS_MONGODB_URI_PROD}
spring.data.mongodb.database=gauchocourses
spring.data.mongodb.uri=${ATLAS_MONGODB_URI_PROD}

# Base cache configs
spring.redis.host=${REDIS_HOST_PROD}
spring.redis.password=${REDIS_PASSWORD_PROD}
spring.redis.port=${REDIS_PORT_PROD}
# Base cache configs, will need to set up elasticache later
# spring.redis.host=${REDIS_HOST_PROD}
# spring.redis.password=${REDIS_PASSWORD_PROD}
# spring.redis.port=${REDIS_PORT_PROD}
spring.cache.type=NONE
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration,org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration
spring.data.redis.repositories.enabled=false

# Request cache config
spring.cache.type=redis
spring.cache.cache-names=quarters,coursesByQuarter,departmentsByQuarter,coursesByQuarterDepartment,courseseByQuarter,classes,departments,quarter
spring.cache.redis.time-to-live=43200000
# spring.cache.type=redis
# spring.cache.cache-names=quarters,coursesByQuarter,departmentsByQuarter,coursesByQuarterDepartment,courseseByQuarter,classes,departments,quarter
# spring.cache.redis.time-to-live=43200000

## Session cache configs
spring.session.store-type=redis
spring.session.redis.flush-mode=IMMEDIATE
spring.session.redis.namespace=spring:session
# spring.session.store-type=redis
# spring.session.redis.flush-mode=IMMEDIATE
# spring.session.redis.namespace=spring:session

# Google oAuth2 configuration
spring.security.oauth2.client.registration.google.client-id=${GOOGLE_OAUTH_CLIENT_ID_PROD}
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/components/events/CourseSelectors.vue
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,14 @@ export default {
this[selection] = newVal;
this.currentCourses = [];
} else { // cancel
this[selection] = oldVal; // reset
this[selection] = oldVal;
// not preferred, but works
if (selection == "currentQuarter") {
document.querySelector('[for="quarterselect"]').nextElementSibling.firstElementChild.value = oldVal;
}
else if (selection == "currentSession") {
document.querySelector('[for="sessionselect"]').nextElementSibling.firstElementChild.value = oldVal;
}
}
})
} else {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/schedules/Schedule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,9 @@ export default {

/* Transparent background. Fix for issue #78 */
.fc .fc-timegrid-col.fc-day-today {
background-color: #dee2e600;
background-color: #dee2e600 !important;
}

#inner-box > * {
position: absolute;
top: 50%;
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/components/schedules/ScheduleC.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1007,10 +1007,11 @@ export default {
color: #2c3e50;
}

/* Transparent background. Fix for issue #78 */
/* Transparent background. Fix for issue #80 and #78 */
.fc .fc-timegrid-col.fc-day-today {
background-color: #dee2e600;
background-color: #dee2e600 !important;
}

.fc-event {
cursor: pointer;
}
Expand Down
40 changes: 17 additions & 23 deletions frontend/src/components/util/util-methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,43 +44,37 @@ export function getQuarters(){
var dd = String(today.getDate()).padStart(2, "0");

var yyyy = today.getFullYear();
var mm = String(today.getMonth() + 1).padStart(2, "0"); //January is 0!
var mm = String(today.getMonth() + 1).padStart(2, "0"); // months are 0-indexed
var thisquarter = `${yyyy}${mm}${dd}`;

var future = new Date(today);

future.setMonth(today.getMonth() + 2);
future.setMonth(today.getMonth() + 2); // 2 months from today
yyyy = future.getFullYear();
mm = String(future.getMonth() + 1).padStart(2, '0');
mm = String(future.getMonth() + 1).padStart(2, '0'); // months are 0-indexed
var nexthalfquarter = `${yyyy}${mm}${dd}`;

future.setMonth(future.getMonth() + 2);
future.setMonth(future.getMonth() + 2); // 4 months from today
yyyy = future.getFullYear();
mm = String(future.getMonth() + 1).padStart(2, '0');
mm = String(future.getMonth() + 1).padStart(2, '0'); // months are 0-indexed
var nextquarter = `${yyyy}${mm}${dd}`;

future.setMonth(future.getMonth() + 4);
yyyy = future.getFullYear();
mm = String(future.getMonth() + 1).padStart(2, '0');
var nextnextquarter = `${yyyy}${mm}${dd}`;



//TODO: This roundabout method can be shortened if we pull from UCSB's quartercalendar to see the exact dates
// future.setMonth(future.getMonth() + 2); // 6 months from today
// yyyy = future.getFullYear();
// mm = String(future.getMonth() + 1).padStart(2, '0'); // months are 0-indexed
// var nextnextquarter = `${yyyy}${mm}${dd}`;

//TODO: This roundabout method can be more efficent if we pull from UCSB's quartercalendar to see the exact dates

var seen = new Set();
// Get the current and next quarters. Select the next quarter.
Promise.all([api.quarters(thisquarter), api.quarters(nexthalfquarter), api.quarters(nextquarter), api.quarters(nextnextquarter)])
Promise.all([api.quarters(thisquarter), api.quarters(nexthalfquarter), api.quarters(nextquarter)])
.then(responses => {
responses.forEach(resp => quarters.push(resp.data[0]))
if(quarters[2].category == quarters[3].category){ //Remove duplicate quarters
quarters.pop();
}
if(quarters[1].category == quarters[2].category) {
quarters.splice(1, 1);
}
if(quarters[0].category == quarters[1].category) {
quarters.splice(0, 1);
for (let i = 0; i < responses.length; i++) { // Remove duplicates
if (!seen.has(responses[i].data[0].category)) {
seen.add(responses[i].data[0].category);
quarters.push(responses[i].data[0]);
}
}
})
.catch(err => {
Expand Down

0 comments on commit c299c63

Please sign in to comment.